feat(nixos): pass inputs and hostName as specialArgs to nixosSystem
This commit is contained in:
parent
b43476ccee
commit
e385783de2
4 changed files with 32 additions and 6 deletions
|
@ -1,4 +1,9 @@
|
|||
{ config, lib, ... }:
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
inputs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (lib.trivial) pipe;
|
||||
inherit (lib.attrsets) filterAttrs mapAttrs';
|
||||
|
@ -13,10 +18,8 @@ let
|
|||
{
|
||||
name = hostName;
|
||||
value = lib.nixosSystem {
|
||||
modules = [
|
||||
value
|
||||
{ networking = { inherit hostName; }; }
|
||||
];
|
||||
specialArgs = { inherit inputs hostName; };
|
||||
modules = [ value ];
|
||||
};
|
||||
};
|
||||
in
|
||||
|
|
4
modules/flake-parts/modules.nix
Normal file
4
modules/flake-parts/modules.nix
Normal file
|
@ -0,0 +1,4 @@
|
|||
{ inputs, ... }:
|
||||
{
|
||||
imports = [ inputs.flake-parts.flakeModules.modules ];
|
||||
}
|
|
@ -1,3 +1,15 @@
|
|||
{ config, ... }:
|
||||
{
|
||||
flake.hostSpec.hosts = { };
|
||||
flake.hostSpec.hosts = {
|
||||
"nixos/test".imports = with config.flake.modules.nixos; [ networking ];
|
||||
"nixos/test".config = {
|
||||
boot.loader.systemd-boot.enable = true;
|
||||
fileSystems."/" = {
|
||||
device = "/dev/sda1";
|
||||
fsType = "ext4";
|
||||
};
|
||||
nixpkgs.hostPlatform = "x86_64-linux";
|
||||
system.stateVersion = "25.05";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
7
modules/modules/nixos/networking.nix
Normal file
7
modules/modules/nixos/networking.nix
Normal file
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
flake.modules.nixos.networking =
|
||||
{ hostName, ... }:
|
||||
{
|
||||
networking = { inherit hostName; };
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue