diff --git a/flake.lock b/flake.lock index 658ff11..cdfdef7 100644 --- a/flake.lock +++ b/flake.lock @@ -131,11 +131,11 @@ ] }, "locked": { - "lastModified": 1691856649, - "narHash": "sha256-1/KYCwNyOPpUoyno9Yj3zMHITQaW+wPzVlJFPOPPCo4=", + "lastModified": 1692260837, + "narHash": "sha256-2FpkX1zl+7ni7djK7NeE1ZGupRUwZgjW+RPCSBgDf4k=", "owner": "nix-community", "repo": "home-manager", - "rev": "406d34d919e9e8b831b531782cf5ef6995188566", + "rev": "6a94c1a59737783c282c4031555a289c28b961e4", "type": "github" }, "original": { @@ -147,11 +147,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1691654369, - "narHash": "sha256-gSILTEx1jRaJjwZxRlnu3ZwMn1FVNk80qlwiCX8kmpo=", + "lastModified": 1692356644, + "narHash": "sha256-AYkPFT+CbCVSBmh0WwIzPpwhEJ4Yy3A7JZvUkGJIg5o=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "ce5e4a6ef2e59d89a971bc434ca8ca222b9c7f5e", + "rev": "8ecc900b2f695d74dea35a92f8a9f9b32c8ea33d", "type": "github" }, "original": { @@ -163,11 +163,11 @@ }, "nur": { "locked": { - "lastModified": 1691871985, - "narHash": "sha256-xSuUcMfHQO/GlZsGXHcJpi/22XsrRmw99usQx53bdCw=", + "lastModified": 1692437027, + "narHash": "sha256-gWtVFoPw7HhbKGLp7vupVbCNAvNMQS5+2PujOt2QbRk=", "owner": "nix-community", "repo": "NUR", - "rev": "107240729dc0fdd4afa1728aaa03d1df0d70a2e8", + "rev": "b47c7b8d313f9739a7fbb572413c959a362c244a", "type": "github" }, "original": { @@ -192,11 +192,11 @@ ] }, "locked": { - "lastModified": 1691747570, - "narHash": "sha256-J3fnIwJtHVQ0tK2JMBv4oAmII+1mCdXdpeCxtIsrL2A=", + "lastModified": 1692274144, + "narHash": "sha256-BxTQuRUANQ81u8DJznQyPmRsg63t4Yc+0kcyq6OLz8s=", "owner": "cachix", "repo": "pre-commit-hooks.nix", - "rev": "c5ac3aa3324bd8aebe8622a3fc92eeb3975d317a", + "rev": "7e3517c03d46159fdbf8c0e5c97f82d5d4b0c8fa", "type": "github" }, "original": { diff --git a/hosts/nixos/porthos/secrets/nix-serve/cache-key.age b/hosts/nixos/porthos/secrets/nix-cache/cache-key.age similarity index 100% rename from hosts/nixos/porthos/secrets/nix-serve/cache-key.age rename to hosts/nixos/porthos/secrets/nix-cache/cache-key.age diff --git a/hosts/nixos/porthos/secrets/secrets.nix b/hosts/nixos/porthos/secrets/secrets.nix index 498aebf..8eac0f5 100644 --- a/hosts/nixos/porthos/secrets/secrets.nix +++ b/hosts/nixos/porthos/secrets/secrets.nix @@ -52,7 +52,7 @@ in publicKeys = all; }; - "nix-serve/cache-key.age".publicKeys = all; + "nix-cache/cache-key.age".publicKeys = all; "paperless/password.age".publicKeys = all; "paperless/secret-key.age".publicKeys = all; diff --git a/hosts/nixos/porthos/services.nix b/hosts/nixos/porthos/services.nix index 7653eb5..a4bf485 100644 --- a/hosts/nixos/porthos/services.nix +++ b/hosts/nixos/porthos/services.nix @@ -93,9 +93,9 @@ in enable = true; passwordFile = secrets."nextcloud/password".path; }; - nix-serve = { + nix-cache = { enable = true; - secretKeyFile = secrets."nix-serve/cache-key".path; + secretKeyFile = secrets."nix-cache/cache-key".path; }; nginx = { enable = true; diff --git a/modules/services/default.nix b/modules/services/default.nix index 86badf5..b27570d 100644 --- a/modules/services/default.nix +++ b/modules/services/default.nix @@ -20,7 +20,7 @@ ./navidrome ./nextcloud ./nginx - ./nix-serve + ./nix-cache ./paperless ./pirate ./podgrab diff --git a/modules/services/nix-serve/default.nix b/modules/services/nix-cache/default.nix similarity index 61% rename from modules/services/nix-serve/default.nix rename to modules/services/nix-cache/default.nix index 0cf1573..b3bdbf3 100644 --- a/modules/services/nix-serve/default.nix +++ b/modules/services/nix-cache/default.nix @@ -1,11 +1,11 @@ -# Binary cache through nix-serve -{ config, lib, pkgs, ... }: +# Binary cache +{ config, lib, ... }: let - cfg = config.my.services.nix-serve; + cfg = config.my.services.nix-cache; in { - options.my.services.nix-serve = with lib; { - enable = mkEnableOption "nix-serve binary cache"; + options.my.services.nix-cache = with lib; { + enable = mkEnableOption "nix binary cache"; port = mkOption { type = types.port; @@ -16,7 +16,7 @@ in secretKeyFile = mkOption { type = types.str; - example = "/run/secrets/nix-serve"; + example = "/run/secrets/nix-cache"; description = "Secret signing key for the cache"; }; @@ -32,19 +32,15 @@ in }; config = lib.mkIf cfg.enable { - services.nix-serve = { + services.harmonia = { enable = true; - bindAddress = "127.0.0.1"; + settings = { + bind = "127.0.0.1:${toString cfg.port}"; + inherit (cfg) priority; + }; - inherit (cfg) - port - secretKeyFile - ; - - package = pkgs.nix-serve-ng; - - extraParams = "--priority=${toString cfg.priority}"; + signKeyPath = cfg.secretKeyFile; }; my.services.nginx.virtualHosts = [