diff --git a/modules/capabilities/_theme.nix b/modules/capabilities/_theme.nix index 7f16af6..80a51c0 100644 --- a/modules/capabilities/_theme.nix +++ b/modules/capabilities/_theme.nix @@ -1,7 +1,7 @@ { cursor = { name = "phinger-cursors-light"; - packagePath = [ "phinger-cursors" ]; + packageName = "phinger-cursors"; size = 24; }; diff --git a/modules/capabilities/ai.nix b/modules/capabilities/ai.nix index b81b700..e42a611 100644 --- a/modules/capabilities/ai.nix +++ b/modules/capabilities/ai.nix @@ -1,6 +1,5 @@ { inputs, config, ... }: let - account = config.repo.account; hmModules = config.flake.modules.homeManager; in { @@ -18,12 +17,7 @@ in }; flake.modules.homeManager.ai = - { - config, - lib, - pkgs, - ... - }: + { pkgs, ... }: { programs.mcp = { enable = true; @@ -36,32 +30,5 @@ in home.packages = [ pkgs.llm-agents.codex ]; - - # programs.codex = { - # enable = true; - # package = pkgs.llm-agents.codex; - # enableMcpIntegration = true; - # settings = { - # model = "gpt-5.5"; - # model_reasoning_effort = "high"; - # plan_mode_reasoning_effort = "high"; - # tui.status_line = [ - # "model-with-reasoning" - # "current-dir" - # "git-branch" - # "context-remaining" - # "five-hour-limit" - # ]; - # projects.${account.nixosConfigurationPath}.trust_level = "trusted"; - # projects."${config.home.homeDirectory}/work/repos/yookr-data-science".trust_level = "trusted"; - # sandbox_mode = "workspace-write"; - # personality = "pragmatic"; - # features.undo = true; - # mcp_servers.nixos = config.programs.mcp.servers.nixos // { - # enabled = true; - # default_tools_approval_mode = "approve"; - # }; - # }; - # }; }; } diff --git a/modules/capabilities/desktop-defaults.nix b/modules/capabilities/desktop-defaults.nix index b7db890..aaf8ac6 100644 --- a/modules/capabilities/desktop-defaults.nix +++ b/modules/capabilities/desktop-defaults.nix @@ -1,38 +1,40 @@ { config, ... }: let homeModules = config.flake.modules.homeManager; - vivaldiPackage = pkgs: pkgs.vivaldi; - nautilusPackage = pkgs: pkgs.nautilus; in { flake.modules.homeManager.browser-vivaldi = { pkgs, ... }: { - home.packages = [ (vivaldiPackage pkgs) ]; + home.packages = [ pkgs.vivaldi ]; }; flake.modules.homeManager.primary-browser-vivaldi = { lib, pkgs, ... }: + let + browser = pkgs.vivaldi; + browserCommand = lib.getExe browser; + in { imports = [ homeModules.browser-vivaldi ]; - facts.desktop.browserCommand = lib.getExe (vivaldiPackage pkgs); - home.sessionVariables.BROWSER = lib.getExe (vivaldiPackage pkgs); - xdg.mimeApps.defaultApplicationPackages = [ (vivaldiPackage pkgs) ]; + facts.desktop.browserCommand = browserCommand; + home.sessionVariables.BROWSER = browserCommand; + xdg.mimeApps.defaultApplicationPackages = [ browser ]; }; flake.modules.homeManager.file-manager-nautilus = { pkgs, ... }: { - home.packages = [ (nautilusPackage pkgs) ]; + home.packages = [ pkgs.nautilus ]; }; flake.modules.homeManager.primary-file-manager-nautilus = - { lib, pkgs, ... }: + { pkgs, ... }: { imports = [ homeModules.file-manager-nautilus ]; - xdg.mimeApps.defaultApplicationPackages = [ (nautilusPackage pkgs) ]; + xdg.mimeApps.defaultApplicationPackages = [ pkgs.nautilus ]; }; flake.modules.homeManager.image-viewer-imv = { diff --git a/modules/capabilities/dev-tools.nix b/modules/capabilities/dev-tools.nix index 2f9be3c..7670168 100644 --- a/modules/capabilities/dev-tools.nix +++ b/modules/capabilities/dev-tools.nix @@ -13,12 +13,6 @@ inputs.devenv.packages.${pkgs.stdenv.hostPlatform.system}.default ]; - # programs.direnv = { - # enable = true; - # enableZshIntegration = true; - # nix-direnv.enable = true; - # }; - programs.zsh.initContent = '' eval "$(devenv hook zsh)" ''; @@ -32,6 +26,5 @@ programs.jq.enable = true; programs.bun.enable = true; programs.ripgrep.enable = true; - #programs.uv.enable = true; }; } diff --git a/modules/capabilities/git.nix b/modules/capabilities/git.nix index 07a85a7..5afaadb 100644 --- a/modules/capabilities/git.nix +++ b/modules/capabilities/git.nix @@ -1,23 +1,22 @@ { config, lib, ... }: let - account = config.repo.account; + account = config.facts.account; in { flake.modules.homeManager.git = { config, - osConfig, ... }: let - machine = osConfig.facts.machine; + machine = config.facts.machine; allowedSignersFile = "${config.xdg.configHome}/git/allowed_signers"; mkScope = scope: let email = account.emails.${scope}.address; - key = lib.attrByPath [ scope ] null machine.sshKeys; + key = machine.sshKeys.${scope} or null; hasSigningKey = key != null; privateKeyPath = key.privateKeyPath or "~/.ssh/id_${scope}"; in diff --git a/modules/capabilities/limine.nix b/modules/capabilities/limine.nix index c2d06aa..4bbd700 100644 --- a/modules/capabilities/limine.nix +++ b/modules/capabilities/limine.nix @@ -1,6 +1,6 @@ { config, lib, ... }: let - palette = config.repo.theme.kanagawa.palette; + palette = config.facts.theme.kanagawa.palette; hex = lib.removePrefix "#"; terminalPalette = palette.terminal; mkPalette = colors: lib.concatStringsSep ";" (map hex colors); diff --git a/modules/capabilities/locale-nl.nix b/modules/capabilities/locale-nl.nix index 73e0a49..47ab15c 100644 --- a/modules/capabilities/locale-nl.nix +++ b/modules/capabilities/locale-nl.nix @@ -11,7 +11,7 @@ LC_TELEPHONE = "nl_NL.UTF-8"; LC_NAME = "nl_NL.UTF-8"; - # Use '.' as decimal point and ',' as thouands separator + # Use '.' as decimal point and ',' as thousands separator LC_NUMERIC = "en_IE.UTF-8"; LC_MONETARY = "en_IE.UTF-8"; diff --git a/modules/capabilities/neovim/default.nix b/modules/capabilities/neovim/default.nix index 9652253..696e914 100644 --- a/modules/capabilities/neovim/default.nix +++ b/modules/capabilities/neovim/default.nix @@ -1,7 +1,7 @@ { config, ... }: let - account = config.repo.account; - repoTheme = config.repo.theme.kanagawa; + account = config.facts.account; + theme = config.facts.theme.kanagawa; in { flake.modules.homeManager.default-editor-neovim = @@ -34,19 +34,14 @@ in wrappers.neovim = { enable = true; - # 1. Point to your existing Lua config directory settings.config_directory = ./lua-config; - # 2. Runtime Dependencies (from lspsAndRuntimeDeps) - # These are added to the PATH of the wrapper runtimePkgs = with pkgs; [ - # Tools universal-ctags ripgrep fd tree-sitter wl-clipboard - # LSPs & Formatters stylua taplo yamlfmt @@ -64,15 +59,10 @@ in tinymist typstyle websocat - - # ty - # basedpyright ty ruff ]; - # 3. Plugins - # Nix provisions plugins; lz.n controls when lazy specs are packadd'd. specs = { lz-n = { data = pkgs.vimPlugins.lz-n; @@ -153,9 +143,7 @@ in }; }; - # 4. Values exposed to Lua through require("nix-info").settings. settings = { - # Hostname/ConfigDir needed for nixd nixdExtras = { nixpkgs = "import ${pkgs.path} {}"; nixos_options = ''(builtins.getFlake "path://${account.nixosConfigurationPath}").nixosConfigurations.${osConfig.facts.machine.name}.options''; @@ -163,22 +151,17 @@ in }; themeSetup = import ./_kanagawa-theme.nix { - themeName = repoTheme.name; + themeName = theme.name; }; typstPreviewDependencies = { tinymist = "${pkgs.tinymist}/bin/tinymist"; websocat = "${pkgs.websocat}/bin/websocat"; }; - }; - # 5. Wrapper Configuration - # Enable Python/Node providers hosts.python3.nvim-host.enable = true; hosts.node.nvim-host.enable = true; - - # Ensure the bin name matches what you expect binName = "nvim"; }; }; diff --git a/modules/capabilities/niri/_shortcuts.nix b/modules/capabilities/niri/_shortcuts.nix index e1b1c6f..4ae34c6 100644 --- a/modules/capabilities/niri/_shortcuts.nix +++ b/modules/capabilities/niri/_shortcuts.nix @@ -1,11 +1,11 @@ { config, + facts, lib, pkgs, - repo, }: let - nixosConfigDir = repo.account.nixosConfigurationPath; + nixosConfigDir = facts.account.nixosConfigurationPath; mkTerminalScript = { name, diff --git a/modules/capabilities/niri/default.nix b/modules/capabilities/niri/default.nix index 2e3a63d..d98a7e4 100644 --- a/modules/capabilities/niri/default.nix +++ b/modules/capabilities/niri/default.nix @@ -4,7 +4,7 @@ ... }: let - repo = config.repo; + facts = config.facts; hmModules = config.flake.modules.homeManager; in { @@ -37,21 +37,20 @@ in { config, lib, - osConfig, pkgs, ... }: let - borderPalette = repo.theme.kanagawa.palette.niri.border; + borderPalette = facts.theme.kanagawa.palette.niri.border; shortcuts = import ./_shortcuts.nix { inherit config + facts lib pkgs - repo ; }; - machine = osConfig.facts.machine; + machine = config.facts.machine; in { home = { @@ -71,12 +70,6 @@ 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 = { x = display.x or 0; @@ -86,19 +79,19 @@ in // lib.optionalAttrs (display.primary or false) { "focus-at-startup" = true; } - // lib.optionalAttrs (scale != null) { - inherit scale; + // lib.optionalAttrs (display ? scale) { + inherit (display) scale; } - // lib.optionalAttrs (width != null && height != null && refresh != null) { + // lib.optionalAttrs (display ? width && display ? height && display ? refresh) { mode = { - inherit - width + inherit (display) height refresh + width ; }; } - ) (machine.displays or { }); + ) machine.displays; environment.DISPLAY = ":0"; spawn-at-startup = [ diff --git a/modules/capabilities/nix.nix b/modules/capabilities/nix.nix index e891d31..975838d 100644 --- a/modules/capabilities/nix.nix +++ b/modules/capabilities/nix.nix @@ -1,6 +1,6 @@ { inputs, config, ... }: let - account = config.repo.account; + account = config.facts.account; in { flake.modules.nixos.nix = diff --git a/modules/capabilities/noctalia/default.nix b/modules/capabilities/noctalia.nix similarity index 63% rename from modules/capabilities/noctalia/default.nix rename to modules/capabilities/noctalia.nix index 45dde8e..70f4b9c 100644 --- a/modules/capabilities/noctalia/default.nix +++ b/modules/capabilities/noctalia.nix @@ -1,19 +1,31 @@ -{ - config, - lib, - ... -}: { flake.modules.homeManager.noctalia = { config, inputs, lib, - osConfig, ... }: let homeDir = config.home.homeDirectory; + wallpaper = "${homeDir}/media/images/wallpapers/green-leaves.png"; + loginBox = output: { + box_height = 70.0; + box_width = 400.0; + cx = 1280.0; + cy = 1317.0; + inherit output; + rotation = 0.0; + type = "login_box"; + settings = { + background_color = "surface_variant"; + background_opacity = 0.88; + background_radius = 12.0; + input_opacity = 1.0; + input_radius = 6.0; + show_login_button = true; + }; + }; in { imports = [ inputs.noctalia.homeModules.default ]; @@ -27,25 +39,19 @@ }; bar.default = { - end = - if osConfig.facts.machine.portable then - [ - "tray" - "bluetooth" - "volume" - "network" - "battery" - "clipboard" - "control-center" - ] - else - [ - "tray" - "bluetooth" - "volume" - "clipboard" - "control-center" - ]; + end = [ + "tray" + "bluetooth" + "volume" + ] + ++ lib.optionals config.facts.machine.portable [ + "network" + "battery" + ] + ++ [ + "clipboard" + "control-center" + ]; font_weight = 400; start = [ "workspaces" ]; thickness = 30; @@ -56,9 +62,9 @@ account.radicale = { name = "Personal"; provider = "custom"; - server_url = "https://radicale.jelles.net/"; + server_url = config.facts.services.radicale.url; type = "caldav"; - username = "kiri"; + username = config.facts.account.name; }; }; @@ -96,40 +102,8 @@ visible = true; }; widget = { - "lockscreen-login-box@DP-2" = { - box_height = 70.0; - box_width = 400.0; - cx = 1280.0; - cy = 1317.0; - output = "DP-2"; - rotation = 0.0; - type = "login_box"; - settings = { - background_color = "surface_variant"; - background_opacity = 0.88; - background_radius = 12.0; - input_opacity = 1.0; - input_radius = 6.0; - show_login_button = true; - }; - }; - "lockscreen-login-box@DP-3" = { - box_height = 70.0; - box_width = 400.0; - cx = 1280.0; - cy = 1317.0; - output = "DP-3"; - rotation = 0.0; - type = "login_box"; - settings = { - background_color = "surface_variant"; - background_opacity = 0.88; - background_radius = 12.0; - input_opacity = 1.0; - input_radius = 6.0; - show_login_button = true; - }; - }; + "lockscreen-login-box@DP-2" = loginBox "DP-2"; + "lockscreen-login-box@DP-3" = loginBox "DP-3"; }; }; @@ -184,11 +158,11 @@ wallpaper = { directory = "${homeDir}/media/images/wallpapers"; - default.path = "${homeDir}/media/images/wallpapers/green-leaves.png"; - last.path = "${homeDir}/media/images/wallpapers/green-leaves.png"; + default.path = wallpaper; + last.path = wallpaper; monitors = { - DP-2.path = "${homeDir}/media/images/wallpapers/green-leaves.png"; - DP-3.path = "${homeDir}/media/images/wallpapers/green-leaves.png"; + DP-2.path = wallpaper; + DP-3.path = wallpaper; }; }; diff --git a/modules/capabilities/noctalia/_noctalia-config.nix b/modules/capabilities/noctalia/_noctalia-config.nix deleted file mode 100644 index 288d902..0000000 --- a/modules/capabilities/noctalia/_noctalia-config.nix +++ /dev/null @@ -1,181 +0,0 @@ -{ - homeDirectory, -}: -{ - audio = { - enable_sounds = true; - sound_volume = 1.0; - }; - - bar.default = { - end = [ - "tray" - "bluetooth" - "volume" - "clipboard" - "control-center" - ]; - font_weight = 400; - start = [ "workspaces" ]; - thickness = 30; - }; - - calendar = { - enabled = true; - account.radicale = { - name = "Personal"; - provider = "custom"; - server_url = "https://radicale.jelles.net/"; - type = "caldav"; - username = "kiri"; - }; - }; - - desktop_widgets = { - enabled = false; - schema_version = 2; - widget_order = [ ]; - grid = { - cell_size = 16; - major_interval = 4; - visible = true; - }; - widget = { }; - }; - - location.address = "Meterik, The Netherlands"; - - lockscreen = { - blur_intensity = 0.8; - blurred_desktop = true; - fingerprint = false; - tint_intensity = 0.5; - }; - - lockscreen_widgets = { - enabled = true; - schema_version = 2; - widget_order = [ - "lockscreen-login-box@DP-2" - "lockscreen-login-box@DP-3" - ]; - grid = { - cell_size = 16; - major_interval = 4; - visible = true; - }; - widget = { - "lockscreen-login-box@DP-2" = { - box_height = 70.0; - box_width = 400.0; - cx = 1280.0; - cy = 1317.0; - output = "DP-2"; - rotation = 0.0; - type = "login_box"; - settings = { - background_color = "surface_variant"; - background_opacity = 0.88; - background_radius = 12.0; - input_opacity = 1.0; - input_radius = 6.0; - show_login_button = true; - }; - }; - "lockscreen-login-box@DP-3" = { - box_height = 70.0; - box_width = 400.0; - cx = 1280.0; - cy = 1317.0; - output = "DP-3"; - rotation = 0.0; - type = "login_box"; - settings = { - background_color = "surface_variant"; - background_opacity = 0.88; - background_radius = 12.0; - input_opacity = 1.0; - input_radius = 6.0; - show_login_button = true; - }; - }; - }; - }; - - nightlight = { - enabled = true; - temperature_night = 3000; - }; - - notification = { - layer = "overlay"; - position = "bottom_right"; - }; - - plugins = { - enabled = [ ]; - source = [ - { - kind = "git"; - location = "https://github.com/noctalia-dev/official-plugins"; - name = "official"; - } - { - kind = "git"; - location = "https://github.com/noctalia-dev/community-plugins"; - name = "community"; - } - ]; - }; - - shell = { - font_family = "Lexend"; - screen_time_enabled = true; - settings_show_advanced = true; - ui_scale = 1.1; - animation.speed = 1.5; - screen_corners = { - enabled = true; - size = 50; - }; - screenshot.directory = "${homeDirectory}/media/images/screenshots"; - }; - - theme = { - builtin = "Kanagawa"; - community_palette = "Kanagawa Paper"; - wallpaper_scheme = "m3-content"; - templates = { - enable_builtin_templates = false; - enable_community_templates = false; - }; - }; - - wallpaper = { - directory = "${homeDirectory}/media/images/wallpapers"; - default.path = "${homeDirectory}/media/images/wallpapers/green-leaves.png"; - last.path = "${homeDirectory}/media/images/wallpapers/green-leaves.png"; - monitors = { - DP-2.path = "${homeDirectory}/media/images/wallpapers/green-leaves.png"; - DP-3.path = "${homeDirectory}/media/images/wallpapers/green-leaves.png"; - }; - }; - - weather.refresh_minutes = 15; - - widget = { - bluetooth.hide_when_no_connected_device = true; - cat = { - audio_spectrum = true; - type = "noctalia/bongocat:cat"; - }; - clock.format = "{:%b %d | %H:%M}"; - media = { - art_size = 90.0; - max_length = 800; - }; - tray.drawer = true; - volume.show_label = false; - workspaces.display = "none"; - }; -} diff --git a/modules/capabilities/passwords.nix b/modules/capabilities/passwords.nix index afdf7a9..bd1a6e3 100644 --- a/modules/capabilities/passwords.nix +++ b/modules/capabilities/passwords.nix @@ -3,8 +3,8 @@ ... }: let - repo = config.repo; - account = repo.account; + facts = config.facts; + account = facts.account; in { flake.modules.homeManager.passwords = @@ -19,7 +19,7 @@ in programs.rbw = { enable = true; settings = { - base_url = repo.services.vaultwarden.url; + base_url = facts.services.vaultwarden.url; email = account.primaryEmail.address; pinentry = pinentryPackage; }; diff --git a/modules/capabilities/pim.nix b/modules/capabilities/pim.nix index a002834..844f111 100644 --- a/modules/capabilities/pim.nix +++ b/modules/capabilities/pim.nix @@ -3,8 +3,8 @@ ... }: let - repo = config.repo; - account = repo.account; + facts = config.facts; + account = facts.account; in { flake.modules.homeManager.email = @@ -138,7 +138,7 @@ in }; remote = { - url = repo.services.radicale.url; + url = facts.services.radicale.url; type = "caldav"; userName = config.home.username; passwordCommand = [ diff --git a/modules/capabilities/services/actual.nix b/modules/capabilities/services/actual.nix index e218baa..54cfd1d 100644 --- a/modules/capabilities/services/actual.nix +++ b/modules/capabilities/services/actual.nix @@ -1,36 +1,19 @@ { config, ... }: let - repo = config.repo; - repoHelpers = repo.helpers; - service = repo.services.actual; + service = config.facts.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 = { + services.actual = { + enable = true; + openFirewall = false; + settings = { + inherit (service) port; + hostname = service.host; + }; + }; + + services.caddy.virtualHosts.${service.domain}.extraConfig = + "reverse_proxy :${toString service.port}"; }; - - flake.modules.nixos.actual = - { lib, ... }: - lib.mkMerge [ - { - services.actual = { - enable = true; - openFirewall = false; - settings = { - inherit (service) port; - hostname = service.host; - }; - }; - } - - (repoHelpers.mkCaddyReverseProxy { - inherit (service) - domain - port - ; - }) - ]; } diff --git a/modules/capabilities/services/caddy.nix b/modules/capabilities/services/caddy.nix index c50cf19..7ceaabf 100644 --- a/modules/capabilities/services/caddy.nix +++ b/modules/capabilities/services/caddy.nix @@ -1,12 +1,12 @@ { config, ... }: let - repo = config.repo; + facts = config.facts; in { flake.modules.nixos.caddy = { services.caddy = { enable = true; - email = repo.account.primaryEmail.address; + email = facts.account.primaryEmail.address; openFirewall = true; }; }; diff --git a/modules/capabilities/services/deluge.nix b/modules/capabilities/services/deluge.nix index 60eab98..e165929 100644 --- a/modules/capabilities/services/deluge.nix +++ b/modules/capabilities/services/deluge.nix @@ -1,6 +1,6 @@ { config, ... }: let - account = config.repo.account; + account = config.facts.account; in { flake.modules.nixos.deluge = diff --git a/modules/capabilities/services/gitea.nix b/modules/capabilities/services/gitea.nix index 226a8fc..0bd5a5a 100644 --- a/modules/capabilities/services/gitea.nix +++ b/modules/capabilities/services/gitea.nix @@ -1,49 +1,30 @@ { config, ... }: let - repo = config.repo; - repoHelpers = repo.helpers; - service = repo.services.gitea; + service = config.facts.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 = { + services.gitea = { + enable = true; - flake.modules.nixos.gitea = - { lib, ... }: - lib.mkMerge [ - { - services.gitea = { - enable = true; + settings = { + server = { + DOMAIN = service.domain; + ROOT_URL = service.url; + HTTP_PORT = service.port; + HTTP_ADDR = service.host; - settings = { - server = { - DOMAIN = service.domain; - ROOT_URL = service.url; - HTTP_PORT = service.port; - HTTP_ADDR = service.host; - - START_SSH_SERVER = false; - SSH_PORT = 22; - }; - - service.DISABLE_REGISTRATION = true; - }; + START_SSH_SERVER = false; + SSH_PORT = 22; }; - } - { - services.openssh.settings.AllowUsers = [ "gitea" ]; - } + service.DISABLE_REGISTRATION = true; + }; + }; - (repoHelpers.mkCaddyReverseProxy { - inherit (service) - domain - port - ; - }) - ]; + services.openssh.settings.AllowUsers = [ "gitea" ]; + + services.caddy.virtualHosts.${service.domain}.extraConfig = + "reverse_proxy :${toString service.port}"; + }; } diff --git a/modules/capabilities/services/openssh.nix b/modules/capabilities/services/openssh.nix index 48549f2..e19b583 100644 --- a/modules/capabilities/services/openssh.nix +++ b/modules/capabilities/services/openssh.nix @@ -1,6 +1,6 @@ { config, lib, ... }: let - account = config.repo.account; + account = config.facts.account; personalPublicKeys = machines: map (machine: (machine.sshKeys or { }).personal.publicKey) ( @@ -29,6 +29,6 @@ in }; }; - users.users.${account.name}.openssh.authorizedKeys.keys = personalPublicKeys config.repo.machines; + users.users.${account.name}.openssh.authorizedKeys.keys = personalPublicKeys config.facts.machines; }; } diff --git a/modules/capabilities/services/radicale.nix b/modules/capabilities/services/radicale.nix index 8cac204..573a3cf 100644 --- a/modules/capabilities/services/radicale.nix +++ b/modules/capabilities/services/radicale.nix @@ -1,56 +1,30 @@ { config, ... }: let - repo = config.repo; - repoHelpers = repo.helpers; - service = repo.services.radicale; + service = config.facts.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 = { + services.radicale = { + enable = true; + settings = { + server.hosts = [ "${service.host}:${toString service.port}" ]; - flake.modules.nixos.radicale = - { lib, ... }: - lib.mkMerge [ - { - services.radicale = { - enable = true; - settings = { - server.hosts = [ "${service.host}:${toString service.port}" ]; - - auth = { - type = "htpasswd"; - htpasswd_filename = "/var/lib/radicale/users"; - htpasswd_encryption = "bcrypt"; - }; - - storage.filesystem_folder = "/var/lib/radicale/collections"; - }; + auth = { + type = "htpasswd"; + htpasswd_filename = "/var/lib/radicale/users"; + htpasswd_encryption = "bcrypt"; }; - } - (repoHelpers.mkCaddyReverseProxy { - inherit (service) - domain - port - ; - extraHeaders = [ - { - name = "X-Script-Name"; - value = "/"; - } - { - name = "X-Forwarded-For"; - value = "{remote}"; - } - { - name = "X-Remote-User"; - value = "{http.auth.user.id}"; - } - ]; - }) - ]; + storage.filesystem_folder = "/var/lib/radicale/collections"; + }; + }; + + services.caddy.virtualHosts.${service.domain}.extraConfig = '' + reverse_proxy :${toString service.port} { + header_up X-Script-Name / + header_up X-Forwarded-For {remote} + header_up X-Remote-User {http.auth.user.id} + } + ''; + }; } diff --git a/modules/capabilities/services/transmission.nix b/modules/capabilities/services/transmission.nix deleted file mode 100644 index d359b96..0000000 --- a/modules/capabilities/services/transmission.nix +++ /dev/null @@ -1,28 +0,0 @@ -{ config, ... }: -let - account = config.repo.account; -in -{ - flake.modules.nixos.transmission = - { config, pkgs, ... }: - { - services.transmission = { - enable = true; - package = pkgs.transmission_4; - openPeerPorts = true; - downloadDirPermissions = "775"; - - settings = { - download-dir = "${account.homeDirectory}/torrents"; - incomplete-dir = "${account.homeDirectory}/torrents/.incomplete"; - peer-port = 43864; - umask = "002"; - }; - }; - - # NOTE: Upstream bug? - systemd.services.transmission-setup.requiredBy = [ "transmission.service" ]; - - users.users.${account.name}.extraGroups = [ config.services.transmission.group ]; - }; -} diff --git a/modules/capabilities/services/vaultwarden.nix b/modules/capabilities/services/vaultwarden.nix index e600fd3..e6e143f 100644 --- a/modules/capabilities/services/vaultwarden.nix +++ b/modules/capabilities/services/vaultwarden.nix @@ -1,38 +1,21 @@ { config, ... }: let - repo = config.repo; - repoHelpers = repo.helpers; - service = repo.services.vaultwarden; + service = config.facts.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 = { + services.vaultwarden = { + enable = true; + backupDir = "/var/backup/vaultwarden"; + config = { + DOMAIN = service.url; + SIGNUPS_ALLOWED = false; + ROCKET_PORT = service.port; + ROCKET_LOG = "critical"; + }; + }; + + services.caddy.virtualHosts.${service.domain}.extraConfig = + "reverse_proxy :${toString service.port}"; }; - - flake.modules.nixos.vaultwarden = - { lib, ... }: - lib.mkMerge [ - { - services.vaultwarden = { - enable = true; - backupDir = "/var/backup/vaultwarden"; - config = { - DOMAIN = service.url; - SIGNUPS_ALLOWED = false; - ROCKET_PORT = service.port; - ROCKET_LOG = "critical"; - }; - }; - } - - (repoHelpers.mkCaddyReverseProxy { - inherit (service) - domain - port - ; - }) - ]; } diff --git a/modules/capabilities/syncthing.nix b/modules/capabilities/syncthing.nix index 116e726..e5ca8ba 100644 --- a/modules/capabilities/syncthing.nix +++ b/modules/capabilities/syncthing.nix @@ -4,28 +4,17 @@ ... }: let - syncMachines = lib.listToAttrs ( - lib.concatLists ( - lib.mapAttrsToList ( - machineName: machine: - let - syncthingId = machine.syncthingId or null; - in - lib.optional (syncthingId != null) ( - let - name = "${config.repo.account.name}@${machineName}"; - in - { - inherit name; - value = { - inherit name; - id = syncthingId; - }; - } - ) - ) config.repo.machines - ) - ); + account = config.facts.account; + syncMachines = lib.mapAttrs' ( + machineName: machine: + let + name = "${account.name}@${machineName}"; + in + lib.nameValuePair name { + inherit name; + id = machine.syncthingId; + } + ) (lib.filterAttrs (_: machine: (machine.syncthingId or null) != null) config.facts.machines); syncPhones = { "pixel-10" = { diff --git a/modules/capabilities/systemd-boot.nix b/modules/capabilities/systemd-boot.nix deleted file mode 100644 index a80f9da..0000000 --- a/modules/capabilities/systemd-boot.nix +++ /dev/null @@ -1,35 +0,0 @@ -{ ... }: -{ - flake.modules.nixos.systemd-boot = - { config, pkgs, ... }: - { - boot = { - loader = { - efi.canTouchEfiVariables = true; - systemd-boot = { - enable = true; - consoleMode = "auto"; - configurationLimit = 5; - extraInstallCommands = '' - ENTRIES="${config.boot.loader.efi.efiSysMountPoint}/loader/entries" - PROFILES="/nix/var/nix/profiles" - - for file in "$ENTRIES"/nixos-generation-*.conf; do - generation=$(${pkgs.coreutils}/bin/basename "$file" | ${pkgs.gnugrep}/bin/grep -o -E '[0-9]+') - timestamp=$(${pkgs.coreutils}/bin/stat -c %y "$PROFILES/system-$generation-link" 2>/dev/null | ${pkgs.coreutils}/bin/cut -d. -f1) - - if [ -z "$timestamp" ]; then - timestamp="Unknown Date" - fi - - ${pkgs.gnused}/bin/sed -i "s/^version .*/version Generation $generation - $timestamp/" "$file" - done - ''; - }; - }; - - tmp.cleanOnBoot = true; - kernelPackages = pkgs.linuxPackages_latest; - }; - }; -} diff --git a/modules/capabilities/terminal.nix b/modules/capabilities/terminal.nix index 7428538..8705d78 100644 --- a/modules/capabilities/terminal.nix +++ b/modules/capabilities/terminal.nix @@ -1,6 +1,6 @@ { lib, config, ... }: let - repo = config.repo; + facts = config.facts; kittySingleInstance = pkgs: @@ -10,10 +10,7 @@ let meta = pkgs.kitty.meta; buildInputs = [ pkgs.makeWrapper ]; postBuild = '' - # Wrap the binary to always launch as a single instance wrapProgram $out/bin/kitty --add-flags "-1" - - # Patch the .desktop file for strict app launchers like Vicinae rm $out/share/applications/kitty.desktop sed 's/Exec=kitty/Exec=kitty -1/g' ${pkgs.kitty}/share/applications/kitty.desktop > $out/share/applications/kitty.desktop ''; @@ -28,8 +25,7 @@ in ... }: let - repoTheme = repo.theme.kanagawa; - palette = repoTheme.palette; + palette = facts.theme.kanagawa.palette; hex = lib.removePrefix "#"; in { @@ -44,8 +40,6 @@ in font-bold-italic = "JetBrains Mono:style=Bold Italic:size=11:fontfeatures=-liga:fontfeatures=-calt"; gamma-correct-blending = "yes"; pad = "3x3"; - # vertical-letter-offset = -1; - # letter-spacing = -0.2; }; tweak.box-drawing-base-thickness = 0.1; @@ -92,13 +86,14 @@ in flake.modules.homeManager.terminal-kitty = { pkgs, ... }: let - repoTheme = repo.theme.kanagawa; - palette = repoTheme.palette; + theme = facts.theme.kanagawa; + palette = theme.palette; + kitty = kittySingleInstance pkgs; in { programs.kitty = { enable = true; - package = kittySingleInstance pkgs; + package = kitty; font = { name = "JetBrains Mono"; size = 11; @@ -116,7 +111,7 @@ in # Nerd Fonts v3.4.0 symbol_map U+e000-U+e00a,U+e0a0-U+e0a2,U+e0a3,U+e0b0-U+e0b3,U+e0b4-U+e0c8,U+e0ca,U+e0cc-U+e0d7,U+e200-U+e2a9,U+e300-U+e3e3,U+e5fa-U+e6b7,U+e700-U+e8ef,U+ea60-U+ec1e,U+ed00-U+efce,U+f000-U+f2ff,U+f300-U+f381,U+f400-U+f533,U+f0001-U+f1af0 Symbols Nerd Font Mono - ## name: ${repoTheme.displayName} + ## name: ${theme.displayName} ## license: MIT ## author: Tommaso Laurenzi ## upstream: https://github.com/rebelot/kanagawa.nvim/ @@ -165,9 +160,7 @@ in WantedBy = [ "graphical-session.target" ]; }; Service = { - # Use the wrapped package (which already includes -1) - # Start it hidden and run an infinite dummy process so the instance stays alive - ExecStart = "${lib.getExe (kittySingleInstance pkgs)} --start-as=hidden ${pkgs.coreutils}/bin/tail -f /dev/null"; + ExecStart = "${lib.getExe kitty} --start-as=hidden ${pkgs.coreutils}/bin/tail -f /dev/null"; Restart = "on-failure"; }; }; @@ -188,10 +181,13 @@ in flake.modules.homeManager.primary-terminal-kitty = { lib, pkgs, ... }: + let + kitty = kittySingleInstance pkgs; + in { imports = [ config.flake.modules.homeManager.terminal-kitty ]; - facts.desktop.terminalCommand = lib.getExe (kittySingleInstance pkgs); + facts.desktop.terminalCommand = lib.getExe kitty; xdg.terminal-exec = { enable = true; diff --git a/modules/capabilities/theme.nix b/modules/capabilities/theme.nix index d6bc79a..9818894 100644 --- a/modules/capabilities/theme.nix +++ b/modules/capabilities/theme.nix @@ -3,26 +3,23 @@ ... }: let - repo = config.repo; - repoHelpers = repo.helpers; + facts = config.facts; hmModules = config.flake.modules.homeManager; + mkCursorTheme = + pkgs: + facts.theme.cursor + // { + package = pkgs.${facts.theme.cursor.packageName}; + }; in { - repo.theme = import ./_theme.nix; - flake.modules.nixos.theme = { pkgs, ... }: let - repoTheme = repo.theme; - cursorTheme = repoTheme.cursor // { - package = repoHelpers.resolvePackagePath { - inherit pkgs; - path = repoTheme.cursor.packagePath; - }; - }; + cursorTheme = mkCursorTheme pkgs; in { home-manager.sharedModules = [ hmModules.theme ]; @@ -40,16 +37,11 @@ in flake.modules.homeManager.theme = { config, pkgs, ... }: let - repoTheme = repo.theme; - cursorTheme = repoTheme.cursor // { - package = repoHelpers.resolvePackagePath { - inherit pkgs; - path = repoTheme.cursor.packagePath; - }; - }; + theme = facts.theme; + cursorTheme = mkCursorTheme pkgs; kanagawaThemeSrc = pkgs.fetchFromGitHub { - inherit (repoTheme.kanagawa) + inherit (theme.kanagawa) hash owner repo @@ -58,7 +50,7 @@ in }; kanagawaOverride = { - version = repoTheme.kanagawa.version; + version = theme.kanagawa.version; src = kanagawaThemeSrc; }; in @@ -79,12 +71,12 @@ in "sftp://orion Orion VPS" ]; theme = { - name = repoTheme.kanagawa.gtkThemeName; + name = theme.kanagawa.gtkThemeName; package = pkgs.kanagawa-gtk-theme.overrideAttrs (_: kanagawaOverride); }; gtk4.theme = null; iconTheme = { - name = repoTheme.kanagawa.iconThemeName; + name = theme.kanagawa.iconThemeName; package = pkgs.kanagawa-icon-theme.overrideAttrs (_: kanagawaOverride); }; }; diff --git a/modules/capabilities/vicinae.nix b/modules/capabilities/vicinae.nix deleted file mode 100644 index fa2f96b..0000000 --- a/modules/capabilities/vicinae.nix +++ /dev/null @@ -1,78 +0,0 @@ -{ config, ... }: -let - repo = config.repo; -in -{ - flake.modules.homeManager.vicinae = - { - config, - pkgs, - inputs, - lib, - ... - }: - let - repoTheme = repo.theme.kanagawa; - palette = repoTheme.palette; - in - { - programs.vicinae = { - enable = true; - systemd.enable = true; - - themes.${repoTheme.name} = { - meta = { - version = 1; - name = repoTheme.displayName; - description = "A dark theme inspired by the colors of the famous painting by Katsushika Hokusai."; - variant = "dark"; - inherits = "vicinae-dark"; - }; - colors = { - core = { - background = palette.background; - foreground = palette.foreground; - secondary_background = palette.secondaryBackground; - border = palette.border; - accent = palette.accents.blue; - }; - accents = { - inherit (palette.accents) - blue - cyan - green - magenta - orange - purple - red - yellow - ; - }; - input.border_focus = "colors.core.accent"; - }; - }; - - settings.theme = { - light.name = repoTheme.name; - dark.name = repoTheme.name; - }; - - extensions = with inputs.vicinae-extensions.packages.${pkgs.stdenv.hostPlatform.system}; [ - agenda - brotab - fuzzy-files - github - it-tools - niri - nix - podman - process-manager - pulseaudio - simple-bookmarks - ssh - ]; - }; - - facts.desktop.launcherCommand = lib.getExe config.programs.vicinae.package; - }; -} diff --git a/modules/data.nix b/modules/data.nix deleted file mode 100644 index f53ebeb..0000000 --- a/modules/data.nix +++ /dev/null @@ -1,32 +0,0 @@ -{ - repo = { - account = rec { - name = "kiri"; - realName = "Jelle Spreeuwenberg"; - homeDirectory = "/home/${name}"; - nixosConfigurationPath = "${homeDirectory}/.config/nixos"; - - emails = { - personal = { - address = "mail@jelles.net"; - primary = true; - type = "mxrouting"; - }; - old = { - address = "mail@jellespreeuwenberg.nl"; - type = "mxrouting"; - }; - uni = { - address = "j.spreeuwenberg@student.tue.nl"; - type = "office365"; - }; - work = { - address = "jelle.spreeuwenberg@yookr.org"; - type = "office365"; - }; - }; - - primaryEmail = emails.personal; - }; - }; -} diff --git a/modules/facts.nix b/modules/facts.nix new file mode 100644 index 0000000..c8c7489 --- /dev/null +++ b/modules/facts.nix @@ -0,0 +1,98 @@ +{ lib, ... }: +let + factsOption = lib.mkOption { + type = lib.types.submodule { + freeformType = lib.types.attrsOf lib.types.anything; + }; + default = { }; + }; +in +{ + options.facts = factsOption; + + config = { + facts = { + account = rec { + name = "kiri"; + realName = "Jelle Spreeuwenberg"; + homeDirectory = "/home/${name}"; + nixosConfigurationPath = "${homeDirectory}/.config/nixos"; + + emails = { + personal = { + address = "mail@jelles.net"; + primary = true; + type = "mxrouting"; + }; + old = { + address = "mail@jellespreeuwenberg.nl"; + type = "mxrouting"; + }; + uni = { + address = "j.spreeuwenberg@student.tue.nl"; + type = "office365"; + }; + work = { + address = "jelle.spreeuwenberg@yookr.org"; + type = "office365"; + }; + }; + + primaryEmail = emails.personal; + }; + + 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 = import ./capabilities/_theme.nix; + }; + + flake.modules.nixos.facts = { lib, ... }: { + options.facts = factsOption; + }; + + flake.modules.homeManager.facts = + { + lib, + osConfig ? { }, + ... + }: + { + options.facts = factsOption; + + config.facts = lib.optionalAttrs (osConfig ? facts) { + inherit (osConfig.facts) + account + machine + machines + services + theme + ; + }; + }; + }; +} diff --git a/modules/flake-parts.nix b/modules/flake-parts.nix index 6a6950a..f74b646 100644 --- a/modules/flake-parts.nix +++ b/modules/flake-parts.nix @@ -3,10 +3,65 @@ config, ... }: +let + mkHost = + name: machine: + { pkgs, ... }: + let + account = config.facts.account; + hmStateVersion = machine.hmStateVersion or machine.stateVersion; + machineFacts = { + displays = { }; + portable = false; + sshKeys = { }; + syncthingId = null; + } + // machine + // { + inherit name hmStateVersion; + }; + in + { + imports = [ + config.flake.modules.nixos.${name} + ]; + + facts = { + inherit (config.facts) + account + machines + services + theme + ; + machine = machineFacts; + }; + + networking.hostName = name; + system.stateVersion = machine.stateVersion; + + programs.zsh.enable = true; + + users.users.${account.name} = { + isNormalUser = true; + home = account.homeDirectory; + extraGroups = [ + "wheel" + "networkmanager" + ]; + shell = pkgs.zsh; + }; + + home-manager.users.${account.name}.home = { + username = account.name; + homeDirectory = account.homeDirectory; + stateVersion = hmStateVersion; + }; + }; +in { imports = [ inputs.flake-parts.flakeModules.modules - ./data.nix + ./facts.nix ]; systems = [ "x86_64-linux" ]; @@ -15,9 +70,9 @@ name: machine: inputs.nixpkgs.lib.nixosSystem { specialArgs = { inherit inputs; }; - modules = [ (config.repo.helpers.mkHost name machine) ]; + modules = [ (mkHost name machine) ]; } - ) config.repo.machines; + ) config.facts.machines; perSystem = { pkgs, ... }: diff --git a/modules/hosts/orion/default.nix b/modules/hosts/orion/default.nix index 10174f8..cf06ccf 100644 --- a/modules/hosts/orion/default.nix +++ b/modules/hosts/orion/default.nix @@ -1,14 +1,10 @@ -{ - inputs, - config, - ... -}: +{ config, ... }: let nixosModules = config.flake.modules.nixos; - account = config.repo.account; + account = config.facts.account; in { - repo.machines.orion = { + facts.machines.orion = { syncthingId = "NNRNQKZ-OWPHSVA-B6KKBHE-SDYLSTV-7SVHGPR-NEWLKPL-4MWNJG4-G5FHUAI"; stateVersion = "24.05"; diff --git a/modules/hosts/polaris/default.nix b/modules/hosts/polaris/default.nix index acdca6e..37003a9 100644 --- a/modules/hosts/polaris/default.nix +++ b/modules/hosts/polaris/default.nix @@ -7,7 +7,7 @@ let nixosModules = config.flake.modules.nixos; in { - repo.machines.polaris = { + facts.machines.polaris = { sshKeys = { personal.publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEVORk45HKkX7gaGGp90KsVyUy6t+fKhbWN/grjkf3cQ kiri@polaris"; work.publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIM5DMV6EQzsscgEOE0912mNglUHTEl+LPnaWYjj0y57B kiri@polaris#work"; diff --git a/modules/hosts/zenith/default.nix b/modules/hosts/zenith/default.nix index fe5dce1..2bae6fd 100644 --- a/modules/hosts/zenith/default.nix +++ b/modules/hosts/zenith/default.nix @@ -7,7 +7,7 @@ let nixosModules = config.flake.modules.nixos; in { - repo.machines.zenith = { + facts.machines.zenith = { portable = true; sshKeys = { diff --git a/modules/lib/helpers.nix b/modules/lib/helpers.nix deleted file mode 100644 index 03a7dda..0000000 --- a/modules/lib/helpers.nix +++ /dev/null @@ -1,93 +0,0 @@ -{ lib, config, ... }: -let - nixosModules = config.flake.modules.nixos; - - resolvePackagePath = - { - pkgs, - path, - }: - lib.attrByPath path null pkgs; - - mkCaddyReverseProxy = - { - domain, - port, - extraHeaders ? [ ], - extraConfigText ? "", - }: - let - headerLines = map (header: " header_up ${header.name} ${header.value}") extraHeaders; - extraConfigLines = map (line: " ${line}") ( - lib.filter (line: line != "") (lib.splitString "\n" extraConfigText) - ); - bodyLines = headerLines ++ extraConfigLines; - body = lib.concatStringsSep "\n" bodyLines; - in - { - services.caddy.virtualHosts.${domain}.extraConfig = - if body == "" then - "reverse_proxy :${toString port}" - else - '' - reverse_proxy :${toString port} { - ${body} - } - ''; - }; - - mkHost = - 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.${name} - ]; - - facts.machine = normalizedMachine; - - networking.hostName = name; - system.stateVersion = machine.stateVersion; - - programs.zsh.enable = true; - - users.users.${account.name} = { - isNormalUser = true; - home = accountHome; - extraGroups = [ - "wheel" - "networkmanager" - ]; - shell = pkgs.zsh; - }; - - home-manager.users.${account.name} = { - home = { - username = account.name; - homeDirectory = accountHome; - stateVersion = normalizedMachine.hmStateVersion; - }; - }; - }; -in -{ - config.repo.helpers = { - inherit - mkCaddyReverseProxy - mkHost - resolvePackagePath - ; - }; -} diff --git a/modules/lib/schema.nix b/modules/lib/schema.nix deleted file mode 100644 index a5ffdf1..0000000 --- a/modules/lib/schema.nix +++ /dev/null @@ -1,33 +0,0 @@ -{ lib, ... }: -{ - options.repo = lib.mkOption { - type = lib.types.submodule { - freeformType = lib.types.attrsOf lib.types.anything; - - options.helpers = lib.mkOption { - type = lib.types.attrsOf lib.types.raw; - default = { }; - internal = true; - }; - }; - default = { }; - }; - - config.flake.modules.nixos.facts = - { lib, ... }: - { - options.facts.machine = lib.mkOption { - type = lib.types.attrsOf lib.types.anything; - default = { }; - }; - }; - - config.flake.modules.homeManager.facts = - { lib, ... }: - { - options.facts.desktop = lib.mkOption { - type = lib.types.attrsOf lib.types.anything; - default = { }; - }; - }; -} diff --git a/modules/profiles/workstation-base.nix b/modules/profiles/workstation-base.nix index c9ab255..276bf3a 100644 --- a/modules/profiles/workstation-base.nix +++ b/modules/profiles/workstation-base.nix @@ -2,7 +2,7 @@ let nixosModules = config.flake.modules.nixos; homeModules = config.flake.modules.homeManager; - account = config.repo.account; + account = config.facts.account; in { flake.modules.nixos.workstation-base = { diff --git a/modules/secrets/sops-password.nix b/modules/secrets/sops-password.nix index a31c99b..9d4160a 100644 --- a/modules/secrets/sops-password.nix +++ b/modules/secrets/sops-password.nix @@ -1,6 +1,6 @@ { config, ... }: let - account = config.repo.account; + account = config.facts.account; nixosModules = config.flake.modules.nixos; in {