Rename the namespace of the system-modules

This commit is contained in:
SebastianStork 2025-05-27 22:19:35 +02:00
parent 61f32cb7ea
commit 06623cd93a
34 changed files with 162 additions and 153 deletions

View file

@ -1,15 +1,16 @@
{ config, ... }:
let
inherit (config) myConfig;
inherit (config.myConfig.tailscale) caddyServe;
inherit (config.custom) services;
inherit (config.custom.services.tailscale) caddyServe;
in
{
system.stateVersion = "24.11";
myConfig = {
custom = {
boot.loader.systemdBoot.enable = true;
sops.enable = true;
services = {
tailscale = {
enable = true;
ssh.enable = true;
@ -23,15 +24,15 @@ in
caddyServe = {
nextcloud = {
subdomain = "cloud";
inherit (myConfig.nextcloud) port;
inherit (services.nextcloud) port;
};
actualbudget = {
subdomain = "budget";
inherit (myConfig.actualbudget) port;
inherit (services.actualbudget) port;
};
forgejo = {
subdomain = "git";
inherit (myConfig.forgejo) port;
inherit (services.forgejo) port;
};
};
};
@ -58,4 +59,5 @@ in
backups.enable = true;
};
};
};
}

View file

@ -3,10 +3,11 @@
system.stateVersion = "24.11";
networking.domain = "sprouted.cloud";
myConfig = {
custom = {
boot.loader.grub.enable = true;
sops.enable = true;
services = {
tailscale = {
enable = true;
ssh.enable = true;
@ -27,11 +28,12 @@
];
};
};
};
services.caddy = {
enable = true;
virtualHosts."docs.${config.networking.domain}".extraConfig = ''
reverse_proxy localhost:${toString config.myConfig.hedgedoc.port}
reverse_proxy localhost:${toString config.custom.services.hedgedoc.port}
'';
};

View file

