blob: f99f1305102bf5a09fd5970b7610636b1786af22 (
plain)
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
|
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05";
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
home-manager = {
url = "github:nix-community/home-manager/release-24.05";
inputs.nixpkgs.follows = "nixpkgs";
};
flake-compat.url = "github:edolstra/flake-compat";
oisd = {
url = "github:sjhgvr/oisd";
flake = false;
};
};
outputs = inputs @ { self, nixpkgs, nixpkgs-unstable, home-manager, ... }:
let
tailnetName = "serval-moth";
systems = {
x86 = "x86_64-linux";
arm = "aarch64-linux";
};
mkMachines = let
mkMachine = m: {
inherit (m) name system;
tailscale = {
inherit (m.tailscale) ip;
domain = "${m.name}.${tailnetName}.ts.net";
};
};
mkIdentities = ms: current:
lib.genAttrs (lib.catAttrs "name" ms) (m: current.name == m);
in machines: map (m: (mkMachine m) // (mkIdentities machines m)) machines;
machines = with systems; mkMachines [
{ name = "corsac"; system = x86; tailscale.ip = "100.64.100.100"; }
{ name = "lapin"; system = arm; tailscale.ip = "100.83.254.27"; }
{ name = "renard"; system = x86; tailscale.ip = "100.75.17.75"; }
];
packageSetsForSystem = system: let
pkgsInputs = { inherit system; config = import ./config.nix; };
in rec {
pkgs = import nixpkgs pkgsInputs;
unstablePkgs = import nixpkgs-unstable pkgsInputs;
auxiliaryPkgs = import ./pkgs { inherit system pkgs unstablePkgs; };
};
inherit (nixpkgs) lib;
in {
nixosConfigurations = lib.mergeAttrsList (map (machine: {
${machine.name} = nixpkgs.lib.nixosSystem {
inherit (machine) system;
specialArgs = inputs // (packageSetsForSystem machine.system) // {
me = machine;
security = import ./security.nix;
util = import ./util.nix { inherit lib; };
};
modules = [
./machines/${machine.name}
home-manager.nixosModules.home-manager {
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.mel = import ./machines/${machine.name}/home.nix;
}
];
};
}) machines);
# compatibility wrapper for nixos-option
legacyPackages = lib.genAttrs (lib.attrValues systems)
(system: with packageSetsForSystem system; pkgs.recurseIntoAttrs pkgs);
};
}
|