-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
145 lines (129 loc) · 4.47 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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
{
description = ''
Personal NixOS system configurations, modules and packages
'';
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
impermanence.url = "github:nix-community/impermanence/master";
nixos-wsl = {
url = "github:nix-community/NixOS-WSL/main";
inputs.nixpkgs.follows = "nixpkgs";
};
sops-nix = {
url = "github:Mic92/sops-nix/master";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, ... }: let
forEachSystem = nixpkgs.lib.genAttrs [
"aarch64-darwin"
"aarch64-linux"
"x86_64-darwin"
"x86_64-linux"
];
in {
overlays = nixpkgs.lib.packagesFromDirectoryRecursive {
callPackage = path: overrides: import path;
directory = ./overlays;
};
legacyPackages = forEachSystem (system:
nixpkgs.lib.packagesFromDirectoryRecursive {
callPackage = nixpkgs.legacyPackages.${system}.callPackage;
directory = ./pkgs;
});
apps = forEachSystem (system: {
nvim = {
type = "app";
program =
let
evaluatedModules = import "${nixpkgs}/nixos/lib/eval-config.nix" {
inherit system;
specialArgs = { inherit self; };
modules = [
self.outputs.nixosModules.neovim
./profiles/neovim
({ pkgs, ... }: {
nixpkgs.overlays = [ self.overlays.default ];
programs.neovim.plugins = [(
pkgs.vimUtils.buildVimPlugin {
name = "lua-config";
src = ./profiles/neovim/nvim;
postInstall = "mv $out/init.lua $out/plugin/init.lua";
# https://nixos.org/manual/nixpkgs/unstable/#testing-neovim-plugins-neovim-require-check
doCheck = false;
}
)];
})
];
};
in
nixpkgs.lib.getExe evaluatedModules.config.programs.neovim.finalPackage;
meta.description = "Self-contained Neovim environment";
};
diff-closures = {
type = "app";
program =
let
pkgs = nixpkgs.legacyPackages.${system};
package = pkgs.writeShellApplication {
name = "diff-closures";
runtimeInputs = with pkgs; [
coreutils-full
gnugrep
];
text = builtins.readFile ./scripts/diff-closures.sh;
};
in
nixpkgs.lib.getExe package;
meta.description = "List added/removed packages and version updates between two closures.";
};
is-cached = {
type = "app";
program =
let
pkgs = nixpkgs.legacyPackages.${system};
package = pkgs.writeShellApplication {
name = "is-cached";
runtimeInputs = with pkgs; [
coreutils-full
curl
];
text = builtins.readFile ./scripts/is-cached.sh;
excludeShellChecks = [
"SC2028" # https://github.com/koalaman/shellcheck/issues/2486
];
};
in
nixpkgs.lib.getExe package;
meta.description = "List cache availability for a derivation and its dependencies in https://cache.nixos.org.";
};
});
nixosModules = {
mpv = ./modules/mpv;
neovim = ./modules/neovim;
unfree = ./modules/unfree;
};
nixosConfigurations = nixpkgs.lib.mapAttrs (name: _:
nixpkgs.lib.nixosSystem {
specialArgs = { inherit self; };
modules = [
self.inputs.impermanence.nixosModules.default
self.inputs.nixos-wsl.nixosModules.default
self.inputs.sops-nix.nixosModules.default
self.outputs.nixosModules.mpv
self.outputs.nixosModules.neovim
self.outputs.nixosModules.unfree
{ networking.hostName = name; }
./profiles/common
./hosts/${name}
];
})
(builtins.readDir ./hosts);
checks.aarch64-linux = {
deimosImage = self.outputs.nixosConfigurations.deimos.config.system.build.images.raw;
lunaImage = self.outputs.nixosConfigurations.luna.config.system.build.images.raw;
marsImage = self.outputs.nixosConfigurations.mars.config.system.build.images.raw;
phobosImage = self.outputs.nixosConfigurations.phobos.config.system.build.images.raw;
};
};
}