provide per-user args (ie username)

This commit is contained in:
do butterflies cry? 2026-03-07 19:29:26 +10:00
parent 169bf2bf48
commit 34a8c23537
Signed by: cry
GPG key ID: F68745A836CA0412

View file

@ -12,18 +12,22 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
{ {
root,
config,
lib,
_cerulean, _cerulean,
config,
root,
lib,
... ...
} @ args: let } @ args: let
inherit inherit
(builtins) (builtins)
attrNames
filter
pathExists pathExists
; ;
inherit
(lib)
filterAttrs
mapAttrs
;
in { in {
imports = [ imports = [
_cerulean.homeManager.nixosModules.default _cerulean.homeManager.nixosModules.default
@ -49,13 +53,21 @@ in {
config = { config = {
home-manager = { home-manager = {
useUserPackages = lib.mkDefault false;
useGlobalPkgs = lib.mkDefault true;
overwriteBackup = lib.mkDefault false;
backupFileExtension = lib.mkDefault "bak";
users = users =
config.users.users config.users.users
|> attrNames |> filterAttrs (name: value: value.manageHome && pathExists /${root}/homes/${name})
|> filter (x: x.manageHome && pathExists /${root}/homes/${x}) |> mapAttrs (name: _: {
|> (x: imports = [import /${root}/homes/${name}];
lib.genAttrs x (y:
import /${root}/homes/${y})); # per-user arguments
_module.args.username = name;
});
extraSpecialArgs = _cerulean.specialArgs; extraSpecialArgs = _cerulean.specialArgs;
sharedModules = [ sharedModules = [