-
Notifications
You must be signed in to change notification settings - Fork 1
/
flake.nix
60 lines (58 loc) · 2.13 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
{
description = "NixOS configuration for my personal hosts.";
inputs = {
nixpkgs.url = "nixpkgs/nixos-24.11";
unstable.url = "nixpkgs/nixos-unstable";
hardware.url = "github:NixOS/nixos-hardware/master";
disko = {
url = "github:nix-community/disko/latest";
inputs.nixpkgs.follows = "nixpkgs";
};
nixos-generators = {
url = "github:nix-community/nixos-generators/master";
inputs.nixpkgs.follows = "nixpkgs";
};
agenix = {
url = "github:ryantm/agenix";
inputs.nixpkgs.follows = "nixpkgs";
inputs.darwin.follows = "";
inputs.home-manager.follows = "";
};
};
outputs = { self, nixpkgs, unstable, hardware, disko, nixos-generators, agenix }:
let
overlay = final: prev: let
unstablePkgs = import unstable { inherit (prev) system; config.allowUnfree = true; };
in {
unstable = unstablePkgs;
zfsUnstable = unstablePkgs.zfsUnstable;
erigon = import ./pkgs/erigon.nix { pkgs = prev; };
};
# Overlays-module makes "pkgs.unstable" available in configuration.nix
overlayModule = ({ config, pkgs, ... }: { nixpkgs.overlays = [ overlay ]; });
# To generate host configurations for all hosts.
hostnames = builtins.attrNames (builtins.readDir ./hosts);
# Some hosts are ARM64.
systemForHost = hostname:
if builtins.elem hostname ["leliel" "sachiel" "shamshel"] then "aarch64-linux"
else "x86_64-linux";
in {
# Systems
nixosConfigurations = builtins.listToAttrs (builtins.map (hostname: {
name = hostname;
value = nixpkgs.lib.nixosSystem {
system = systemForHost hostname;
# Allow access to all channels from inputs in modules.
specialArgs.channels = { inherit nixpkgs unstable hardware agenix; };
modules = [
overlayModule
disko.nixosModules.disko
agenix.nixosModules.default
nixos-generators.nixosModules.all-formats
./hosts/${hostname}/configuration.nix
({...}: { networking.hostName = hostname; })
];
};
}) hostnames);
};
}