From 531445e1f0c6eddeac8541f76eed2de8ce3834c0 Mon Sep 17 00:00:00 2001
From: NullBite <me@nullbite.com>
Date: Fri, 12 Jan 2024 11:30:59 +0100
Subject: [PATCH] re-add init function for home manager

my stupid ass in b979657 thought that
home-manager.nixosModules.home-manager was a function that returned a
module instead of just a module (which is also a function but that's
besides the point). i forgot to consider that the home-manager module
adds a custom home-manager option set, nor did i realize that a flake
module could be a plain attribute set.
---
 flake.nix | 23 +++++++++++------------
 1 file changed, 11 insertions(+), 12 deletions(-)

diff --git a/flake.nix b/flake.nix
index 9e04c8d..793ab1b 100644
--- a/flake.nix
+++ b/flake.nix
@@ -16,10 +16,13 @@
   let
     lib = nixpkgs.lib;
     username = "nullbite";
-    hmModule = inputs.home-manager.nixosModules.home-manager;
-    hmModuleDefaults = {
-      home-manager.useGlobalPkgs = true;
-      home-manager.useUserPackages = true;
+    homeManagerModule = inputs.home-manager.nixosModules.home-manager;
+    homeManagerInit = user: module: {
+      home-manager = {
+        useGlobalPkgs = true;
+        useUserPackages = true;
+        users.${user} = module;
+      };
     };
   in {
     # for repl debugging via :lf .
@@ -39,9 +42,8 @@
           ./system/fragments/opengl.nix
           ./system/gaming.nix
           # ./system/hyprland.nix
-          hmModule (hmModuleDefaults // {
-            home-manager.users."${username}" = import ./hosts/slab/home.nix;
-          })
+          homeManagerModule
+          (homeManagerInit username (import ./hosts/slab/home.nix))
         ];
       };
       nullbox = lib.nixosSystem {
@@ -52,11 +54,8 @@
           ./system/plasma.nix
           ./system/fragments/hardware/nvidia-modeset.nix
           ./system/gaming.nix
-
-          hmModule (hmModuleDefaults // {
-            home-manager.users."${username}" = import ./hosts/nullbox/home.nix;
-          })
-
+          homeManagerModule
+          (homeManagerInit username (import ./hosts/nullbox/home.nix))
         ];
       };
     };