Compare commits

...

2 Commits

Author SHA1 Message Date
Jan Bulthuis bb7c74da4b Started splitting up user and home manager configuration 2024-07-17 19:20:32 +02:00
Jan Bulthuis b18f1fb4c9 Updated gitignore 2024-07-17 19:19:56 +02:00
10 changed files with 1264 additions and 1126 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
result

File diff suppressed because it is too large Load Diff

1124
merged.nix Normal file

File diff suppressed because it is too large Load Diff

12
system.nix Normal file
View File

@ -0,0 +1,12 @@
{ config, lib, pkgs, ... }:
{
options = {
custom.laptop = lib.mkOption {
type = lib.types.bool;
default = false;
example = true;
description = "Whether the current system is a laptop.";
};
};
}

11
test.nix Normal file
View File

@ -0,0 +1,11 @@
{ config, lib, pkgs, ... }:
{
config = {
custom.users.jan = {
enable = true;
sudo = true;
configuration = ./users/jan.nix;
};
};
}

46
users.nix Normal file
View File

@ -0,0 +1,46 @@
{ config, lib, pkgs, ... }:
let
userModule = lib.types.submodule {
options = {
enable = lib.mkOption {
type = lib.types.bool;
default = false;
example = true;
description = "Whether the user is enabled.";
};
sudo = lib.mkOption {
type = lib.types.bool;
default = false;
example = true;
description = "Whether the user is allowed sudo access.";
};
configuration = lib.mkOption {
type = lib.types.path;
default = ./users/base.nix;
description = "What home manager configuration to use for this user.";
};
};
};
in {
options = {
custom.users = lib.mkOption {
type = lib.types.attrsOf userModule;
default = {};
description = "Users configured on this system.";
};
};
config = {
users.users = lib.attrsets.concatMapAttrs (name: value: {
${name} = {
isNormalUser = true;
extraGroups = lib.mkIf value.sudo [ "wheel" ];
};
}) config.custom.users;
home-manager.users = lib.attrsets.concatMapAttrs (name: value: {
${name} = value.configuration;
}) config.custom.users;
};
}

8
users/base.nix Normal file
View File

@ -0,0 +1,8 @@
{ ... }:
{
imports = [
# Import all modules
./modules/default.nix
];
}

12
users/jan.nix Normal file
View File

@ -0,0 +1,12 @@
{ ... }:
{
imports = [
# Import base configuration
./base.nix
];
config = {
modules.zathura.enable = true;
};
}

10
users/modules/default.nix Normal file
View File

@ -0,0 +1,10 @@
{ input, pkgs, config, ... }:
{
# Set the state version
home.stateVersion = "24.05";
imports = [
./tools/zathura/default.nix
];
}

View File

@ -0,0 +1,17 @@
{config, lib, pkgs, ... }:
let
cfg = config.modules.zathura;
in {
options.modules.zathura.enable = lib.mkEnableOption "zathura";
config = lib.mkIf cfg.enable {
programs.zathura = {
enable = true;
options = {
guioptions = "none";
};
};
};
}