Compare commits
8 commits
nonapode/f
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| d1e661df5d | |||
| 01106110fe | |||
| d281a23a8a | |||
| 1b5b697dfb | |||
| 72f2a2ddc0 | |||
| f3f83a56ab | |||
| a5dc014e65 | |||
| 7585be3dac |
3 changed files with 58 additions and 80 deletions
|
|
@ -10,36 +10,58 @@
|
||||||
{ ... }@inputs:
|
{ ... }@inputs:
|
||||||
{ host, ... }@imports:
|
{ host, ... }@imports:
|
||||||
let
|
let
|
||||||
host' =
|
pre-switch-check =
|
||||||
name: snippets:
|
{ pkgs, lib, config, ... }:
|
||||||
let
|
{
|
||||||
system =
|
config.system.preSwitchChecks.nvd = ''
|
||||||
{
|
nvd_check=y
|
||||||
namespace ? "fbs42",
|
if [[ -d /run/current-system ]]
|
||||||
nixpkgs ? "nixpkgs",
|
then
|
||||||
}:
|
${lib.getExe pkgs.nvd} --nix-bin-dir ${config.nix.package}/bin diff /run/current-system "''${1}"
|
||||||
inputs.${nixpkgs}.lib.nixosSystem {
|
if [[ -t 0 ]]; then
|
||||||
specialArgs = { inherit inputs flake namespace; };
|
printf 'really %s to %s? [y]es/[N]o ' "''${2}" "''${1}"
|
||||||
modules =
|
read -r nvd_check
|
||||||
builtins.concatLists (
|
fi
|
||||||
map (
|
fi
|
||||||
base: builtins.attrValues (flake.lib.scan { base = "${base}/host/${name}"; })
|
[[ "''${nvd_check}" == y ]]
|
||||||
) flake.lib.schema.base
|
'';
|
||||||
)
|
};
|
||||||
++ [ { config.networking.hostName = name; } ]
|
|
||||||
++ [ nixosModules.default ]
|
|
||||||
++ [ inputs.home-manager.nixosModules.default ]
|
|
||||||
++ [ { config.home-manager.sharedModules = [ hmModules.default ]; } ]
|
|
||||||
++ [ { config.home-manager.extraSpecialArgs = { inherit flake namespace; }; } ]
|
|
||||||
++ builtins.attrValues nixosUsers
|
|
||||||
++ builtins.attrValues nixosGroups;
|
|
||||||
};
|
|
||||||
|
|
||||||
cfg =
|
system =
|
||||||
assert builtins.length snippets == 1;
|
hostname:
|
||||||
builtins.head snippets;
|
{
|
||||||
in
|
namespace ? "fbs42",
|
||||||
system cfg;
|
nixpkgs ? "nixpkgs",
|
||||||
|
classes ? [ hostname ],
|
||||||
|
}:
|
||||||
|
inputs.${nixpkgs}.lib.nixosSystem {
|
||||||
|
specialArgs = { inherit inputs flake namespace; };
|
||||||
|
modules =
|
||||||
|
builtins.concatLists (
|
||||||
|
map (
|
||||||
|
base: builtins.attrValues (flake.lib.scan { base = "${base}/host/${hostname}"; })
|
||||||
|
) flake.lib.schema.base
|
||||||
|
)
|
||||||
|
++ map (class: {
|
||||||
|
imports = map (input: input.${namespace}.${class} or { }) (builtins.attrValues inputs);
|
||||||
|
}) classes
|
||||||
|
++ [ pre-switch-check ]
|
||||||
|
++ [ { config.networking.hostName = hostname; } ]
|
||||||
|
++ [ nixosModules.default ]
|
||||||
|
++ inputs.${nixpkgs}.lib.optional (inputs ? home-manager) {
|
||||||
|
imports = [ inputs.home-manager.nixosModules.default ];
|
||||||
|
config.home-manager = {
|
||||||
|
sharedModules = [ hmModules.default ];
|
||||||
|
extraSpecialArgs = { inherit flake namespace; };
|
||||||
|
};
|
||||||
|
}
|
||||||
|
++ builtins.attrValues nixosUsers
|
||||||
|
++ builtins.attrValues nixosGroups;
|
||||||
|
};
|
||||||
|
|
||||||
in
|
in
|
||||||
builtins.mapAttrs host' host
|
builtins.mapAttrs (
|
||||||
|
name: value:
|
||||||
|
assert builtins.length value == 1;
|
||||||
|
system name (builtins.head value)
|
||||||
|
) host
|
||||||
|
|
|
||||||
46
flake.lock
generated
46
flake.lock
generated
|
|
@ -1,61 +1,23 @@
|
||||||
{
|
{
|
||||||
"nodes": {
|
"nodes": {
|
||||||
"hardware": {
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1753122741,
|
|
||||||
"narHash": "sha256-nFxE8lk9JvGelxClCmwuJYftbHqwnc01dRN4DVLUroM=",
|
|
||||||
"owner": "nixos",
|
|
||||||
"repo": "nixos-hardware",
|
|
||||||
"rev": "cc66fddc6cb04ab479a1bb062f4d4da27c936a22",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "nixos",
|
|
||||||
"repo": "nixos-hardware",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"home-manager": {
|
|
||||||
"inputs": {
|
|
||||||
"nixpkgs": [
|
|
||||||
"nixpkgs"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1757808926,
|
|
||||||
"narHash": "sha256-K6PEI5PYY94TVMH0mX3MbZNYFme7oNRKml/85BpRRAo=",
|
|
||||||
"owner": "nix-community",
|
|
||||||
"repo": "home-manager",
|
|
||||||
"rev": "f21d9167782c086a33ad53e2311854a8f13c281e",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "nix-community",
|
|
||||||
"ref": "release-25.05",
|
|
||||||
"repo": "home-manager",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1757810152,
|
"lastModified": 1763966396,
|
||||||
"narHash": "sha256-Vp9K5ol6h0J90jG7Rm4RWZsCB3x7v5VPx588TQ1dkfs=",
|
"narHash": "sha256-6eeL1YPcY1MV3DDStIDIdy/zZCDKgHdkCmsrLJFiZf0=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "9a094440e02a699be5c57453a092a8baf569bdad",
|
"rev": "5ae3b07d8d6527c42f17c876e404993199144b6a",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"ref": "nixos-25.05",
|
"ref": "nixos-unstable",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"hardware": "hardware",
|
|
||||||
"home-manager": "home-manager",
|
|
||||||
"nixpkgs": "nixpkgs"
|
"nixpkgs": "nixpkgs"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
10
flake.nix
10
flake.nix
|
|
@ -1,12 +1,6 @@
|
||||||
{
|
{
|
||||||
inputs = {
|
# only used for nixfmt-tree
|
||||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-25.05";
|
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||||
hardware.url = "github:nixos/nixos-hardware";
|
|
||||||
home-manager = {
|
|
||||||
url = "github:nix-community/home-manager/release-25.05";
|
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
outputs = { self, ... }@inputs: import ./lib/flake.nix inputs ./.;
|
outputs = { self, ... }@inputs: import ./lib/flake.nix inputs ./.;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue