Files
nixos/modules/services/harmonia/default.nix
2025-12-07 13:30:16 +08:00

42 lines
1.4 KiB
Nix

inputs:
{
options.nixos.services.harmonia = let inherit (inputs.lib) mkOption types; in mkOption
{
type = types.nullOr (types.submodule { options =
{
hostname = mkOption { type = types.nonEmptyStr; default = "nix-store.chn.moe"; };
store = mkOption { type = types.nullOr types.nonEmptyStr; default = null; };
};});
default = null;
};
config = let inherit (inputs.config.nixos.services) harmonia; in inputs.lib.mkIf (harmonia != null)
{
services.harmonia-dev =
{
package = inputs.options.services.harmonia-dev.package.default.overrideAttrs
(prev: { patches = prev.patches or [] ++ [ ./harmonia.patch ]; });
cache =
{
enable = true;
signKeyPaths = [ inputs.config.nixos.system.sops.secrets."store/signingKey".path ];
settings = inputs.lib.mkIf (harmonia.store != null)
{
virtual_nix_store = "/nix/store";
real_nix_store = "${harmonia.store}/nix/store";
daemon_store = "/nix/store";
};
};
daemon =
{
enable = true;
dbPath = inputs.lib.mkIf (harmonia.store != null) "${harmonia.store}/nix/var/nix/db/db.sqlite";
};
};
nixos =
{
system.sops.secrets."store/signingKey" = {};
services.nginx.https.${harmonia.hostname}.location."/".proxy.upstream = "http://127.0.0.1:5000";
};
};
}