From ba2cbc18de204076e3dc0cffdb0d782a23aab7ab Mon Sep 17 00:00:00 2001 From: ooks-io Date: Mon, 29 Apr 2024 22:50:45 +1200 Subject: [PATCH] feat(flake): add home-manager nixos module support to host.admin --- flake.nix | 7 ++++++- system/modules/host/admin/default.nix | 18 ++++++++++++++++-- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/flake.nix b/flake.nix index 9493bae..da45d68 100644 --- a/flake.nix +++ b/flake.nix @@ -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; }; }; diff --git a/system/modules/host/admin/default.nix b/system/modules/host/admin/default.nix index 1d3a8a7..61a6639 100644 --- a/system/modules/host/admin/default.nix +++ b/system/modules/host/admin/default.nix @@ -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}"; + }; }; }