-
Notifications
You must be signed in to change notification settings - Fork 3
/
flake.nix
57 lines (51 loc) · 1.56 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
{
description = "";
inputs = {
cachix-deploy-flake.url = "github:cachix/cachix-deploy-flake";
};
outputs = { nixpkgs, cachix-deploy-flake, ... }:
let
# change these
machineName = "myagent";
sshPubKey = "ssh-rsa XXX me@machine";
lib = nixpkgs.lib;
forAllSystems = lib.genAttrs lib.systems.flakeExposed;
common = system: rec {
pkgs = nixpkgs.legacyPackages.${system};
cachix-deploy-lib = cachix-deploy-flake.lib pkgs;
bootstrapNixOS = cachix-deploy-lib.bootstrapNixOS {
system = system;
hostname = machineName;
grubDevices = [ "/dev/nvme0n1" "/dev/nvme1n1" ];
sshPubKey = sshPubKey;
};
};
in {
nixosConfigurations.${machineName} = (common "x86_64-linux").bootstrapNixOS.nixos;
packages = forAllSystems (system:
let
inherit (common system) pkgs cachix-deploy-lib bootstrapNixOS;
in {
default = cachix-deploy-lib.spec {
agents = {
"${machineName}" = cachix-deploy-lib.nixos {
imports = [ bootstrapNixOS.module ];
config = {
# here comes all your NixOS configuration
};
};
};
};
});
devShells = forAllSystems (system:
let
inherit (common system) pkgs;
in {
default = pkgs.mkShell {
buildInputs = [
cachix-deploy-flake.packages.${system}.bootstrapHetzner
];
};
});
};
}