rearrange things and move home-manager to mkHostConfig function

This commit is contained in:
Lgmrszd 2024-05-31 16:06:16 +03:00
parent ee29846e7a
commit 9f4c4b396a
No known key found for this signature in database
GPG key ID: 9396B8BA6FBB14DE
3 changed files with 29 additions and 16 deletions

View file

@ -224,11 +224,11 @@
},
"nix-cfg-extra": {
"locked": {
"lastModified": 1716069899,
"narHash": "sha256-p4v5ngjHIJ6iyTN01iw3ubWDUVSYIAVA3NP95a58eYs=",
"lastModified": 1717158370,
"narHash": "sha256-bt6F3uxoBYblNtipr/xLV6os/elzXAymyHxNXdaXFQQ=",
"ref": "refs/heads/main",
"rev": "c4247e50ed0fb24f4f9676fc8d90064f103f5cb0",
"revCount": 2,
"rev": "c4c90137dc25f5d4f2b03322b472de8f919fc3d9",
"revCount": 4,
"type": "git",
"url": "file:///home/lgm/nix-cfg-extra"
},

View file

@ -62,10 +62,15 @@
overlay-vaapiIntel
];
inherit (inputs.nix-cfg-extra.lib) extra-data;
inherit (inputs.nix-cfg-extra.lib) extra-host-modules;
inherit (inputs.nix-cfg-extra.lib) extra-host-home-modules;
mkHostConfig = ({ host, extraModules ? [] }:
mkHostConfig = ({ host, extraModules ? [], useHome ? false }:
let
data = import ./hosts/${host}/data // (if extra-data ? host then extra-data.host else {});
# TODO: rename some of those
data = import ./hosts/${host}/data // (if extra-data ? ${host} then extra-data.${host} else {});
extra-modules = (if extra-host-modules ? ${host} then extra-host-modules.${host} else []);
extra-home-modules = (if extra-host-home-modules ? ${host} then extra-host-home-modules.${host} else []);
in
nixpkgs.lib.nixosSystem {
inherit system;
@ -75,21 +80,28 @@
./hosts/${host}/configuration.nix
./hosts/${host}/hardware-configuration.nix
sops-nix.nixosModules.sops
] ++ extraModules;
]
++ extra-modules
++ extraModules
++ (if !useHome then [] else [
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.lgm = {
imports = [
./hosts/${host}/home.nix
] ++ extra-home-modules;
};
}
])
;
});
in
{
nixosConfigurations.lgm-nixos = mkHostConfig {
host = "laptop";
extraModules = [
./hosts/laptop/mounts.nix
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.lgm = import ./hosts/laptop/home.nix;
}
];
useHome = true;
};
nixosConfigurations.lgm-vps1 = mkHostConfig {
host = "vps1";

View file

@ -10,6 +10,7 @@ in
{
imports = [
./mounts.nix
./akkotest.nix
];
# boot.kernelPackages = pkgs.linuxPackages_zen;