From 32e41ddcd9cb33a23c1e89eae265fa0684404768 Mon Sep 17 00:00:00 2001 From: Max Date: Sat, 16 Oct 2021 20:24:25 +0200 Subject: [PATCH] VEGAS: add nar-serve --- flake.lock | 37 ++++++++++++++++++++++++++ flake.nix | 3 +++ hosts/VEGAS/services/nix/nar-serve.nix | 13 +++++++++ hosts/VEGAS/system.nix | 1 + 4 files changed, 54 insertions(+) create mode 100644 hosts/VEGAS/services/nix/nar-serve.nix diff --git a/flake.lock b/flake.lock index e2fb490..54ad490 100644 --- a/flake.lock +++ b/flake.lock @@ -58,6 +58,21 @@ "type": "github" } }, + "flake-utils": { + "locked": { + "lastModified": 1623875721, + "narHash": "sha256-A8BU7bjS5GirpAUv4QA+QnJ4CceLHkcXdRp4xITDB0s=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "f7e004a55b120c02ecb6219596820fcd32ca8772", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "home-manager": { "inputs": { "nixpkgs": [ @@ -116,6 +131,27 @@ "type": "github" } }, + "nar-serve": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1626443268, + "narHash": "sha256-LAsxgaWKTxOVZVpNrUG9ZrHMnzNMKKxKciVitxdgylE=", + "owner": "numtide", + "repo": "nar-serve", + "rev": "84a77d8ab3ddec9d8090d2f0bc6718484e2d94ea", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "nar-serve", + "type": "github" + } + }, "nix-super": { "inputs": { "nix": [ @@ -179,6 +215,7 @@ "deploy-rs": "deploy-rs", "home-manager": "home-manager", "naersk": "naersk", + "nar-serve": "nar-serve", "nix-super": "nix-super", "nix-super-unstable-repin": "nix-super-unstable-repin", "nixpkgs": "nixpkgs" diff --git a/flake.nix b/flake.nix index 66df5a6..148080b 100644 --- a/flake.nix +++ b/flake.nix @@ -23,6 +23,9 @@ agenix.url = "github:ryantm/agenix"; agenix.inputs.nixpkgs.follows = "nixpkgs"; + + nar-serve.url = "github:numtide/nar-serve"; + nar-serve.inputs.nixpkgs.follows = "nixpkgs"; }; outputs = { self, nixpkgs, home-manager, ... }@inputs: let diff --git a/hosts/VEGAS/services/nix/nar-serve.nix b/hosts/VEGAS/services/nix/nar-serve.nix new file mode 100644 index 0000000..f7a21ea --- /dev/null +++ b/hosts/VEGAS/services/nix/nar-serve.nix @@ -0,0 +1,13 @@ +{ inputs, pkgs, tools, ... }: + +{ + systemd.services.nar-serve = { + enable = true; + serviceConfig = { + DynamicUser = true; + User = "nar-serve"; + }; + script = "${inputs.nar-serve.defaultPackage."${pkgs.system}"}/bin/nar-serve"; + environment.NAR_CACHE_URL = "https://cache.${tools.meta.domain}"; + }; +} diff --git a/hosts/VEGAS/system.nix b/hosts/VEGAS/system.nix index 56e0acd..caed3dc 100644 --- a/hosts/VEGAS/system.nix +++ b/hosts/VEGAS/system.nix @@ -30,6 +30,7 @@ ./services/mail ./services/matrix ./services/nix/binary-cache.nix + ./services/nix/nar-serve.nix ./services/object-storage ./services/warehouse ./services/websites