-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
89 lines (78 loc) · 2.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
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
{
description = "Sea of Dirac setup";
inputs = {
### Official NixOS Package Sources ###
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05";
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
# Official hardware configurations
nixos-hardware.url = "github:nixos/nixos-hardware/master";
### Utility repos ###
# Deployment tool with magic rollback
deploy-rs = {
url = "github:serokell/deploy-rs";
inputs.nixpkgs.follows = "nixpkgs";
# inputs.utils.follows = "flake-utils";
};
# Declarative partitioning and formatting
disko = {
url = "github:nix-community/disko";
inputs.nixpkgs.follows = "nixpkgs";
};
# Declarative mail server with postfix and dovecot
snm = {
url = "gitlab:simple-nixos-mailserver/nixos-mailserver/nixos-24.05";
inputs = {
nixpkgs.follows = "nixpkgs";
nixpkgs-24_05.follows = "nixpkgs";
utils.follows = "deploy-rs/utils";
flake-compat.follows = "deploy-rs/flake-compat";
};
};
# Secrets management. TODO ./docs/secrets.md
sops-nix = {
url = "github:mic92/sops-nix";
inputs.nixpkgs.follows = "nixpkgs";
inputs.nixpkgs-stable.follows = "nixpkgs";
};
};
outputs = {
self,
nixpkgs,
deploy-rs,
...
} @ inputs: let
inherit (nixpkgs) lib;
systems = [
"aarch64-linux"
"x86_64-linux"
];
forAllSystems = function:
nixpkgs.lib.genAttrs systems function;
in {
devShells = forAllSystems (system: import ./shell.nix (inputs // {inherit system;}));
formatter = forAllSystems (system: nixpkgs.legacyPackages.${system}.alejandra);
nixosConfigurations = import ./hosts inputs;
nixosModules = import ./modules inputs;
overlays = import ./overlays/factorio.nix {};
# Deploy-rs uses "outputs.deploy" and "outputs.checks"
deploy = {
sshUser = "root";
user = "root";
fastConnect = true;
# Create a deploy with the system profile for each nixosConfigurations
nodes =
lib.recursiveUpdate (
builtins.mapAttrs (hostname: nixosConfig: {
inherit hostname;
profiles.system.path = deploy-rs.lib.${nixosConfig.config.nixpkgs.system}.activate.nixos nixosConfig;
})
(lib.filterAttrs (n: _v: n != "aluminium") self.nixosConfigurations)
)
{
crunchbits.fastConnect = false;
littlecreek.fastConnect = false;
};
};
checks = builtins.mapAttrs (_system: deployLib: deployLib.deployChecks self.deploy) deploy-rs.lib;
};
}