1
0
mirror of https://github.com/ellmau/nixos.git synced 2025-12-19 09:29:36 +01:00

Fix home-manager import issue

This commit is contained in:
Stefan Ellmauthaler 2022-05-24 18:02:56 +02:00
parent 8a6fb6c6cc
commit 0793eaa1c3
Failed to extract signature
2 changed files with 116 additions and 106 deletions

View File

@ -47,11 +47,11 @@
}; };
}; };
outputs = {self, nixpkgs, flake-utils-plus, ...}@inputs: outputs = { self, nixpkgs, flake-utils-plus, ... }@inputs:
let let
extended-lib = nixpkgs.lib.extend extended-lib = nixpkgs.lib.extend
(final: prev: { (final: prev: {
elss = (import ./lib {lib = final; }) prev; elss = (import ./lib { lib = final; }) prev;
}); });
inherit (extended-lib.elss) discoverModules moduleNames; inherit (extended-lib.elss) discoverModules moduleNames;
in in
@ -91,7 +91,12 @@
nixos-hardware = inputs.nixos-hardware.nixosModules; nixos-hardware = inputs.nixos-hardware.nixosModules;
inherit inputs; inherit inputs;
}; };
extraArgs = { inherit homeConfigurations; }; extraArgs = {
homeConfigurations = discoverModules ./users
(name:
import (./users + "/${name}")
);
};
}; };
hosts = discoverModules ./machines (name: { hosts = discoverModules ./machines (name: {

View File

@ -1,4 +1,4 @@
{ config, pkgs, lib, ... }: { config, pkgs, lib, homeConfigurations, ... }:
with lib; { with lib; {
options.elss.users = { options.elss.users = {
@ -97,7 +97,7 @@ with lib; {
programs.git = { programs.git = {
userEmail = meta.mailAddress; userEmail = meta.mailAddress;
userName = meta.description; userName = meta.description;
extraConfig ={ extraConfig = {
gpg = lib.mkIf meta.git.gpgsm { gpg = lib.mkIf meta.git.gpgsm {
format = "x509"; format = "x509";
program = "${pkgs.gnupg}/bin/gpgsm"; program = "${pkgs.gnupg}/bin/gpgsm";
@ -142,7 +142,7 @@ with lib; {
[ [
{ {
assertion = mutuallyExclusive cfg.users cfg.admins; assertion = mutuallyExclusive cfg.users cfg.admins;
message = "kbs.users.users and kbs.users.admins are mutually exclusive"; message = "elss.users.users and elss.users.admins are mutually exclusive";
} }
{ {
assertion = all (hash: hash != "") assertion = all (hash: hash != "")
@ -163,6 +163,11 @@ with lib; {
(mapUsers mkUser) (mapUsers mkUser)
]; ];
}; };
home-manager.users = (mapAllUsers mkGitUser) // (mapAllUsers mkX11User) // (mapAllUsersAndRoot (_: { config.home.stateVersion = mkDefault "21.05"; })); home-manager.users = mapAllUsersAndRoot (login:
mkMerge [
{ config.home.stateVersion = mkDefault "21.11"; }
(if homeConfigurations ? "${login}" then homeConfigurations."${login}" else { })
]
);
}; };
} }