From 9f4c4b396aabba31229bd55c01009e0dc259951a Mon Sep 17 00:00:00 2001 From: Lgmrszd Date: Fri, 31 May 2024 16:06:16 +0300 Subject: [PATCH] rearrange things and move home-manager to mkHostConfig function --- flake.lock | 8 ++++---- flake.nix | 36 ++++++++++++++++++++++------------ hosts/laptop/configuration.nix | 1 + 3 files changed, 29 insertions(+), 16 deletions(-) diff --git a/flake.lock b/flake.lock index a24305c..8903d4d 100644 --- a/flake.lock +++ b/flake.lock @@ -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" }, diff --git a/flake.nix b/flake.nix index 112245f..cf97555 100644 --- a/flake.nix +++ b/flake.nix @@ -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"; diff --git a/hosts/laptop/configuration.nix b/hosts/laptop/configuration.nix index bbc3e4c..d39af8c 100644 --- a/hosts/laptop/configuration.nix +++ b/hosts/laptop/configuration.nix @@ -10,6 +10,7 @@ in { imports = [ + ./mounts.nix ./akkotest.nix ]; # boot.kernelPackages = pkgs.linuxPackages_zen;