-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
executable file
·80 lines (79 loc) · 2.62 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
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs?ref=nixos-unstable";
nixpkgs-unstable.url = "github:NixOS/nixpkgs?ref=nixpkgs-unstable";
home-manager.url = "github:nix-community/home-manager";
};
outputs = {
self,
nixpkgs,
nixpkgs-unstable,
home-manager,
} @ inputs: let
inherit (nixpkgs) lib;
mapPkgsForEachSystem = callback:
nixpkgs.lib.genAttrs
nixpkgs.lib.systems.flakeExposed
(system: callback nixpkgs.legacyPackages.${system});
in {
colmena = {
meta = {
nixpkgs = import nixpkgs {
# TODO also build for other systems where needed
system = "x86_64-linux";
};
specialArgs = {inherit inputs;};
};
michaili-fortress.deployment = {
allowLocalDeployment = true;
#buildOnTarget = true;
targetHost = null; # TODO Remove when multiple personal devices are being introduced to the config
# see README for why this is commented out
/*
keys.users-michaili-password = {
# TODO might not want to ship secrets as part of this Git repo
keyCommand = ["gpg" "--decrypt" "${./secrets/users-michaili-password}"];
};
*/
#keys."michaili-fortress/tailscale-key".keyCommand = [ "gpg" "--decrypt" "${./secrets/michaili-fortress/tailscale-key.gpg}" ];
};
defaults = {
name,
config,
...
}: {
imports = lib.flatten [
(lib.filter (filePath: lib.hasSuffix ".nix" filePath) (lib.fileset.toList ./hosts/${name}))
./modules/secrets.nix
home-manager.nixosModules.home-manager
];
deployment = {
keys = lib.mkMerge [
# Local/host specific secrets
(lib.mkIf
config.ili.secrets.includeLocalSecrets
(lib.listToAttrs (map (path: {
name = lib.removePrefix "./" "${lib.path.removePrefix ./hosts/${name}/secrets path}";
value = {
keyCommand = ["gpg" "--decrypt" "${path}"];
};
}) (lib.fileset.toList ./hosts/${name}/secrets))))
# Global/shared secrets
(lib.listToAttrs (map (secretName: {
name = "global/${secretName}";
value = {
keyCommand = ["gpg" "--decrypt" "${./secrets/${secretName}}"];
};
})
config.ili.secrets.globalSecrets))
];
};
};
};
devShells = mapPkgsForEachSystem (pkgs: {
default = pkgs.mkShell {
packages = with pkgs; [colmena alejandra];
};
});
};
}