Merge pull request 'Migrate trusted-nix-caches to clanServices' (#3949) from migrate-nix-caches into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/3949
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
---
|
||||
description = "This module sets the `clan.lol` and `nix-community` cache up as a trusted cache."
|
||||
----
|
||||
categories = ["System", "Network"]
|
||||
features = [ "deprecated" ]
|
||||
---
|
||||
|
||||
15
clanServices/trusted-nix-caches/README.md
Normal file
15
clanServices/trusted-nix-caches/README.md
Normal file
@@ -0,0 +1,15 @@
|
||||
Sets up nix to trust and use the clan cache
|
||||
|
||||
## Usage
|
||||
|
||||
```nix
|
||||
inventory.instances = {
|
||||
clan-cache = {
|
||||
module = {
|
||||
name = "trusted-nix-caches";
|
||||
input = "clan";
|
||||
};
|
||||
roles.default.machines.draper = { };
|
||||
};
|
||||
}
|
||||
```
|
||||
27
clanServices/trusted-nix-caches/default.nix
Normal file
27
clanServices/trusted-nix-caches/default.nix
Normal file
@@ -0,0 +1,27 @@
|
||||
{ ... }:
|
||||
{
|
||||
_class = "clan.service";
|
||||
manifest.name = "clan-core/trusted-nix-caches";
|
||||
manifest.description = "This module sets the `clan.lol` and `nix-community` cache up as a trusted cache.";
|
||||
manifest.categories = [ "System" ];
|
||||
|
||||
roles.default = {
|
||||
|
||||
perInstance =
|
||||
{ ... }:
|
||||
{
|
||||
nixosModule =
|
||||
{ ... }:
|
||||
{
|
||||
nix.settings.trusted-substituters = [
|
||||
"https://cache.clan.lol"
|
||||
"https://nix-community.cachix.org"
|
||||
];
|
||||
nix.settings.trusted-public-keys = [
|
||||
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
|
||||
"cache.clan.lol-1:3KztgSAB5R1M+Dz7vzkBGzXdodizbgLXGXKXlcQLA28="
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
17
clanServices/trusted-nix-caches/flake-module.nix
Normal file
17
clanServices/trusted-nix-caches/flake-module.nix
Normal file
@@ -0,0 +1,17 @@
|
||||
{ lib, self, ... }:
|
||||
{
|
||||
clan.modules = {
|
||||
trusted-nix-caches = lib.modules.importApply ./default.nix { };
|
||||
};
|
||||
perSystem =
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
checks = lib.optionalAttrs (pkgs.stdenv.isLinux) {
|
||||
trusted-nix-caches = import ./tests/vm/default.nix {
|
||||
inherit pkgs;
|
||||
clan-core = self;
|
||||
nixosLib = import (self.inputs.nixpkgs + "/nixos/lib") { };
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
40
clanServices/trusted-nix-caches/tests/vm/default.nix
Normal file
40
clanServices/trusted-nix-caches/tests/vm/default.nix
Normal file
@@ -0,0 +1,40 @@
|
||||
{
|
||||
pkgs,
|
||||
nixosLib,
|
||||
clan-core,
|
||||
...
|
||||
}:
|
||||
nixosLib.runTest (
|
||||
{ ... }:
|
||||
{
|
||||
imports = [
|
||||
clan-core.modules.nixosVmTest.clanTest
|
||||
];
|
||||
|
||||
hostPkgs = pkgs;
|
||||
|
||||
name = "trusted-nix-caches";
|
||||
|
||||
clan = {
|
||||
directory = ./.;
|
||||
modules."@clan/trusted-nix-caches" = ../../default.nix;
|
||||
inventory = {
|
||||
machines.server = { };
|
||||
|
||||
instances = {
|
||||
trusted-nix-caches = {
|
||||
module.name = "@clan/trusted-nix-caches";
|
||||
roles.default.machines."server" = { };
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
nodes.server = { };
|
||||
|
||||
testScript = ''
|
||||
start_all()
|
||||
server.succeed("grep -q 'cache.clan.lol' /etc/nix/nix.conf")
|
||||
'';
|
||||
}
|
||||
)
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"publickey": "age1qm0p4vf9jvcnn43s6l4prk8zn6cx0ep9gzvevxecv729xz540v8qa742eg",
|
||||
"type": "age"
|
||||
}
|
||||
@@ -94,6 +94,7 @@ nav:
|
||||
- reference/clanServices/localsend.md
|
||||
- reference/clanServices/mycelium.md
|
||||
- reference/clanServices/sshd.md
|
||||
- reference/clanServices/trusted-nix-caches.md
|
||||
- reference/clanServices/users.md
|
||||
- reference/clanServices/hello-world.md
|
||||
- reference/clanServices/wifi.md
|
||||
|
||||
Reference in New Issue
Block a user