From 3f57cd9aa6f1df34d824b46079096248c44e4a91 Mon Sep 17 00:00:00 2001 From: Max Date: Sat, 5 Feb 2022 19:09:02 +0100 Subject: [PATCH] modules: extract hyprspace module --- hosts/VEGAS/system.nix | 2 +- modules/default.nix | 1 + {hosts/VEGAS/services => modules}/hyprspace/default.nix | 6 +++--- 3 files changed, 5 insertions(+), 4 deletions(-) rename {hosts/VEGAS/services => modules}/hyprspace/default.nix (92%) diff --git a/hosts/VEGAS/system.nix b/hosts/VEGAS/system.nix index 264a786..7270205 100644 --- a/hosts/VEGAS/system.nix +++ b/hosts/VEGAS/system.nix @@ -24,7 +24,6 @@ ./services/fbi ./services/gitlab ./services/hydra - ./services/hyprspace ./services/ipfs ./services/jokes ./services/nextcloud @@ -41,6 +40,7 @@ ./services/vault ./services/warehouse ./services/websites + aspect.modules.hyprspace ] # TODO: fix users # ++ (import ../../users "server").groups.admin diff --git a/modules/default.nix b/modules/default.nix index b98c04d..1785ca4 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -7,6 +7,7 @@ let enterprise = import ./enterprise; fail2ban = import ./fail2ban; hydra = import ./hydra; + hyprspace = import ./hyprspace; ipfs = import ./ipfs; nix-builder = import ./nix-builder; nix-config = import ./nix-config; diff --git a/hosts/VEGAS/services/hyprspace/default.nix b/modules/hyprspace/default.nix similarity index 92% rename from hosts/VEGAS/services/hyprspace/default.nix rename to modules/hyprspace/default.nix index ae42f73..785fba7 100644 --- a/hosts/VEGAS/services/hyprspace/default.nix +++ b/modules/hyprspace/default.nix @@ -1,7 +1,7 @@ { pkgs, inputs, lib, hosts, config, ... }: let inherit (config.networking) hostName; - inherit (inputs.self.packages.x86_64-linux) hyprspace; + inherit (inputs.self.packages.${pkgs.system}) hyprspace; hyprspaceCapableNodes = lib.filterAttrs (_: host: host ? hypr) hosts; peersFormatted = builtins.mapAttrs (_: x: { "${x.hypr.addr}".id = x.hypr.id; }) hyprspaceCapableNodes; peersFiltered = lib.filterAttrs (name: _: name != hostName) peersFormatted; @@ -25,7 +25,7 @@ let in { networking.hosts = lib.mapAttrs' (k: v: lib.nameValuePair (v.hypr.addr) ([k "${k}.hypr"])) hyprspaceCapableNodes; age.secrets.hyprspace-key = { - file = ../../../../secrets/hyprspace-key- + "${hostName}.age"; + file = ../../secrets/hyprspace-key- + "${hostName}.age"; mode = "0400"; }; systemd.services.hyprspace = { @@ -44,7 +44,7 @@ in { chmod 0400 ${runConfig} ''; - path = [ pkgs.iproute2 ]; + environment.HYPRSPACE_SWARM_KEY = config.age.secrets.ipfs-swarm-key.path; serviceConfig = { ExecStart = "${hyprspace}/bin/hyprspace up hyprspace -f -c ${runConfig}"; ExecStop = "${hyprspace}/bin/hyprspace down hyprspace";