chore(ops): move nixos-tvix-cache to ops/machines
Change-Id: Id112f4e9ef195f9366a11f7b0dce326e7951fb49 Reviewed-on: https://cl.snix.dev/c/snix/+/30142 Tested-by: besadii Reviewed-by: Ryan Lahfa <masterancpp@gmail.com> Autosubmit: Florian Klink <flokli@flokli.de>
This commit is contained in:
parent
9caae9114e
commit
c3de9e21eb
10 changed files with 9 additions and 17 deletions
76
ops/machines/snix-cache/nar-bridge-module.nix
Normal file
76
ops/machines/snix-cache/nar-bridge-module.nix
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
{ config
|
||||
, lib
|
||||
, utils
|
||||
, pkgs
|
||||
, depot
|
||||
, ...
|
||||
}:
|
||||
let
|
||||
cfg = config.services.nar-bridge;
|
||||
|
||||
package = depot.snix.nar-bridge.override (old: {
|
||||
features = old.features or [ "default" ] ++ [ "xp-store-composition-cli" ];
|
||||
runTests = true;
|
||||
});
|
||||
|
||||
storeCompositionFormat = pkgs.formats.toml { };
|
||||
|
||||
storeCompositionFile = storeCompositionFormat.generate "store-composition.toml" cfg.settings;
|
||||
|
||||
args = [
|
||||
"--listen-address"
|
||||
"sd-listen"
|
||||
"--experimental-store-composition"
|
||||
storeCompositionFile
|
||||
];
|
||||
in
|
||||
{
|
||||
options = {
|
||||
services.nar-bridge = {
|
||||
enable = lib.mkEnableOption "nar-bridge service";
|
||||
|
||||
settings = lib.mkOption {
|
||||
type = storeCompositionFormat.type;
|
||||
default = { };
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
users.users.nar-bridge = {
|
||||
isSystemUser = true;
|
||||
group = "nar-bridge";
|
||||
};
|
||||
|
||||
users.groups.nar-bridge = { };
|
||||
|
||||
systemd.sockets.nar-bridge = {
|
||||
description = "nar-bridge socket";
|
||||
wantedBy = [ "sockets.target" ];
|
||||
|
||||
socketConfig = {
|
||||
LimitNOFILE = 65535;
|
||||
ListenStream = "/run/nar-bridge.sock";
|
||||
SocketMode = "0666";
|
||||
SocketUser = "root";
|
||||
};
|
||||
};
|
||||
|
||||
systemd.services.nar-bridge = {
|
||||
description = "NAR Bridge";
|
||||
requires = [ "nar-bridge.socket" ];
|
||||
after = [ "nar-bridge.socket" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
serviceConfig = {
|
||||
ExecStart = "${package}/bin/nar-bridge ${utils.escapeSystemdExecArgs args}";
|
||||
|
||||
Restart = "always";
|
||||
RestartSec = "10";
|
||||
|
||||
User = "nar-bridge";
|
||||
Group = "nar-bridge";
|
||||
StateDirectory = "nar-bridge";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue