nix: add modular nixos and home-manager configuration loading
This commit is contained in:
parent
062900f878
commit
7af5b0d467
6 changed files with 213 additions and 0 deletions
15
spec/channel.nix
Normal file
15
spec/channel.nix
Normal file
|
@ -0,0 +1,15 @@
|
|||
{ inputs, ... }: with inputs; with nixpkgs.lib; let
|
||||
mapInputs = fn: map fn (lists.remove "self" (attrNames inputs));
|
||||
channelPath = "/etc/nix/channels";
|
||||
in {
|
||||
nix = {
|
||||
nixPath = mapInputs (i: "${i}=${channelPath}/${i}");
|
||||
registry = listToAttrs
|
||||
(mapInputs (name: {
|
||||
inherit name;
|
||||
value = {flake = inputs.${name};};
|
||||
}));
|
||||
};
|
||||
|
||||
systemd.tmpfiles.rules = mapInputs (i: "L+ ${channelPath}/${i} - - - - ${inputs.${i}.outPath}");
|
||||
}
|
7
spec/constant.nix
Normal file
7
spec/constant.nix
Normal file
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
i18n.defaultLocale = "en_GB.UTF-8";
|
||||
time.timeZone = "Asia/Hong_Kong";
|
||||
environment.etc.nixos.source = "/nix/persist/config";
|
||||
nix.settings.experimental-features = [ "nix-command" "flakes" ];
|
||||
system.stateVersion = "23.11";
|
||||
}
|
29
spec/default.nix
Normal file
29
spec/default.nix
Normal file
|
@ -0,0 +1,29 @@
|
|||
{ inputs, ... }: with inputs; with nixpkgs.lib; {
|
||||
flake.nixosConfigurations = (lists.foldr (name: spec: spec // {
|
||||
${name} = nixpkgs.lib.nixosSystem {
|
||||
system = "x86_64-linux";
|
||||
specialArgs = inputs // { inherit inputs; };
|
||||
modules = [
|
||||
../faucet
|
||||
../home/profile.nix
|
||||
../home/user.nix
|
||||
./constant.nix
|
||||
./channel.nix
|
||||
impermanence.nixosModules.impermanence
|
||||
home-manager.nixosModules.home-manager
|
||||
{
|
||||
home-manager.useGlobalPkgs = true;
|
||||
home-manager.useUserPackages = true;
|
||||
}
|
||||
lanzaboote.nixosModules.lanzaboote
|
||||
|
||||
./${name}
|
||||
{ networking.hostName = name; }
|
||||
];
|
||||
};
|
||||
}) { }) (pipe ./. [
|
||||
builtins.readDir
|
||||
(filterAttrs (n: ty: ty == "directory" && builtins.pathExists ./${n}/default.nix))
|
||||
(mapAttrsToList (n: _: n))
|
||||
]);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue