From 4b6e05212c407fcabb29ed4b39df4aaa50165749 Mon Sep 17 00:00:00 2001 From: Jelle Spreeuwenberg Date: Wed, 6 May 2026 21:57:58 +0200 Subject: [PATCH] refactor: schema --- modules/capabilities/_theme.nix | 69 ++++++ modules/capabilities/desktop-defaults.nix | 3 +- modules/capabilities/git.nix | 5 +- modules/capabilities/neovim/default.nix | 4 +- modules/capabilities/niri/_shortcuts.nix | 2 +- modules/capabilities/niri/default.nix | 26 +- modules/capabilities/noctalia/default.nix | 2 +- modules/capabilities/passwords.nix | 18 +- modules/capabilities/pim.nix | 4 +- modules/capabilities/services/actual.nix | 7 + modules/capabilities/services/gitea.nix | 7 + modules/capabilities/services/openssh.nix | 4 +- modules/capabilities/services/radicale.nix | 7 + modules/capabilities/services/vaultwarden.nix | 7 + modules/capabilities/syncthing.nix | 29 ++- modules/capabilities/terminal.nix | 4 +- modules/capabilities/theme.nix | 2 + modules/capabilities/vicinae.nix | 2 +- modules/capabilities/walker.nix | 2 +- modules/data.nix | 105 +------- modules/flake-parts.nix | 4 +- modules/hosts/orion/default.nix | 1 - modules/hosts/polaris/default.nix | 1 - modules/hosts/zenith/default.nix | 1 - modules/lib/helpers.nix | 29 ++- modules/lib/schema.nix | 226 ++---------------- modules/profiles/host-base.nix | 4 +- 27 files changed, 198 insertions(+), 377 deletions(-) create mode 100644 modules/capabilities/_theme.nix diff --git a/modules/capabilities/_theme.nix b/modules/capabilities/_theme.nix new file mode 100644 index 0000000..7f16af6 --- /dev/null +++ b/modules/capabilities/_theme.nix @@ -0,0 +1,69 @@ +{ + cursor = { + name = "phinger-cursors-light"; + packagePath = [ "phinger-cursors" ]; + size = 24; + }; + + kanagawa = { + displayName = "Kanagawa Wave"; + name = "kanagawa-wave"; + gtkThemeName = "Kanagawa-BL-LB"; + iconThemeName = "Kanagawa"; + owner = "Fausto-Korpsvart"; + repo = "Kanagawa-GKT-Theme"; + rev = "55ca4ba249eba21f861b9866b71ab41bb8930318"; + hash = "sha256-UdMoMx2DoovcxSp/zBZ3PRv/Qpj+prd0uPm1gmdak2E="; + version = "unstable-2025-10-23"; + + palette = { + background = "#1F1F28"; + foreground = "#DCD7BA"; + secondaryBackground = "#16161D"; + border = "#2A2A37"; + selectionBackground = "#2D4F67"; + selectionForeground = "#C8C093"; + url = "#72A7BC"; + cursor = "#C8C093"; + muted = "#727169"; + + accents = { + blue = "#7E9CD8"; + green = "#98BB6C"; + magenta = "#D27E99"; + orange = "#FFA066"; + purple = "#957FB8"; + red = "#E82424"; + yellow = "#E6C384"; + cyan = "#7AA89F"; + }; + + niri.border = { + active = "#7E9CD8"; + inactive = "#54546D"; + urgent = "#E82424"; + }; + + terminal = { + color0 = "#16161D"; + color1 = "#C34043"; + color2 = "#76946A"; + color3 = "#C0A36E"; + color4 = "#7E9CD8"; + color5 = "#957FB8"; + color6 = "#6A9589"; + color7 = "#C8C093"; + color8 = "#727169"; + color9 = "#E82424"; + color10 = "#98BB6C"; + color11 = "#E6C384"; + color12 = "#7FB4CA"; + color13 = "#938AA9"; + color14 = "#7AA89F"; + color15 = "#DCD7BA"; + color16 = "#FFA066"; + color17 = "#FF5D62"; + }; + }; + }; +} diff --git a/modules/capabilities/desktop-defaults.nix b/modules/capabilities/desktop-defaults.nix index 73b1e7b..b7db890 100644 --- a/modules/capabilities/desktop-defaults.nix +++ b/modules/capabilities/desktop-defaults.nix @@ -16,7 +16,7 @@ in { imports = [ homeModules.browser-vivaldi ]; - meta.desktop.browserCommand = lib.getExe (vivaldiPackage pkgs); + facts.desktop.browserCommand = lib.getExe (vivaldiPackage pkgs); home.sessionVariables.BROWSER = lib.getExe (vivaldiPackage pkgs); xdg.mimeApps.defaultApplicationPackages = [ (vivaldiPackage pkgs) ]; }; @@ -32,7 +32,6 @@ in { imports = [ homeModules.file-manager-nautilus ]; - meta.desktop.fileManagerCommand = lib.getExe (nautilusPackage pkgs); xdg.mimeApps.defaultApplicationPackages = [ (nautilusPackage pkgs) ]; }; diff --git a/modules/capabilities/git.nix b/modules/capabilities/git.nix index 78acf49..07a85a7 100644 --- a/modules/capabilities/git.nix +++ b/modules/capabilities/git.nix @@ -10,7 +10,7 @@ in ... }: let - machine = osConfig.meta.machine; + machine = osConfig.facts.machine; allowedSignersFile = "${config.xdg.configHome}/git/allowed_signers"; mkScope = @@ -19,6 +19,7 @@ in email = account.emails.${scope}.address; key = lib.attrByPath [ scope ] null machine.sshKeys; hasSigningKey = key != null; + privateKeyPath = key.privateKeyPath or "~/.ssh/id_${scope}"; in { allowedSigners = lib.optional hasSigningKey "${email} ${key.publicKey}"; @@ -28,7 +29,7 @@ in inherit email; } // lib.optionalAttrs hasSigningKey { - signingKey = "${key.privateKeyPath}.pub"; + signingKey = "${privateKeyPath}.pub"; }; } // lib.optionalAttrs hasSigningKey { diff --git a/modules/capabilities/neovim/default.nix b/modules/capabilities/neovim/default.nix index 66a9add..e67a428 100644 --- a/modules/capabilities/neovim/default.nix +++ b/modules/capabilities/neovim/default.nix @@ -160,8 +160,8 @@ in # Hostname/ConfigDir needed for nixd nixdExtras = { nixpkgs = "import ${pkgs.path} {}"; - nixos_options = ''(builtins.getFlake "path://${account.nixosConfigurationPath}").nixosConfigurations.${osConfig.meta.machine.name}.options''; - home_manager_options = ''(builtins.getFlake "path://${account.nixosConfigurationPath}").nixosConfigurations.${osConfig.meta.machine.name}.options.home-manager.users.type.getSubOptions []''; + nixos_options = ''(builtins.getFlake "path://${account.nixosConfigurationPath}").nixosConfigurations.${osConfig.facts.machine.name}.options''; + home_manager_options = ''(builtins.getFlake "path://${account.nixosConfigurationPath}").nixosConfigurations.${osConfig.facts.machine.name}.options.home-manager.users.type.getSubOptions []''; }; themeSetup = import ./_kanagawa-theme.nix { diff --git a/modules/capabilities/niri/_shortcuts.nix b/modules/capabilities/niri/_shortcuts.nix index a1319ea..e1b1c6f 100644 --- a/modules/capabilities/niri/_shortcuts.nix +++ b/modules/capabilities/niri/_shortcuts.nix @@ -28,7 +28,7 @@ let text = lib.concatStringsSep "\n" [ "# shellcheck disable=SC2016" "cd ${lib.escapeShellArg workdir}" - "exec ${lib.escapeShellArg config.meta.desktop.terminalCommand} ${argString}" + "exec ${lib.escapeShellArg config.facts.desktop.terminalCommand} ${argString}" ]; }; in diff --git a/modules/capabilities/niri/default.nix b/modules/capabilities/niri/default.nix index 03c6e27..b4912d0 100644 --- a/modules/capabilities/niri/default.nix +++ b/modules/capabilities/niri/default.nix @@ -51,6 +51,7 @@ in repo ; }; + machine = osConfig.facts.machine; in { home = { @@ -70,27 +71,34 @@ in programs.niri.settings = { outputs = lib.mapAttrs ( _: display: + let + scale = display.scale or null; + width = display.width or null; + height = display.height or null; + refresh = display.refresh or null; + in { position = { - inherit (display) x y; + x = display.x or 0; + y = display.y or 0; }; } // lib.optionalAttrs (display.primary or false) { "focus-at-startup" = true; } - // lib.optionalAttrs (display.scale != null) { - inherit (display) scale; + // lib.optionalAttrs (scale != null) { + inherit scale; } - // lib.optionalAttrs (display.width != null && display.height != null && display.refresh != null) { + // lib.optionalAttrs (width != null && height != null && refresh != null) { mode = { - inherit (display) + inherit width height refresh ; }; } - ) osConfig.meta.machine.displays; + ) (machine.displays or { }); environment.DISPLAY = ":0"; spawn-at-startup = [ @@ -156,9 +164,9 @@ in }; binds = import ./_bindings.nix { - browserCommand = config.meta.desktop.browserCommand; - launcherCommand = config.meta.desktop.launcherCommand; - terminalCommand = config.meta.desktop.terminalCommand; + browserCommand = config.facts.desktop.browserCommand; + launcherCommand = config.facts.desktop.launcherCommand; + terminalCommand = config.facts.desktop.terminalCommand; shortcutCommands = shortcuts.commands; }; }; diff --git a/modules/capabilities/noctalia/default.nix b/modules/capabilities/noctalia/default.nix index 5e87c5c..73e0d46 100644 --- a/modules/capabilities/noctalia/default.nix +++ b/modules/capabilities/noctalia/default.nix @@ -71,7 +71,7 @@ in terminalCommand = lib.getExe pkgs.xdg-terminal-exec; }; settings = - if baseSettings == { } || !osConfig.meta.machine.portable then + if baseSettings == { } || !(osConfig.facts.machine.portable or false) then baseSettings else mkPortableSettings baseSettings; diff --git a/modules/capabilities/passwords.nix b/modules/capabilities/passwords.nix index c527f59..afdf7a9 100644 --- a/modules/capabilities/passwords.nix +++ b/modules/capabilities/passwords.nix @@ -5,31 +5,23 @@ let repo = config.repo; account = repo.account; - homeModules = config.flake.modules.homeManager; in { - flake.modules.homeManager.pinentry = - { pkgs, ... }: - { - meta.pinentry.package = pkgs.pinentry-gnome3; - }; - flake.modules.homeManager.passwords = { - config, + pkgs, ... }: + let + pinentryPackage = pkgs.pinentry-gnome3; + in { - imports = [ - homeModules.pinentry - ]; - programs.rbw = { enable = true; settings = { base_url = repo.services.vaultwarden.url; email = account.primaryEmail.address; - pinentry = config.meta.pinentry.package; + pinentry = pinentryPackage; }; }; }; diff --git a/modules/capabilities/pim.nix b/modules/capabilities/pim.nix index ace117c..0539893 100644 --- a/modules/capabilities/pim.nix +++ b/modules/capabilities/pim.nix @@ -17,7 +17,7 @@ in mkOffice365Account = { address, - primary, + primary ? false, ... }: { @@ -37,7 +37,7 @@ in mkMxrouteAccount = { address, - primary, + primary ? false, ... }: { diff --git a/modules/capabilities/services/actual.nix b/modules/capabilities/services/actual.nix index 121f463..e218baa 100644 --- a/modules/capabilities/services/actual.nix +++ b/modules/capabilities/services/actual.nix @@ -5,6 +5,13 @@ let service = repo.services.actual; in { + repo.services.actual = { + domain = "finance.jelles.net"; + host = "127.0.0.1"; + port = 3000; + url = "https://finance.jelles.net"; + }; + flake.modules.nixos.actual = { lib, ... }: lib.mkMerge [ diff --git a/modules/capabilities/services/gitea.nix b/modules/capabilities/services/gitea.nix index 3ec4419..226a8fc 100644 --- a/modules/capabilities/services/gitea.nix +++ b/modules/capabilities/services/gitea.nix @@ -5,6 +5,13 @@ let service = repo.services.gitea; in { + repo.services.gitea = { + domain = "git.jelles.net"; + host = "127.0.0.1"; + port = 3001; + url = "https://git.jelles.net/"; + }; + flake.modules.nixos.gitea = { lib, ... }: lib.mkMerge [ diff --git a/modules/capabilities/services/openssh.nix b/modules/capabilities/services/openssh.nix index 5759164..48549f2 100644 --- a/modules/capabilities/services/openssh.nix +++ b/modules/capabilities/services/openssh.nix @@ -3,8 +3,8 @@ let account = config.repo.account; personalPublicKeys = machines: - map (machine: machine.sshKeys.personal.publicKey) ( - lib.filter (machine: machine.sshKeys ? personal) (builtins.attrValues machines) + map (machine: (machine.sshKeys or { }).personal.publicKey) ( + lib.filter (machine: (machine.sshKeys or { }) ? personal) (builtins.attrValues machines) ); in { diff --git a/modules/capabilities/services/radicale.nix b/modules/capabilities/services/radicale.nix index 20cd286..8cac204 100644 --- a/modules/capabilities/services/radicale.nix +++ b/modules/capabilities/services/radicale.nix @@ -5,6 +5,13 @@ let service = repo.services.radicale; in { + repo.services.radicale = { + domain = "radicale.jelles.net"; + host = "127.0.0.1"; + port = 5232; + url = "https://radicale.jelles.net/"; + }; + flake.modules.nixos.radicale = { lib, ... }: lib.mkMerge [ diff --git a/modules/capabilities/services/vaultwarden.nix b/modules/capabilities/services/vaultwarden.nix index 28ffc9c..e600fd3 100644 --- a/modules/capabilities/services/vaultwarden.nix +++ b/modules/capabilities/services/vaultwarden.nix @@ -5,6 +5,13 @@ let service = repo.services.vaultwarden; in { + repo.services.vaultwarden = { + domain = "vault.jelles.net"; + host = "127.0.0.1"; + port = 8100; + url = "https://vault.jelles.net"; + }; + flake.modules.nixos.vaultwarden = { lib, ... }: lib.mkMerge [ diff --git a/modules/capabilities/syncthing.nix b/modules/capabilities/syncthing.nix index 81a0a74..a945b9f 100644 --- a/modules/capabilities/syncthing.nix +++ b/modules/capabilities/syncthing.nix @@ -5,21 +5,26 @@ }: let syncMachines = lib.listToAttrs ( - lib.concatMap ( - machine: - lib.optional (machine.syncthingId != null) ( + lib.concatLists ( + lib.mapAttrsToList ( + machineName: machine: let - name = "${config.repo.account.name}@${machine.name}"; + syncthingId = machine.syncthingId or null; in - { - inherit name; - value = { + lib.optional (syncthingId != null) ( + let + name = "${config.repo.account.name}@${machineName}"; + in + { inherit name; - id = machine.syncthingId; - }; - } - ) - ) (builtins.attrValues config.repo.machines) + value = { + inherit name; + id = syncthingId; + }; + } + ) + ) config.repo.machines + ) ); syncPhones = { diff --git a/modules/capabilities/terminal.nix b/modules/capabilities/terminal.nix index 8c32990..3418ae7 100644 --- a/modules/capabilities/terminal.nix +++ b/modules/capabilities/terminal.nix @@ -175,7 +175,7 @@ in { imports = [ config.flake.modules.homeManager.terminal-foot ]; - meta.desktop.terminalCommand = lib.getExe pkgs.foot; + facts.desktop.terminalCommand = lib.getExe pkgs.foot; xdg.terminal-exec = { enable = true; @@ -188,7 +188,7 @@ in { imports = [ config.flake.modules.homeManager.terminal-kitty ]; - meta.desktop.terminalCommand = lib.getExe (kittySingleInstance pkgs); + facts.desktop.terminalCommand = lib.getExe (kittySingleInstance pkgs); xdg.terminal-exec = { enable = true; diff --git a/modules/capabilities/theme.nix b/modules/capabilities/theme.nix index 213790f..d6bc79a 100644 --- a/modules/capabilities/theme.nix +++ b/modules/capabilities/theme.nix @@ -8,6 +8,8 @@ let hmModules = config.flake.modules.homeManager; in { + repo.theme = import ./_theme.nix; + flake.modules.nixos.theme = { pkgs, diff --git a/modules/capabilities/vicinae.nix b/modules/capabilities/vicinae.nix index 0b7f24c..fa2f96b 100644 --- a/modules/capabilities/vicinae.nix +++ b/modules/capabilities/vicinae.nix @@ -73,6 +73,6 @@ in ]; }; - meta.desktop.launcherCommand = lib.getExe config.programs.vicinae.package; + facts.desktop.launcherCommand = lib.getExe config.programs.vicinae.package; }; } diff --git a/modules/capabilities/walker.nix b/modules/capabilities/walker.nix index 07bab22..fccc948 100644 --- a/modules/capabilities/walker.nix +++ b/modules/capabilities/walker.nix @@ -35,6 +35,6 @@ in { imports = [ homeModules.walker-base ]; - meta.desktop.launcherCommand = lib.getExe config.programs.walker.package; + facts.desktop.launcherCommand = lib.getExe config.programs.walker.package; }; } diff --git a/modules/data.nix b/modules/data.nix index ce128a5..f53ebeb 100644 --- a/modules/data.nix +++ b/modules/data.nix @@ -1,8 +1,11 @@ { repo = { - account = { + account = rec { name = "kiri"; realName = "Jelle Spreeuwenberg"; + homeDirectory = "/home/${name}"; + nixosConfigurationPath = "${homeDirectory}/.config/nixos"; + emails = { personal = { address = "mail@jelles.net"; @@ -22,106 +25,8 @@ type = "office365"; }; }; - }; - services = { - actual = { - domain = "finance.jelles.net"; - host = "127.0.0.1"; - port = 3000; - url = "https://finance.jelles.net"; - }; - - gitea = { - domain = "git.jelles.net"; - host = "127.0.0.1"; - port = 3001; - url = "https://git.jelles.net/"; - }; - - radicale = { - domain = "radicale.jelles.net"; - host = "127.0.0.1"; - port = 5232; - url = "https://radicale.jelles.net/"; - }; - - vaultwarden = { - domain = "vault.jelles.net"; - host = "127.0.0.1"; - port = 8100; - url = "https://vault.jelles.net"; - }; - }; - - theme = { - cursor = { - name = "phinger-cursors-light"; - packagePath = [ "phinger-cursors" ]; - size = 24; - }; - - kanagawa = { - displayName = "Kanagawa Wave"; - name = "kanagawa-wave"; - gtkThemeName = "Kanagawa-BL-LB"; - iconThemeName = "Kanagawa"; - owner = "Fausto-Korpsvart"; - repo = "Kanagawa-GKT-Theme"; - rev = "55ca4ba249eba21f861b9866b71ab41bb8930318"; - hash = "sha256-UdMoMx2DoovcxSp/zBZ3PRv/Qpj+prd0uPm1gmdak2E="; - version = "unstable-2025-10-23"; - - palette = { - background = "#1F1F28"; - foreground = "#DCD7BA"; - secondaryBackground = "#16161D"; - border = "#2A2A37"; - selectionBackground = "#2D4F67"; - selectionForeground = "#C8C093"; - url = "#72A7BC"; - cursor = "#C8C093"; - muted = "#727169"; - - accents = { - blue = "#7E9CD8"; - green = "#98BB6C"; - magenta = "#D27E99"; - orange = "#FFA066"; - purple = "#957FB8"; - red = "#E82424"; - yellow = "#E6C384"; - cyan = "#7AA89F"; - }; - - niri.border = { - active = "#7E9CD8"; - inactive = "#54546D"; - urgent = "#E82424"; - }; - - terminal = { - color0 = "#16161D"; - color1 = "#C34043"; - color2 = "#76946A"; - color3 = "#C0A36E"; - color4 = "#7E9CD8"; - color5 = "#957FB8"; - color6 = "#6A9589"; - color7 = "#C8C093"; - color8 = "#727169"; - color9 = "#E82424"; - color10 = "#98BB6C"; - color11 = "#E6C384"; - color12 = "#7FB4CA"; - color13 = "#938AA9"; - color14 = "#7AA89F"; - color15 = "#DCD7BA"; - color16 = "#FFA066"; - color17 = "#FF5D62"; - }; - }; - }; + primaryEmail = emails.personal; }; }; } diff --git a/modules/flake-parts.nix b/modules/flake-parts.nix index 1a22d3c..6a6950a 100644 --- a/modules/flake-parts.nix +++ b/modules/flake-parts.nix @@ -12,10 +12,10 @@ systems = [ "x86_64-linux" ]; flake.nixosConfigurations = builtins.mapAttrs ( - _: machine: + name: machine: inputs.nixpkgs.lib.nixosSystem { specialArgs = { inherit inputs; }; - modules = [ (config.repo.helpers.mkHost machine) ]; + modules = [ (config.repo.helpers.mkHost name machine) ]; } ) config.repo.machines; diff --git a/modules/hosts/orion/default.nix b/modules/hosts/orion/default.nix index 0cdb110..5bf25f3 100644 --- a/modules/hosts/orion/default.nix +++ b/modules/hosts/orion/default.nix @@ -12,7 +12,6 @@ in syncthingId = "NNRNQKZ-OWPHSVA-B6KKBHE-SDYLSTV-7SVHGPR-NEWLKPL-4MWNJG4-G5FHUAI"; stateVersion = "24.05"; - hmStateVersion = "24.05"; }; flake.modules.nixos.orion = diff --git a/modules/hosts/polaris/default.nix b/modules/hosts/polaris/default.nix index 7ce912b..ed22dcd 100644 --- a/modules/hosts/polaris/default.nix +++ b/modules/hosts/polaris/default.nix @@ -16,7 +16,6 @@ in syncthingId = "6HBAKXB-DB3B4H2-BODCAXF-KD23H5W-6X5LGLC-ZJHZHLG-7U7YMGO-BB6IXQ3"; stateVersion = "24.05"; - hmStateVersion = "24.05"; displays = { "LG Electronics LG ULTRAGEAR 103NTYT8R290" = { diff --git a/modules/hosts/zenith/default.nix b/modules/hosts/zenith/default.nix index d621346..d384b05 100644 --- a/modules/hosts/zenith/default.nix +++ b/modules/hosts/zenith/default.nix @@ -28,7 +28,6 @@ in }; stateVersion = "24.05"; - hmStateVersion = "24.05"; }; flake.modules.nixos.zenith = diff --git a/modules/lib/helpers.nix b/modules/lib/helpers.nix index bc658b6..03a7dda 100644 --- a/modules/lib/helpers.nix +++ b/modules/lib/helpers.nix @@ -37,26 +37,35 @@ let }; mkHost = - machine: + name: machine: { pkgs, ... }: let account = config.repo.account; + accountHome = account.homeDirectory or "/home/${account.name}"; + normalizedMachine = machine // { + inherit name; + displays = machine.displays or { }; + hmStateVersion = machine.hmStateVersion or machine.stateVersion; + portable = machine.portable or false; + sshKeys = machine.sshKeys or { }; + syncthingId = machine.syncthingId or null; + }; in { imports = [ - nixosModules.${machine.name} + nixosModules.${name} ]; - meta.machine = machine; + facts.machine = normalizedMachine; - networking.hostName = machine.name; + networking.hostName = name; system.stateVersion = machine.stateVersion; programs.zsh.enable = true; users.users.${account.name} = { isNormalUser = true; - home = account.homeDirectory; + home = accountHome; extraGroups = [ "wheel" "networkmanager" @@ -67,19 +76,13 @@ let home-manager.users.${account.name} = { home = { username = account.name; - homeDirectory = account.homeDirectory; - stateVersion = machine.hmStateVersion; + homeDirectory = accountHome; + stateVersion = normalizedMachine.hmStateVersion; }; }; }; in { - options.repo.helpers = lib.mkOption { - type = lib.types.attrsOf lib.types.raw; - internal = true; - readOnly = true; - }; - config.repo.helpers = { inherit mkCaddyReverseProxy diff --git a/modules/lib/schema.nix b/modules/lib/schema.nix index b241acd..a5ffdf1 100644 --- a/modules/lib/schema.nix +++ b/modules/lib/schema.nix @@ -1,221 +1,33 @@ { lib, ... }: -let - emailProviderType = lib.types.enum [ - "mxrouting" - "office365" - ]; - - emailType = lib.types.submodule ( - { ... }: - { - options = { - address = lib.mkOption { - type = lib.types.str; - }; - - primary = lib.mkOption { - type = lib.types.bool; - default = false; - }; - - type = lib.mkOption { - type = emailProviderType; - }; - }; - } - ); - - sshKeyType = lib.types.submodule ( - { name, ... }: - { - options = { - publicKey = lib.mkOption { - type = lib.types.str; - }; - - privateKeyPath = lib.mkOption { - type = lib.types.str; - default = "~/.ssh/id_${name}"; - }; - }; - } - ); - - accountType = lib.types.submodule ( - { config, ... }: - { - options = { - name = lib.mkOption { - type = lib.types.str; - }; - - realName = lib.mkOption { - type = lib.types.str; - }; - - homeDirectory = lib.mkOption { - type = lib.types.str; - default = "/home/${config.name}"; - }; - - nixosConfigurationPath = lib.mkOption { - type = lib.types.str; - default = "${config.homeDirectory}/.config/nixos"; - }; - - emails = lib.mkOption { - type = lib.types.attrsOf emailType; - default = { }; - }; - - primaryEmail = lib.mkOption { - type = lib.types.nullOr emailType; - description = "Derived primary email entry for this user."; - default = - let - emails = builtins.attrValues config.emails; - in - lib.findFirst (email: email.primary) null emails; - }; - }; - } - ); - - displayType = lib.types.submodule ( - { ... }: - { - options = { - primary = lib.mkOption { - type = lib.types.bool; - default = false; - }; - - x = lib.mkOption { - type = lib.types.int; - default = 0; - }; - - y = lib.mkOption { - type = lib.types.int; - default = 0; - }; - - scale = lib.mkOption { - type = lib.types.nullOr lib.types.float; - default = null; - }; - - width = lib.mkOption { - type = lib.types.nullOr lib.types.int; - default = null; - }; - - height = lib.mkOption { - type = lib.types.nullOr lib.types.int; - default = null; - }; - - refresh = lib.mkOption { - type = lib.types.nullOr lib.types.float; - default = null; - }; - }; - } - ); - - machineType = lib.types.submodule ( - { name, config, ... }: - { - options = { - name = lib.mkOption { - type = lib.types.str; - default = name; - }; - - stateVersion = lib.mkOption { - type = lib.types.str; - }; - - hmStateVersion = lib.mkOption { - type = lib.types.str; - default = config.stateVersion; - }; - - displays = lib.mkOption { - type = lib.types.attrsOf displayType; - default = { }; - }; - - sshKeys = lib.mkOption { - type = lib.types.attrsOf sshKeyType; - default = { }; - }; - - syncthingId = lib.mkOption { - type = lib.types.nullOr lib.types.str; - default = null; - }; - - portable = lib.mkOption { - type = lib.types.bool; - default = false; - }; - }; - } - ); -in { - options.repo = { - account = lib.mkOption { - type = accountType; - }; + options.repo = lib.mkOption { + type = lib.types.submodule { + freeformType = lib.types.attrsOf lib.types.anything; - machines = lib.mkOption { - type = lib.types.attrsOf machineType; - default = { }; - }; - - services = lib.mkOption { - type = lib.types.raw; - default = { }; - }; - - theme = lib.mkOption { - type = lib.types.raw; - default = { }; + options.helpers = lib.mkOption { + type = lib.types.attrsOf lib.types.raw; + default = { }; + internal = true; + }; }; + default = { }; }; - config.flake.modules.nixos.meta = - { ... }: + config.flake.modules.nixos.facts = + { lib, ... }: { - options.meta.machine = lib.mkOption { - type = machineType; + options.facts.machine = lib.mkOption { + type = lib.types.attrsOf lib.types.anything; + default = { }; }; }; - config.flake.modules.homeManager.meta = - { ... }: + config.flake.modules.homeManager.facts = + { lib, ... }: { - options.meta.desktop.browserCommand = lib.mkOption { - type = lib.types.str; - }; - - options.meta.desktop.fileManagerCommand = lib.mkOption { - type = lib.types.str; - }; - - options.meta.desktop.terminalCommand = lib.mkOption { - type = lib.types.str; - }; - - options.meta.desktop.launcherCommand = lib.mkOption { - type = lib.types.str; - }; - - options.meta.pinentry.package = lib.mkOption { - type = lib.types.package; + options.facts.desktop = lib.mkOption { + type = lib.types.attrsOf lib.types.anything; + default = { }; }; }; - } diff --git a/modules/profiles/host-base.nix b/modules/profiles/host-base.nix index f888088..57ac844 100644 --- a/modules/profiles/host-base.nix +++ b/modules/profiles/host-base.nix @@ -10,7 +10,7 @@ in { flake.modules.nixos.host-base = { imports = [ - nixosModules.meta + nixosModules.facts inputs.home-manager.nixosModules.home-manager nixosModules.nix nixosModules.locale-nl @@ -22,7 +22,7 @@ in backupFileExtension = "bak"; extraSpecialArgs = { inherit inputs; }; sharedModules = [ - hmModules.meta + hmModules.facts hmModules.syncthing hmModules.shell hmModules.neovim