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; };
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 =

View file

@ -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 <user>);
options = {
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;
};
};
}