forked from KYS/maxfiles
73 lines
2.2 KiB
Nix
Executable File
73 lines
2.2 KiB
Nix
Executable File
{
|
|
config,
|
|
pkgs,
|
|
lib,
|
|
self,
|
|
...
|
|
}:
|
|
let
|
|
desktop = builtins.head (builtins.attrNames (self.nixosConfigurations or {}));
|
|
nixLoadwArgsElse = path: args: _else:
|
|
if builtins.pathExists path
|
|
then import path args
|
|
else _else;
|
|
nixLoadElse = path: _else:
|
|
if builtins.pathExists path
|
|
then import path
|
|
else _else;
|
|
nixLoadwArgs = path: args: nixLoadwArgsElse path args {};
|
|
nixLoadDefArgs = path: nixLoadwArgs path {inherit config pkgs lib;};
|
|
nixLoad = path: nixLoadElse path {};
|
|
|
|
confDesksDir = ./conf/desks;
|
|
confUsersDir = ./conf/users;
|
|
confUserNames = import "${confDesksDir}/${desktop}/users.nix"
|
|
++ nixLoadElse "${confDesksDir}/.default/users.nix" [];
|
|
confUserDefDir = "${confUsersDir}/.default/";
|
|
defUserConfig = nixLoadDefArgs "${confUserDefDir}user.nix";
|
|
defHomeConfig = nixLoadDefArgs "${confUserDefDir}home.nix";
|
|
defHyprSettings = nixLoadDefArgs "${confUserDefDir}hypr/settings.nix";
|
|
|
|
sysUser = name: {
|
|
inherit name;
|
|
value = let
|
|
userConfig = nixLoadDefArgs "${confUsersDir}/${name}/user.nix";
|
|
in
|
|
lib.mkMerge [
|
|
{
|
|
home = "/home/${name}";
|
|
}
|
|
defUserConfig
|
|
userConfig
|
|
];
|
|
};
|
|
|
|
homeUser = name: {
|
|
inherit name;
|
|
value = let
|
|
homeConfig = nixLoadDefArgs ("${confUsersDir}/${name}/home.nix");
|
|
hyprSettings = nixLoadDefArgs ("${confUsersDir}/${name}/hypr/settings.nix");
|
|
in
|
|
lib.mkMerge [
|
|
{
|
|
home.username = name;
|
|
home.homeDirectory = "/home/${name}";
|
|
home.stateVersion = "25.05";
|
|
programs.home-manager.enable = true;
|
|
wayland.windowManager.hyprland.settings = lib.mkMerge [ defHyprSettings hyprSettings ];
|
|
}
|
|
defHomeConfig
|
|
homeConfig
|
|
];
|
|
};
|
|
in
|
|
{
|
|
nix.settings.experimental-features = ["nix-command" "flakes"];
|
|
users.users = builtins.listToAttrs (map sysUser confUserNames);
|
|
home-manager.users = builtins.listToAttrs (map homeUser confUserNames);
|
|
boot.loader.systemd-boot.enable = true;
|
|
boot.loader.efi.canTouchEfiVariables = true;
|
|
networking.hostName = desktop;
|
|
system.stateVersion = "25.05";
|
|
}
|