@ -14,7 +14,8 @@
}
);
myConfig = {
custom = {
sops.enable = true;
boot = {
loader.systemdBoot.enable = true;
silent = true;
@ -23,12 +24,12 @@
dm.tuigreet.enable = true;
de.hyprland.enable = true;
virtualisation.enable = true;
services = {
wlan.enable = true;
bluetooth.enable = true;
sound.enable = true;
virtualisation.enable = true;
sops.enable = true;
gc.enable = true;
geoclue.enable = true;
tailscale = {
@ -40,4 +41,5 @@
deviceId = "Q4YPD3V-GXZPHSN-PT5X4PU-FBG4GX2-IASBX75-7NYMG75-4EJHBMZ-4WGDDAP";
};
};
};
}

View file

@ -14,7 +14,8 @@
}
);
myConfig = {
custom = {
sops.enable = true;
boot = {
loader.systemdBoot.enable = true;
silent = true;
@ -23,9 +24,10 @@
dm.tuigreet.enable = true;
de.hyprland.enable = true;
sound.enable = true;
virtualisation.enable = true;
sops.enable = true;
services = {
sound.enable = true;
gc.enable = true;
geoclue.enable = true;
tailscale = {
@ -36,7 +38,8 @@
enable = true;
deviceId = "FAJS5WM-UAWGW2U-FXCGPSP-VAUOTGM-XUKSEES-D66PMCJ-WBODJLV-XTNCRA7";
};
};
steam.enable = true;
programs.steam.enable = true;
};
}

View file

@ -6,7 +6,7 @@
}@moduleArgs:
{
options.myConfig.de.hyprland.enable = lib.mkEnableOption "" // {
default = moduleArgs.osConfig.myConfig.de.hyprland.enable or false;
default = moduleArgs.osConfig.custom.de.hyprland.enable or false;
};
config = lib.mkIf config.myConfig.de.hyprland.enable {

View file

@ -1,7 +1,7 @@
{ config, lib, ... }@moduleArgs:
{
options.myConfig.tailscale.enable = lib.mkEnableOption "" // {
default = moduleArgs.osConfig.myConfig.tailscale.enable or false;
default = moduleArgs.osConfig.custom.services.tailscale.enable or false;
};
config = lib.mkIf config.myConfig.tailscale.enable {

View file

@ -8,9 +8,9 @@ let
user = config.users.users.actual.name;
in
{
options.myConfig.actualbudget.backups.enable = lib.mkEnableOption "";
options.custom.services.actualbudget.backups.enable = lib.mkEnableOption "";
config = lib.mkIf config.myConfig.actualbudget.backups.enable {
config = lib.mkIf config.custom.services.actualbudget.backups.enable {
security.polkit = {
enable = true;
extraConfig =
@ -28,7 +28,7 @@ in
'';
};
myConfig.resticBackup.actual = {
custom.services.resticBackup.actual = {
inherit user;
healthchecks.enable = true;

View file

@ -4,10 +4,10 @@
...
}:
let
cfg = config.myConfig.actualbudget;
cfg = config.custom.services.actualbudget;
in
{
options.myConfig.actualbudget = {
options.custom.services.actualbudget = {
enable = lib.mkEnableOption "";
subdomain = lib.mkOption {
type = lib.types.nonEmptyStr;

View file

@ -1,8 +1,8 @@
{ config, lib, ... }:
{
options.myConfig.bluetooth.enable = lib.mkEnableOption "";
options.custom.services.bluetooth.enable = lib.mkEnableOption "";
config = lib.mkIf config.myConfig.bluetooth.enable {
config = lib.mkIf config.custom.services.bluetooth.enable {
hardware = {
bluetooth = {
enable = true;

View file

@ -1,8 +1,8 @@
{ config, lib, ... }:
{
options.myConfig.boot.loader.grub.enable = lib.mkEnableOption "";
options.custom.boot.loader.grub.enable = lib.mkEnableOption "";
config = lib.mkIf config.myConfig.boot.loader.grub.enable {
config = lib.mkIf config.custom.boot.loader.grub.enable {
boot = {
tmp.cleanOnBoot = true;
loader.grub.enable = true;

View file

@ -1,8 +1,8 @@
{ config, lib, ... }:
{
options.myConfig.boot.loader.systemdBoot.enable = lib.mkEnableOption "";
options.custom.boot.loader.systemdBoot.enable = lib.mkEnableOption "";
config = lib.mkIf config.myConfig.boot.loader.systemdBoot.enable {
config = lib.mkIf config.custom.boot.loader.systemdBoot.enable {
boot = {
tmp.cleanOnBoot = true;
loader = {

View file

@ -1,8 +1,8 @@
{ config, lib, ... }:
{
options.myConfig.boot.silent = lib.mkEnableOption "";
options.custom.boot.silent = lib.mkEnableOption "";
config = lib.mkIf config.myConfig.boot.silent {
config = lib.mkIf config.custom.boot.silent {
boot = {
loader.timeout = 0;
kernelParams = [

View file

@ -6,12 +6,12 @@
...
}:
let
cfg = config.myConfig.crowdsec;
cfg = config.custom.services.crowdsec;
in
{
imports = [ inputs.crowdsec.nixosModules.crowdsec ];
options.myConfig.crowdsec = {
options.custom.services.crowdsec = {
enable = lib.mkEnableOption "";
apiPort = lib.mkOption {
type = lib.types.port;

View file

@ -6,12 +6,12 @@
...
}:
let
cfg = config.myConfig.crowdsec;
cfg = config.custom.services.crowdsec;
in
{
imports = [ inputs.crowdsec.nixosModules.crowdsec-firewall-bouncer ];
options.myConfig.crowdsec.firewallBouncer.enable = lib.mkEnableOption "";
options.custom.services.crowdsec.firewallBouncer.enable = lib.mkEnableOption "";
config = lib.mkIf cfg.firewallBouncer.enable {
services.crowdsec-firewall-bouncer = {

View file

@ -4,9 +4,9 @@
...
}:
{
options.myConfig.de.hyprland.enable = lib.mkEnableOption "";
options.custom.de.hyprland.enable = lib.mkEnableOption "";
config = lib.mkIf config.myConfig.de.hyprland.enable {
config = lib.mkIf config.custom.de.hyprland.enable {
programs.hyprland.enable = true;
environment.sessionVariables.NIXOS_OZONE_WL = "1";

View file

@ -5,9 +5,9 @@
...
}:
{
options.myConfig.dm.tuigreet.enable = lib.mkEnableOption "";
options.custom.dm.tuigreet.enable = lib.mkEnableOption "";
config = lib.mkIf config.myConfig.dm.tuigreet.enable {
config = lib.mkIf config.custom.dm.tuigreet.enable {
services.greetd = {
enable = true;
settings = {

View file

@ -4,12 +4,12 @@
...
}:
let
cfg = config.myConfig.forgejo;
cfg = config.custom.services.forgejo;
user = config.users.users.forgejo.name;
in
{
options.myConfig.forgejo = {
options.custom.services.forgejo = {
enable = lib.mkEnableOption "";
subdomain = lib.mkOption {
type = lib.types.nonEmptyStr;

View file

@ -1,8 +1,8 @@
{ config, lib, ... }:
{
options.myConfig.gc.enable = lib.mkEnableOption "";
options.custom.services.gc.enable = lib.mkEnableOption "";
config = lib.mkIf config.myConfig.gc.enable {
config = lib.mkIf config.custom.services.gc.enable {
programs.nh = {
enable = true;
clean = {

View file

@ -1,8 +1,8 @@
{ config, lib, ... }:
{
options.myConfig.geoclue.enable = lib.mkEnableOption "";
options.custom.services.geoclue.enable = lib.mkEnableOption "";
config = lib.mkIf config.myConfig.geoclue.enable {
config = lib.mkIf config.custom.services.geoclue.enable {
services.geoclue2 = {
enable = true;

View file

@ -8,9 +8,9 @@ let
user = config.users.users.hedgedoc.name;
in
{
options.myConfig.hedgedoc.backups.enable = lib.mkEnableOption "";
options.custom.services.hedgedoc.backups.enable = lib.mkEnableOption "";
config = lib.mkIf config.myConfig.hedgedoc.backups.enable {
config = lib.mkIf config.custom.services.hedgedoc.backups.enable {
security.polkit = {
enable = true;
extraConfig =
@ -28,7 +28,7 @@ in
'';
};
myConfig.resticBackup.hedgedoc = {
custom.services.resticBackup.hedgedoc = {
inherit user;
healthchecks.enable = true;

View file

@ -5,14 +5,14 @@
...
}:
let
cfg = config.myConfig.hedgedoc;
cfg = config.custom.services.hedgedoc;
user = config.users.users.hedgedoc.name;
manage_users = "CMD_CONFIG_FILE=/run/hedgedoc/config.json NODE_ENV=production ${lib.getExe' pkgs.hedgedoc "manage_users"}";
in
{
options.myConfig.hedgedoc = {
options.custom.services.hedgedoc = {
enable = lib.mkEnableOption "";
subdomain = lib.mkOption {
type = lib.types.nonEmptyStr;

View file

@ -5,16 +5,16 @@
...
}:
let
cfg = config.myConfig.nextcloud;
cfg = config.custom.services.nextcloud;
dataDir = config.services.nextcloud.home;
user = config.users.users.nextcloud.name;
in
{
options.myConfig.nextcloud.backups.enable = lib.mkEnableOption "";
options.custom.services.nextcloud.backups.enable = lib.mkEnableOption "";
config = lib.mkIf cfg.backups.enable {
myConfig.resticBackup.nextcloud = {
custom.services.resticBackup.nextcloud = {
inherit user;
healthchecks.enable = true;

View file

@ -6,12 +6,12 @@
...
}:
let
cfg = config.myConfig.nextcloud;
cfg = config.custom.services.nextcloud;
user = config.users.users.nextcloud.name;
in
{
options.myConfig.nextcloud = {
options.custom.services.nextcloud = {
enable = lib.mkEnableOption "";
subdomain = lib.mkOption {
type = lib.types.nonEmptyStr;

View file

@ -1,8 +1,8 @@
{ config, lib, ... }:
{
options.myConfig.printing.enable = lib.mkEnableOption "";
options.custom.services.printing.enable = lib.mkEnableOption "";
config = lib.mkIf config.myConfig.printing.enable {
config = lib.mkIf config.custom.services.printing.enable {
services = {
printing.enable = true;
avahi = {

View file

@ -5,12 +5,12 @@
...
}:
let
backupServices = lib.filterAttrs (_: value: value.enable) config.myConfig.resticBackup;
backupServices = lib.filterAttrs (_: value: value.enable) config.custom.services.resticBackup;
healthchecksEnable = (lib.filterAttrs (_: value: value.healthchecks.enable) backupServices) != { };
in
{
options.myConfig.resticBackup = lib.mkOption {
options.custom.services.resticBackup = lib.mkOption {
type = lib.types.attrsOf (
lib.types.submodule {
options = {

View file

@ -8,9 +8,9 @@
{
imports = [ inputs.sops-nix.nixosModules.sops ];
options.myConfig.sops.enable = lib.mkEnableOption "";
options.custom.sops.enable = lib.mkEnableOption "";
config = lib.mkIf config.myConfig.sops.enable {
config = lib.mkIf config.custom.sops.enable {
sops = {
age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ];
defaultSopsFile = "${self}/hosts/${config.networking.hostName}/secrets.yaml";

View file

@ -1,8 +1,8 @@
{ config, lib, ... }:
{
options.myConfig.sound.enable = lib.mkEnableOption "";
options.custom.services.sound.enable = lib.mkEnableOption "";
config = lib.mkIf config.myConfig.sound.enable {
config = lib.mkIf config.custom.services.sound.enable {
security.rtkit.enable = true;
services = {
pulseaudio.enable = false;

View file

@ -5,9 +5,9 @@
...
}:
{
options.myConfig.steam.enable = lib.mkEnableOption "";
options.custom.programs.steam.enable = lib.mkEnableOption "";
config = lib.mkIf config.myConfig.steam.enable {
config = lib.mkIf config.custom.programs.steam.enable {
programs = {
steam.enable = true;

View file

@ -5,12 +5,12 @@
...
}:
let
cfg = config.myConfig.syncthing;
cfg = config.custom.services.syncthing;
user = config.users.users.syncthing.name;
in
{
options.myConfig.syncthing.backups.enable = lib.mkEnableOption "";
options.custom.services.syncthing.backups.enable = lib.mkEnableOption "";
config = lib.mkIf cfg.backups.enable {
assertions = [
@ -37,7 +37,7 @@ in
'';
};
myConfig.resticBackup.syncthing = {
custom.services.resticBackup.syncthing = {
inherit user;
healthchecks.enable = true;

View file

@ -5,10 +5,10 @@
...
}:
let
cfg = config.myConfig.syncthing;
cfg = config.custom.services.syncthing;
in
{
options.myConfig.syncthing = {
options.custom.services.syncthing = {
enable = lib.mkEnableOption "";
isServer = lib.mkEnableOption "";
deviceId = lib.mkOption {
@ -32,10 +32,10 @@ in
devices =
self.nixosConfigurations
|> lib.filterAttrs (name: _: name != config.networking.hostName)
|> lib.filterAttrs (_: value: value.config.myConfig.syncthing.enable)
|> lib.filterAttrs (_: value: value.config.custom.services.syncthing.enable)
|> lib.mapAttrs (
name: value: {
id = value.config.myConfig.syncthing.deviceId;
id = value.config.custom.services.syncthing.deviceId;
addresses = [ "tcp://${name}.${value.config.networking.domain}:22000" ];
}
);

View file

@ -5,7 +5,7 @@
...
}:
let
nodes = config.myConfig.tailscale.caddyServe |> lib.filterAttrs (_: value: value.enable);
nodes = config.custom.services.tailscale.caddyServe |> lib.filterAttrs (_: value: value.enable);
caddy-tailscale = pkgs.caddy.withPlugins {
plugins = [ "github.com/tailscale/caddy-tailscale@v0.0.0-20250207163903-69a970c84556" ];
@ -13,7 +13,7 @@ let
};
in
{
options.myConfig.tailscale.caddyServe = lib.mkOption {
options.custom.services.tailscale.caddyServe = lib.mkOption {
type = lib.types.attrsOf (
lib.types.submodule (
{ name, ... }:

View file

@ -5,10 +5,10 @@
...
}:
let
cfg = config.myConfig.tailscale;
cfg = config.custom.services.tailscale;
in
{
options.myConfig.tailscale = {
options.custom.services.tailscale = {
enable = lib.mkEnableOption "";
subdomain = lib.mkOption {
type = lib.types.nonEmptyStr;

View file

@ -5,9 +5,9 @@
...
}:
{
options.myConfig.virtualisation.enable = lib.mkEnableOption "";
options.custom.virtualisation.enable = lib.mkEnableOption "";
config = lib.mkIf config.myConfig.virtualisation.enable {
config = lib.mkIf config.custom.virtualisation.enable {
virtualisation.libvirtd.enable = true;
programs.virt-manager.enable = true;

View file

@ -13,9 +13,9 @@ let
];
in
{
options.myConfig.wlan.enable = lib.mkEnableOption "";
options.custom.services.wlan.enable = lib.mkEnableOption "";
config = lib.mkIf config.myConfig.wlan.enable (
config = lib.mkIf config.custom.services.wlan.enable (
lib.mkMerge [
{
networking.wireless.iwd = {