feat(flake): add home-manager nixos module support to host.admin

This commit is contained in:
ooks-io 2024-04-29 22:50:45 +12:00
parent 25e02c034c
commit ba2cbc18de
2 changed files with 22 additions and 3 deletions

View file

@ -96,6 +96,8 @@
systems = [ "x86_64-linux" "aarch64-linux" ];
forEachSystem = f: lib.genAttrs systems (sys: f pkgsFor.${sys});
pkgsFor = nixpkgs.legacyPackages;
hm = inputs.home-manager.nixosModules.home-manager;
in
{
inherit lib;
@ -140,7 +142,10 @@
};
# Main Desktop
"ooks@ooksdesk" = lib.homeManagerConfiguration {
modules = [ ./home/user/ooks/ooksdesk ];
modules = [
./home/user/ooks/ooksdesk
hm
];
pkgs = pkgsFor.x86_64-linux;
extraSpecialArgs = { inherit inputs outputs; };
};

View file

@ -1,9 +1,10 @@
{ lib, config, pkgs, ... }:
{ lib, config, pkgs, inputs, outputs, self, ... }:
let
cfg = config.systemModules.host.admin;
host = config.systemModules.host;
ifTheyExist = groups: builtins.filter (group: builtins.hasAttr group config.users.groups) groups;
inherit (lib) types mkOption;
inherit (lib) mkIf types mkOption;
in
{
@ -23,6 +24,11 @@ in
default = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBn3ff3HaZHIyH4K13k8Mwqu/o7jIABJ8rANK+r2PfJk";
description = "The ssh key for the admin user";
};
homeManager = mkOption {
type = types.bool;
default = false;
description = "Enables home manager module for the admin user";
};
};
config = {
@ -45,5 +51,13 @@ in
"torrenter"
];
};
home-manager = mkIf cfg.homeManager {
useGlobalPkgs = true;
useUserPackages = true;
backupFileExtension = "hm.old";
verbose = true;
extraSpecialArgs = { inherit inputs outputs self; };
users.${cfg.name} = import "${self}/home/user/${cfg.name}/${host.name}";
};
};
}