-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
83 lines (78 loc) · 2.45 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
{
description = "kcloud server config";
inputs = {
nixpkgs.url = "nixpkgs/nixos-24.05-small";
unstable.url = "nixpkgs/nixos-unstable-small";
deploy-rs = {
url = "github:serokell/deploy-rs";
inputs.nixpkgs.follows = "nixpkgs";
};
agenix = {
url = "github:ryantm/agenix";
inputs.nixpkgs.follows = "nixpkgs";
inputs.darwin.follows = "";
};
disko = {
url = "github:nix-community/disko/latest";
inputs.nixpkgs.follows = "nixpkgs";
};
# my own stuff
dt = {
url = "gitlab:Follpvosten/dt-theme";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, unstable, deploy-rs, agenix, disko, dt }:
let
consts = import ./const.nix;
mkSystem = { name, system, extraModules?[], extraSpecialArgs?{} }:
nixpkgs.lib.nixosSystem {
inherit system;
modules = [
(./. + "/${name}/configuration.nix")
agenix.nixosModules.default
] ++ extraModules;
specialArgs = { inherit consts; } // extraSpecialArgs;
};
mkNode = { name, system, ... }: {
sshUser = "root";
hostname = name;
profiles.system = {
user = "root";
path = deploy-rs.lib."${system}".activate.nixos self.nixosConfigurations."${name}";
};
};
systems = {
kcloud-nix = rec {
name = "kcloud-nix";
system = "aarch64-linux";
extraSpecialArgs = {
dtPkgs = dt.packages."${system}";
unstable = unstable.legacyPackages."${system}";
};
};
karp-zbox = rec {
name = "karp-zbox";
system = "x86_64-linux";
extraSpecialArgs.unstable = unstable.legacyPackages."${system}";
};
bakapa = {
name = "bakapa";
system = "x86_64-linux";
extraModules = [ disko.nixosModules.disko ];
};
};
in {
nixosConfigurations = builtins.mapAttrs (_name: system: mkSystem system) systems;
deploy.nodes = builtins.mapAttrs (_name: system: mkNode system) systems;
# comment out if you don't have an aarch64 builder instance or
# `boot.binfmt.emulatedSystems = [ "aarch64-linux" ];` set
checks = builtins.mapAttrs (system: deployLib: deployLib.deployChecks self.deploy) deploy-rs.lib;
devShells.x86_64-linux.default = nixpkgs.legacyPackages."x86_64-linux".mkShell {
packages = [
deploy-rs.packages.x86_64-linux.deploy-rs
agenix.packages.x86_64-linux.default
];
};
};
}