-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
94 lines (89 loc) · 2.75 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
{
description = "(Neo)vim perceptual color scheme compiler";
inputs = {
flake-utils.url = "github:numtide/flake-utils";
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
termsnap = {
url = "github:tomcur/termsnap";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { nixpkgs, flake-utils, termsnap, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
rec {
packages.hi-nvim-rs = pkgs.rustPlatform.buildRustPackage {
pname = "hi-nvim-rs";
version = (pkgs.lib.trivial.importTOML ./Cargo.toml).package.version;
src = ./.;
cargoLock = {
lockFile = ./Cargo.lock;
};
};
packages.hi-nvim-rs-web = pkgs.rustPlatform.buildRustPackage {
pname = "hi-nvim-rs-web";
version = (pkgs.lib.trivial.importTOML ./hi-nvim-rs-web/Cargo.toml).package.version;
src = ./.;
buildAndTestSubdir = "hi-nvim-rs-web";
cargoLock = {
lockFile = ./Cargo.lock;
};
};
packages.default = packages.hi-nvim-rs;
# Compiles a colorscheme. Use like
#
# ```nix
# buildColorscheme {
# name = "highlow";
# colorschemeFile = ./highlow.toml;
# target = "neovim";
# }
# ```
buildColorscheme = { name, colorschemeFile, target }:
assert target == "neovim" || target == "vim";
pkgs.stdenv.mkDerivation {
name = name;
dontUnpack = true;
buildPhase = ''
${packages.hi-nvim-rs}/bin/hi-nvim-rs --target ${target} "${colorschemeFile}" > "${name}.vim"
'';
installPhase = ''
cp "${name}.vim" $out
'';
};
devShells.default =
let
nvim = (pkgs.wrapNeovimUnstable pkgs.neovim-unwrapped {
packpathDirs = {
myNeovimPackages.start = [
pkgs.vimPlugins.nvim-treesitter
pkgs.vimPlugins.nvim-treesitter-parsers.rust
pkgs.vimPlugins.nvim-lspconfig
pkgs.vimPlugins.nvim-tree-lua
pkgs.vimPlugins.trouble-nvim
];
};
});
in
pkgs.mkShell
{
buildInputs = (with pkgs; [
cargo
clippy
rust-analyzer
rustc
rustfmt
]) ++ [
# Automated screenshots
termsnap.packages.${system}.default
];
SCREENSHOT_NVIM = "${nvim}/bin/nvim";
};
}
);
}