export homeConfigurations for all user@host pairs and add better home-manager only defaults
This commit is contained in:
parent
cc52cd9fa2
commit
dc9d9877b8
|
@ -47,6 +47,8 @@
|
|||
});
|
||||
});
|
||||
|
||||
homeConfigurations = os.mkHomeConfigurations;
|
||||
|
||||
nixosModules =
|
||||
let moduleList = import ./modules/module-list.nix;
|
||||
in lib.pathsToImportedAttrs moduleList;
|
||||
|
@ -86,9 +88,6 @@
|
|||
devShell = import ./shell {
|
||||
inherit self system;
|
||||
};
|
||||
|
||||
legacyPackages.hmActivationPackages =
|
||||
os.mkHomeActivation;
|
||||
}
|
||||
);
|
||||
in
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
devosSystem = dev.callLibs ./devosSystem.nix;
|
||||
|
||||
mkHomeActivation = dev.callLibs ./mkHomeActivation.nix;
|
||||
mkHomeConfigurations = dev.callLibs ./mkHomeConfigurations.nix;
|
||||
|
||||
mkPackages = dev.callLibs ./mkPackages.nix;
|
||||
}
|
||||
|
|
|
@ -73,10 +73,29 @@ lib.nixosSystem (args // {
|
|||
})
|
||||
];
|
||||
})).config;
|
||||
hmConfig = (lib.nixosSystem
|
||||
(args // {
|
||||
modules = moduleList ++ [
|
||||
({ config, ... }: {
|
||||
home-manager.useUserPackages = lib.mkForce false;
|
||||
home-manager.sharedModules = [
|
||||
{
|
||||
home.packages = config.environment.systemPackages;
|
||||
home.sessionVariables = {
|
||||
inherit (config.environment.sessionVariables) NIX_PATH;
|
||||
};
|
||||
xdg.configFile."nix/registry.json".text =
|
||||
config.environment.etc."nix/registry.json".text;
|
||||
}
|
||||
];
|
||||
})
|
||||
];
|
||||
})).config;
|
||||
in
|
||||
moduleList ++ [{
|
||||
system.build = {
|
||||
iso = isoConfig.system.build.isoImage;
|
||||
homes = hmConfig.home-manager.users;
|
||||
};
|
||||
}];
|
||||
})
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
{ lib, self, ... }:
|
||||
|
||||
let hmConfigs =
|
||||
lib.mapAttrs
|
||||
(_: config: config.config.home-manager.users)
|
||||
self.nixosConfigurations;
|
||||
in
|
||||
lib.mapAttrs
|
||||
(_: x: lib.mapAttrs
|
||||
(_: cfg: cfg.home.activationPackage)
|
||||
x)
|
||||
hmConfigs
|
12
lib/devos/mkHomeConfigurations.nix
Normal file
12
lib/devos/mkHomeConfigurations.nix
Normal file
|
@ -0,0 +1,12 @@
|
|||
{ lib, self, ... }:
|
||||
|
||||
with lib;
|
||||
let
|
||||
mkHomes = host: config:
|
||||
mapAttrs' (user: v: nameValuePair "${user}@${host}" v)
|
||||
config.config.system.build.homes;
|
||||
|
||||
hmConfigs = mapAttrs mkHomes self.nixosConfigurations;
|
||||
|
||||
in
|
||||
foldl recursiveUpdate {} (attrValues hmConfigs)
|
|
@ -81,7 +81,7 @@ case "$1" in
|
|||
;;
|
||||
|
||||
"home")
|
||||
ref="$DEVSHELL_ROOT/#hmActivationPackages.$2.$3"
|
||||
ref="$DEVSHELL_ROOT/#homeConfigurations.$3@$2.home.activationPackage"
|
||||
|
||||
if [[ "$4" == "switch" ]]; then
|
||||
nix build "$ref" && result/activate &&
|
||||
|
|
|
@ -42,7 +42,7 @@ flk home NixOS nixos switch
|
|||
### Manually from outside the project:
|
||||
```sh
|
||||
# build
|
||||
nix build "github:divnix/devos#hmActivationPackages.NixOS.nixos"
|
||||
nix build "github:divnix/devos#homeConfigurations.nixos@NixOS.home.activationPackage"
|
||||
|
||||
# activate
|
||||
./result/activate && unlink result
|
||||
|
|
Loading…
Reference in a new issue