home-manager kat user refactor

This commit is contained in:
kat witch 2021-08-05 21:47:54 +01:00
parent b1f27aa74d
commit 1230ff387b
No known key found for this signature in database
GPG key ID: 1B477797DCA5EC72
13 changed files with 34 additions and 82 deletions

View file

@ -19,12 +19,6 @@ with lib;
../../services/zfs.nix ../../services/zfs.nix
]; ];
home-manager.users.kat = {
imports = [
./home.nix
];
};
# File Systems and Swap # File Systems and Swap
boot.supportedFilesystems = singleton "zfs"; boot.supportedFilesystems = singleton "zfs";

View file

@ -23,12 +23,6 @@ in {
./nixos/virtualhosts.nix ./nixos/virtualhosts.nix
]; ];
home-manager.users.kat = {
imports = [
./home.nix
];
};
# File Systems and Swap # File Systems and Swap
boot.supportedFilesystems = [ "zfs" "xfs" ]; boot.supportedFilesystems = [ "zfs" "xfs" ];

View file

@ -18,12 +18,6 @@ with lib;
../../services/nginx.nix ../../services/nginx.nix
]; ];
home-manager.users.kat = {
imports = [
./home.nix
];
};
# File Systems and Swap # File Systems and Swap
boot.supportedFilesystems = singleton "zfs"; boot.supportedFilesystems = singleton "zfs";

View file

@ -1,24 +0,0 @@
{ config, pkgs, lib, ... }:
{
home-manager.users.kat = {
imports = [ ./base ] ++ lib.optional (builtins.pathExists ../../trusted/users/kat) (import ../../trusted/users/kat);
home.stateVersion = "20.09";
};
users.users.kat = {
uid = 1000;
isNormalUser = true;
openssh.authorizedKeys.keys = [
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCocjQqiDIvzq+Qu3jkf7FXw5piwtvZ1Mihw9cVjdVcsra3U2c9WYtYrA3rS50N3p00oUqQm9z1KUrvHzdE+03ZCrvaGdrtYVsaeoCuuvw7qxTQRbItTAEsfRcZLQ5c1v/57HNYNEsjVrt8VukMPRXWgl+lmzh37dd9w45cCY1QPi+JXQQ/4i9Vc3aWSe4X6PHOEMSBHxepnxm5VNHm4PObGcVbjBf0OkunMeztd1YYA9sEPyEK3b8IHxDl34e5t6NDLCIDz0N/UgzCxSxoz+YJ0feQuZtud/YLkuQcMxW2dSGvnJ0nYy7SA5DkW1oqcy6CGDndHl5StOlJ1IF9aGh0gGkx5SRrV7HOGvapR60RphKrR5zQbFFka99kvSQgOZqSB3CGDEQGHv8dXKXIFlzX78jjWDOBT67vA/M9BK9FS2iNnBF5x6shJ9SU5IK4ySxq8qvN7Us8emkN3pyO8yqgsSOzzJT1JmWUAx0tZWG/BwKcFBHfceAPQl6pwxx28TM3BTBRYdzPJLTkAy48y6iXW6UYdfAPlShy79IYjQtEThTuIiEzdzgYdros0x3PDniuAP0KOKMgbikr0gRa6zahPjf0qqBnHeLB6nHAfaVzI0aNbhOg2bdOueE1FX0x48sjKqjOpjlIfq4WeZp9REr2YHEsoLFOBfgId5P3BPtpBQ== cardno:000612078454"
];
shell = pkgs.zsh;
extraGroups = [ "wheel" "video" "systemd-journal" "plugdev" ];
hashedPassword =
"$6$i28yOXoo$/WokLdKds5ZHtJHcuyGrH2WaDQQk/2Pj0xRGLgS8UcmY2oMv3fw2j/85PRpsJJwCB2GBRYRK5LlvdTleHd3mB.";
};
systemd.tmpfiles.rules = [
"f /var/lib/systemd/linger/kat"
];
}

View file

