diff --git a/flake.nix b/flake.nix index 82cbc3cc..23390d66 100644 --- a/flake.nix +++ b/flake.nix @@ -268,7 +268,7 @@ util = import ./lib/Util.nix { inherit lib; }; mkCommonHome = - username: homeDirectory: system: modules: + username: system: let pkgs = nixpkgs.legacyPackages.${system}; pkgsStable = nixpkgsStable.legacyPackages.${system}; @@ -295,11 +295,8 @@ ./home/HomeManager.nix { home.hm = { - inherit username homeDirectory; + inherit username; enable = true; - package = { - core.enable = true; - }; }; } @@ -314,23 +311,20 @@ } inputs.stylix.homeManagerModules.stylix - ] ++ modules ++ (self.findFiles ./config); + ] ++ (self.findFiles ./home/user/${system}/${username}) ++ (self.findFiles ./config); }; }; - - x86LinuxHome = username: modules: mkCommonHome username "/home/${username}" "x86_64-linux" modules; - x86LinuxRoot = mkCommonHome "root" "/root" "x86_64-linux" [ ]; in - nixpkgs.lib.foldl' (acc: h: acc // h) { } [ - x86LinuxRoot - (x86LinuxHome "voronind" [ - { - home.hm.package = { - common.enable = true; - }; - } - ]) - ]; + nixpkgs.lib.foldl' (acc: h: acc // h) { } ( + map ( + system: + nixpkgs.lib.foldl' (acc: h: acc // h) { } ( + map (username: mkCommonHome username system) ( + builtins.attrNames (builtins.readDir ./home/user/${system}) + ) + ) + ) (builtins.attrNames (builtins.readDir ./home/user)) + ); # Android. nixOnDroidConfigurations.default = diff --git a/home/NixOs.nix b/home/NixOs.nix index 01aef6b1..733e5b60 100644 --- a/home/NixOs.nix +++ b/home/NixOs.nix @@ -5,6 +5,7 @@ util, lib, pkgs, + __findFile, ... }@args: with lib; @@ -13,7 +14,7 @@ let programs = import ./program args; in { - imports = (util.ls ./user); + imports = (util.ls ); options = { home.nixos = { diff --git a/home/user/x86_64-linux/root/default.nix b/home/user/x86_64-linux/root/default.nix new file mode 100644 index 00000000..780c1a21 --- /dev/null +++ b/home/user/x86_64-linux/root/default.nix @@ -0,0 +1,9 @@ +{ ... }: +{ + home.hm = { + homeDirectory = "/root"; + package = { + core.enable = true; + }; + }; +} diff --git a/home/user/x86_64-linux/voronind/default.nix b/home/user/x86_64-linux/voronind/default.nix new file mode 100644 index 00000000..fdaa16d2 --- /dev/null +++ b/home/user/x86_64-linux/voronind/default.nix @@ -0,0 +1,9 @@ +{ ... }: +{ + home.hm = { + homeDirectory = "/home/voronind"; + package = { + core.enable = true; + }; + }; +} diff --git a/home/user/Dasha.nix b/user/Dasha.nix similarity index 100% rename from home/user/Dasha.nix rename to user/Dasha.nix diff --git a/home/user/Root.nix b/user/Root.nix similarity index 100% rename from home/user/Root.nix rename to user/Root.nix diff --git a/home/user/Voronind.nix b/user/Voronind.nix similarity index 100% rename from home/user/Voronind.nix rename to user/Voronind.nix