-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtools.nix
30 lines (28 loc) · 873 Bytes
/
tools.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
# Random helper functions
{ pkgs, ... }: {
# Execute a command by referencing its Nix path and set arguments
cmd = bin: args: "${pkgs.${bin}}/bin/${bin} ${args}";
# Reference a user secret that agenix will decrypt using the host key
userSecret = fileName: {
"${fileName}" = {
file = secrets/${fileName}.age;
owner = "kamek";
};
};
# Define NixOS machines
nixosMachine = system: nixpkgs: agenix: hm: user: hostName: {
${hostName} = nixpkgs.lib.nixosSystem {
inherit system;
modules = [
./machines/${hostName}/configuration.nix
agenix.nixosModules.default
hm.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.${user} = import ./machines/${hostName}/home.nix;
}
];
};
};
}