Files
lux/modules/flake-parts.nix
T
2026-06-23 21:23:35 +02:00

83 lines
1.6 KiB
Nix

{
inputs,
config,
...
}:
let
mkHost =
name: machine:
{ pkgs, ... }:
let
account = config.facts.account;
hmStateVersion = machine.hmStateVersion or machine.stateVersion;
machineFacts = {
displays = { };
portable = false;
sshKeys = { };
syncthingId = null;
}
// machine
// {
inherit name hmStateVersion;
};
in
{
imports = [
config.flake.modules.nixos.${name}
];
facts = {
inherit (config.facts)
account
machines
services
theme
;
machine = machineFacts;
};
networking.hostName = name;
system.stateVersion = machine.stateVersion;
programs.zsh.enable = true;
users.users.${account.name} = {
isNormalUser = true;
home = account.homeDirectory;
extraGroups = [
"wheel"
"networkmanager"
];
shell = pkgs.zsh;
};
home-manager.users.${account.name}.home = {
username = account.name;
homeDirectory = account.homeDirectory;
stateVersion = hmStateVersion;
};
};
in
{
imports = [
inputs.flake-parts.flakeModules.modules
./facts.nix
];
systems = [ "x86_64-linux" ];
flake.nixosConfigurations = builtins.mapAttrs (
name: machine:
inputs.nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs; };
modules = [ (mkHost name machine) ];
}
) config.facts.machines;
perSystem =
{ pkgs, ... }:
{
formatter = pkgs.nixfmt-tree;
};
}