-
Notifications
You must be signed in to change notification settings - Fork 12
/
output.nix
97 lines (89 loc) · 2.59 KB
/
output.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
{ self
, deploy-rs
, flake-utils
, home-manager
, impermanence
, nixpkgs
, sops-nix
, staging
, ...
}@inputs:
let
inherit (builtins) attrNames mapAttrs readDir;
overlays = map (f: import (./overlays + "/${f}")) (attrNames (readDir ./overlays));
mkHost = name: system:
nixpkgs.lib.nixosSystem {
inherit system;
modules = [
({ nixpkgs = { inherit overlays; }; })
({ systemd.package = (import staging { inherit system; }).systemd; })
impermanence.nixosModules.impermanence
home-manager.nixosModules.home-manager
sops-nix.nixosModules.sops
(./hosts + "/${name}")
];
specialArgs.inputs = inputs;
};
mkPath = name: system: deploy-rs.lib.${system}.activate.nixos (mkHost name system);
in
{
deploy = {
autoRollback = true;
magicRollback = true;
user = "root";
nodes = {
# aurelius = {
# hostname = "aurelius";
# profiles.system.path = mkPath "aurelius" "aarch64-linux";
# };
# feuerbach = {
# hostname = "stcg-us-0005-11";
# profiles.system.path = mkPath "feuerbach" "x86_64-linux";
# };
foucault = {
hostname = "100.67.182.67";
profiles.system.path = mkPath "foucault" "x86_64-linux";
magicRollback = false;
};
fourier = {
hostname = "100.113.42.46";
profiles.system.path = mkPath "fourier" "x86_64-linux";
};
goethe = {
hostname = "100.125.185.48";
profiles.system.path = mkPath "goethe" "aarch64-linux";
};
riemann = {
hostname = "100.99.75.64";
profiles.system.path = mkPath "riemann" "aarch64-linux";
};
sartre = {
hostname = "100.97.215.77";
profiles.system.path = mkPath "sartre" "x86_64-linux";
};
};
};
checks = mapAttrs (_: deployLib: deployLib.deployChecks self.deploy) deploy-rs.lib;
} // flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
in
{
defaultApp = self.apps.${system}.deploy;
apps = {
gen-ci = {
type = "app";
program = "${self.packages."${system}".gen-ci}/bin/gen-ci";
};
deploy = {
type = "app";
program = "${deploy-rs.packages."${system}".deploy-rs}/bin/deploy";
};
};
packages.gen-ci = pkgs.callPackage ./gen-ci.nix { hosts = attrNames self.deploy.nodes; };
devShell = pkgs.callPackage ./shell.nix {
inherit (self.packages.${system}) gen-ci;
inherit (sops-nix.packages.${system}) ssh-to-pgp sops-pgp-hook;
inherit (deploy-rs.packages.${system}) deploy-rs;
};
})