@ -1,11 +1,20 @@
rec { let katUser = { lib }: let
base = ./base.nix; userImport = profile: { config, ... }: {
gui = ./gui.nix; config.home-manager.users.kat = {
sway = ./sway.nix; imports = [
dev = ./dev.nix; (./. + "/${profile}")
media = ./media.nix; ];
personal = ./personal.nix; };
}; profileNames = [
"gui"
"sway"
"dev"
"media"
"personal"
]; userProfiles = with userProfiles;
lib.genAttrs profileNames userImport // {
base = { imports = [ ./nixos.nix (userImport "base") ]; };
server = { imports = [ personal ]; }; server = { imports = [ personal ]; };
guiFull = { imports = [ gui sway dev media personal ]; }; guiFull = { imports = [ gui sway dev media personal ]; };
} }; in userProfiles;
in { __functor = self: katUser; isModule = false; }

View file

@ -1,5 +0,0 @@
{ ... }:
{
home-manager.users.kat = { imports = [ ./dev ]; };
}

View file

@ -1,5 +0,0 @@
{ ... }:
{
home-manager.users.kat = { imports = [ ./gui ]; };
}

View file

@ -1,5 +0,0 @@
{ ... }:
{
home-manager.users.kat = { imports = [ ./media ]; };
}

View file

@ -1,5 +0,0 @@
{ ... }:
{
home-manager.users.kat = { imports = [ ./personal ]; };
}

View file

@ -1,5 +0,0 @@
{ ... }:
{
home-manager.users.kat = { imports = [ ./sway ]; };
}

View file

@ -8,9 +8,9 @@
}@args: let }@args: let
colorHelpers = import ./color-helpers.nix { inherit lib; }; colorHelpers = import ./color-helpers.nix { inherit lib; };
lib = before // katlib // self; lib = before // katlib // self;
katlib = with before; with katlib; with self; katlib = with before; with katlib; with self;
{ {
inherit (colorHelpers) hextorgba; inherit (colorHelpers) hextorgba;
hostImport = import ./host-import.nix { inherit lib; }; hostImport = import ./host-import.nix { inherit lib; };
modList = import ./module-list.nix; modList = import ./module-list.nix { inherit lib; };
}; in katlib }; in katlib

View file

@ -1,6 +1,15 @@
{ lib }: hostName: lib.filter builtins.pathExists [ { lib }: hostName: with lib; filter builtins.pathExists [
(../../config/hosts + "/${hostName}/nixos.nix") (../../config/hosts + "/${hostName}/nixos.nix")
(../../config/trusted/hosts + "/${hostName}/nixos.nix") (../../config/trusted/hosts + "/${hostName}/nixos.nix")
../../config/trusted/profile ../../config/trusted/profile
../../config/profiles/base ../../config/profiles/base
] ] ++ singleton {
options.home-manager.users = mkOption {
type = types.attrsOf (types.submoduleWith {
modules = filter builtins.pathExists [
(../../config/hosts + "/${hostName}/home.nix")
(../../config/trusted/hosts + "/${hostName}/home.nix")
];
});
};
}

View file

@ -1,8 +1,9 @@
{ modulesDir, defaultFile ? "default.nix", importAll ? false }: { lib }: { modulesDir, defaultFile ? "default.nix", importAll ? false }:
with builtins; with builtins;
let let
isModule = m: lib.isFunction m && (m.isModule or true);
filterAttrNamesToList = filter: set: filterAttrNamesToList = filter: set:
foldl' (a: b: a ++ b) [ ] foldl' (a: b: a ++ b) [ ]
(map (e: if (filter e set.${e}) then [ e ] else [ ]) (attrNames set)); (map (e: if (filter e set.${e}) then [ e ] else [ ]) (attrNames set));
@ -20,7 +21,7 @@ let
in in
{ {
inherit name; inherit name;
value = if (isFunction m) && !importAll then value else m; value = if lib.isFunction m && ! isModule m then m { inherit lib; } else if isModule m && !importAll then value else m;
}) })
files; files;
in in