Skip to content

Commit 1448afa

Browse files
jim3692IceDBorn
authored andcommitted
feat(cache): implement nixos substituter (#62)
1 parent f8b5b8f commit 1448afa

3 files changed

Lines changed: 25 additions & 1 deletion

File tree

flake.nix

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
{
22
inputs = {
3+
cache-server = {
4+
flake = false;
5+
url = "github:icedos/cache-server";
6+
};
7+
38
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
49
};
510

modules/cache.nix

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{ config, lib, ... }:
2+
3+
let
4+
inherit (lib) mkIf;
5+
inherit (config.icedos.system.cache) enable key url priority;
6+
in
7+
{
8+
nix.settings = mkIf enable {
9+
substituters = [ "${url}?priority=${toString priority}" ];
10+
trusted-public-keys = [ key ];
11+
};
12+
}

modules/options.nix

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
}:
77

88
let
9-
inherit (lib) types;
9+
inherit (lib) readFile types;
1010

1111
inherit (icedosLib)
1212
mkBoolOption
@@ -90,6 +90,13 @@ in
9090
resolution = mkStrOption { default = "1920x1080"; };
9191
};
9292

93+
cache = {
94+
enable = mkBoolOption { default = true; };
95+
url = mkStrOption { default = "https://icedos.mirrors.knp.one"; };
96+
key = mkStrOption { default = readFile "${inputs.icedos-core.inputs.cache-server}/nix-public.pem"; };
97+
priority = mkNumberOption { default = 100; };
98+
};
99+
93100
channels = mkSubmoduleListOption { default = [ ]; } {
94101
name = mkStrOption { };
95102
url = mkStrOption { };

0 commit comments

Comments
 (0)