-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
64 lines (58 loc) · 1.86 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
{
description = "A very basic flake";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
nixpkgs-unstable.url = "nixpkgs/nixos-unstable";
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
# agenix for encrypting secrets
agenix = {
url = "github:ryantm/agenix";
inputs.nixpkgs.follows = "nixpkgs";
};
# formatter for *.nix files
treefmt-nix = {
url = "github:numtide/treefmt-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, nixpkgs-unstable, agenix, treefmt-nix, nixos-hardware, ... }:
let
pkgs = system: import nixpkgs {
inherit system;
config = { allowUnfree = true; };
};
pkgs-unstable = system: import nixpkgs-unstable {
inherit system;
config = { allowUnfree = true; };
};
lib = nixpkgs.lib;
treefmtEval = treefmt-nix.lib.evalModule (pkgs "x86_64-linux") ./treefmt.nix;
in
{
formatter."x86_64-linux" = treefmtEval.config.build.wrapper;
checks."x86_64-linux".formatter = treefmtEval.config.build.check self;
nixosConfigurations = builtins.listToAttrs (
builtins.map
(host: {
name = host.name;
system = host.system;
value = lib.nixosSystem {
system = host.system;
pkgs = (pkgs host.system);
specialArgs = {
pkgs-unstable = pkgs-unstable host.system;
};
modules = [
agenix.nixosModules.default
{
_module.args.agenix = agenix.packages.${host.system}.default;
}
./modules/modules.nix
./services/services.nix
] ++ host.nixosModules;
};
})
(import ./hosts.nix { inherit nixos-hardware; })
);
};
}