Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pull in improvements from Misterio77 #1

Merged
merged 2 commits into from
Oct 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
description = "Peer2Peer Nix-Binary-Cache";

outputs = { self }: {
nixosModules.peerix = import ./module.nix;
};
}
19 changes: 14 additions & 5 deletions module.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,23 @@ in
type = types.nullOr types.path;
default = null;
description = ''
The private key to sign the derivations with.
File containing the private key to sign the derivations with.
'';
};

publicKeyFile = lib.mkOption {
type = types.nullOr types.path;
default = null;
description = ''
The private key to sign the derivations with.
File containing the public key to sign the derivations with.
'';
};

publicKey = lib.mkOption {
type = types.nullOr types.path;
default = null;
description = ''
The public key to sign the derivations with.
'';
};

Expand Down Expand Up @@ -132,9 +140,10 @@ in
binaryCaches = [
"http://127.0.0.1:12304/"
];
binaryCachePublicKeys = lib.mkIf (cfg.publicKeyFile != null) [
(builtins.readFile cfg.publicKeyFile)
];
binaryCachePublicKeys = [
lib.mkIf (cfg.publicKeyFile != null) (builtins.readFile cfg.publicKeyFile)
lib.mkIf (cfg.publicKey != null) cfg.publicKey
];

extraOptions = lib.mkIf (cfg.globalCacheTTL != null) ''
narinfo-cache-negative-ttl = ${toString cfg.globalCacheTTL}
Expand Down