-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
128 lines (117 loc) · 3.46 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
{
inputs = {
deploy-rs = {
url = github:serokell/deploy-rs;
inputs = {
flake-compat.follows = "flake-compat";
nixpkgs.follows = "nixpkgs";
utils.follows = "flake-utils";
};
};
flake-compat.url = github:edolstra/flake-compat;
flake-utils.url = github:numtide/flake-utils;
helix = {
url = github:helix-editor/helix;
inputs = {
flake-utils.follows = "flake-utils";
nixpkgs.follows = "nixpkgs";
};
};
home-manager = {
url = github:nix-community/home-manager;
inputs.nixpkgs.follows = "nixpkgs";
};
nixos-attest = {
url = "https://git.ins.jku.at/proj/digidow/nixos-attest.git";
type = "git";
inputs.nixpkgs.follows = "nixpkgs";
};
nixos-hardware.url = github:NixOS/nixos-hardware/master;
nixpkgs.url = github:NixOS/nixpkgs/nixos-unstable;
};
outputs = { self, deploy-rs, nixpkgs, ... }@inputs:
let
system = "x86_64-linux";
update-systemd-resolved-overlay = (_: super: {
update-systemd-resolved = super.update-systemd-resolved.overrideAttrs (old: {
patches = (old.patches or []) ++ [(
super.fetchpatch {
url = "https://github.com/jonathanio/update-systemd-resolved/commit/04ad1d1732ecb4353d6ce997b3e13b0ae710edd3.patch";
sha256 = "sha256-h0xot8nWKvlbhRm6BVF2V5S8z19NI31GRRAWUetNU88=";
})];
});
});
pkgs = import nixpkgs {
inherit system;
overlays = [ update-systemd-resolved-overlay ];
config.allowUnfree = true;
};
pkgsWithRocm = import nixpkgs {
inherit system;
overlays = [ update-systemd-resolved-overlay ];
config.allowUnfree = true;
config.rocmSupport = true;
};
mapAttrsToList = pkgs.lib.attrsets.mapAttrsToList;
nixosSystem = {...}@args: (nixpkgs.lib.nixosSystem ({
inherit pkgs system;
# pass flake inputs to individual module files
specialArgs = { inherit inputs; };
} // args));
in
{
deploy = {
sshOpts = [ "-A" ];
nodes = {
lair = {
hostname = "lair";
profiles.system = {
user = "root";
path = deploy-rs.lib.x86_64-linux.activate.nixos self.nixosConfigurations.lair;
};
};
hatchery = {
hostname = "hatchery";
profiles.system = {
user = "root";
path = deploy-rs.lib.x86_64-linux.activate.nixos self.nixosConfigurations.hatchery;
};
};
};
};
# add deploy-rs deployment checks to prevent errors
checks = builtins.mapAttrs (system: deployLib: deployLib.deployChecks self.deploy) deploy-rs.lib;
defaultPackage."x86_64-linux" = pkgs.linkFarm "nixos-all" (
mapAttrsToList(n: v:
{ name = n; path = v.config.system.build.toplevel;})
self.nixosConfigurations
# TODO: add home-manager config
);
homeConfigurations."deck" = pkgs.callPackage ./home/linux.nix { inherit inputs; };
# home server
nixosConfigurations.lair = nixosSystem {
modules = [
./machines/lair.nix
];
};
# backup server
nixosConfigurations.hatchery = nixosSystem {
modules = [
./machines/hatchery.nix
];
};
# desktop pc
nixosConfigurations.hydralisk = nixosSystem {
pkgs = pkgsWithRocm;
modules = [
./machines/hydralisk.nix
];
};
# thinkpad laptop
nixosConfigurations.mutalisk = nixosSystem {
modules = [
./machines/mutalisk.nix
];
};
};
}