34 lines
936 B
Nix
34 lines
936 B
Nix
let
|
|
inherit (builtins) filter mapAttrs;
|
|
|
|
# https://github.com/andir/npins?tab=readme-ov-file#using-the-nixpkgs-fetchers
|
|
src = import ./npins;
|
|
pkgs = import src.nixpkgs { };
|
|
sources = mapAttrs (_: v: v { inherit pkgs; }) src;
|
|
|
|
inherit (pkgs) lib;
|
|
inherit (lib.filesystem) listFilesRecursive;
|
|
inherit (lib.strings) hasSuffix;
|
|
|
|
mkSystem =
|
|
hostname:
|
|
import (src.nixpkgs + "/nixos/lib/eval-config.nix") {
|
|
specialArgs = {
|
|
inherit sources;
|
|
self = ./.;
|
|
};
|
|
modules = [
|
|
# This is used to pre-emptively set the hostPlatform for nixpkgs.
|
|
# Also, we set the system hostname here.
|
|
{ networking.hostName = hostname; }
|
|
./hosts/common.nix
|
|
./hosts/${hostname}
|
|
]
|
|
++ ((listFilesRecursive ./modules) |> filter (hasSuffix ".mod.nix"));
|
|
};
|
|
in
|
|
{
|
|
temperance = mkSystem "temperance";
|
|
hermit = mkSystem "hermit";
|
|
tower = mkSystem "tower";
|
|
}
|