Home Manager: Rewrite to NixOS-like config.

This commit is contained in:
Dmitry Voronin 2024-10-24 09:50:55 +03:00
parent db9d6d82dc
commit 8e1ccc4772
Signed by: voronind
SSH key fingerprint: SHA256:3kBb4iV2ahufEBNq+vFbUe4QYfHt98DHQjN7QaptY9k
7 changed files with 33 additions and 20 deletions

View file

@ -268,7 +268,7 @@
util = import ./lib/Util.nix { inherit lib; }; util = import ./lib/Util.nix { inherit lib; };
mkCommonHome = mkCommonHome =
username: homeDirectory: system: modules: username: system:
let let
pkgs = nixpkgs.legacyPackages.${system}; pkgs = nixpkgs.legacyPackages.${system};
pkgsStable = nixpkgsStable.legacyPackages.${system}; pkgsStable = nixpkgsStable.legacyPackages.${system};
@ -295,11 +295,8 @@
./home/HomeManager.nix ./home/HomeManager.nix
{ {
home.hm = { home.hm = {
inherit username homeDirectory; inherit username;
enable = true; enable = true;
package = {
core.enable = true;
};
}; };
} }
@ -314,23 +311,20 @@
} }
inputs.stylix.homeManagerModules.stylix 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 in
nixpkgs.lib.foldl' (acc: h: acc // h) { } [ nixpkgs.lib.foldl' (acc: h: acc // h) { } (
x86LinuxRoot map (
(x86LinuxHome "voronind" [ system:
{ nixpkgs.lib.foldl' (acc: h: acc // h) { } (
home.hm.package = { map (username: mkCommonHome username system) (
common.enable = true; builtins.attrNames (builtins.readDir ./home/user/${system})
}; )
} )
]) ) (builtins.attrNames (builtins.readDir ./home/user))
]; );
# Android. # Android.
nixOnDroidConfigurations.default = nixOnDroidConfigurations.default =

View file

@ -5,6 +5,7 @@
util, util,
lib, lib,
pkgs, pkgs,
__findFile,
... ...
}@args: }@args:
with lib; with lib;
@ -13,7 +14,7 @@ let
programs = import ./program args; programs = import ./program args;
in in
{ {
imports = (util.ls ./user); imports = (util.ls <user>);
options = { options = {
home.nixos = { home.nixos = {

View file

@ -0,0 +1,9 @@
{ ... }:
{
home.hm = {
homeDirectory = "/root";
package = {
core.enable = true;
};
};
}

View file

@ -0,0 +1,9 @@
{ ... }:
{
home.hm = {
homeDirectory = "/home/voronind";
package = {
core.enable = true;
};
};
}