main
 1{
 2  inputs,
 3  den,
 4  lib,
 5  ...
 6}: {
 7  flake-file.inputs.ncro = {
 8    url = "github:manic-systems/ncro";
 9    inputs.nixpkgs.follows = "nixpkgs";
10  };
11
12  den.aspects.core.nix.includes = [den.aspects.core.nix.substituters];
13  den.aspects.core.nix.substituters = {
14    cache = {
15      directories = [
16        {
17          directory = "/var/lib/private/ncro";
18          user = "nobody";
19          group = "nogroup";
20          mode = "0700";
21        }
22      ];
23    };
24
25    nixos = {config, ...}: {
26      imports = [inputs.ncro.nixosModules.ncro];
27
28      nix.settings = {
29        substituters = lib.mkForce ["http://${config.services.ncro.settings.server.listen}"];
30        trusted-public-keys = [
31        ];
32      };
33
34      services.ncro = {
35        enable = true;
36        settings = {
37          server = {
38            listen = "localhost:9000";
39            read_timeout = "30s";
40            write_timeout = "30s";
41          };
42          cache = {
43            db_path = "/var/lib/ncro/routes.db";
44          };
45          upstreams = [
46            {
47              url = "https://cache.nixos.org";
48              priority = 15;
49              public_key = "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=";
50            }
51            {
52              url = "https://nix-community.cachix.org";
53              priority = 20;
54              public_key = "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=";
55            }
56            {
57              url = "https://mirrors.ustc.edu.cn/nix-channels/store";
58              priority = 10;
59            }
60            {
61              url = "https://mirrors.tuna.tsinghua.edu.cn/nix-channels/store";
62              priority = 10;
63            }
64            {
65              url = "https://cache.flox.dev";
66              priority = 30;
67              public_key = "flox-cache-public-1:7F4OyH7ZCnFhcze3fJdfyXYLQw/aV7GEed86nQ7IsOs=";
68            }
69          ];
70        };
71      };
72    };
73  };
74}