summaryrefslogtreecommitdiff
path: root/nixos
diff options
context:
space:
mode:
authorMartin Fischer <martin@push-f.com>2025-08-21 06:38:52 +0200
committerMartin Fischer <martin@push-f.com>2025-08-27 17:39:11 +0200
commit565fffe39d8bc511fa0feb98a245f20295f806fd (patch)
tree44d425ea54eb86c3ec31f4129875d6492c1f7af9 /nixos
parent9996125209dbf475191be2e94771ca5bb7793d4d (diff)
refactor: pass lib and pkgs to helpers.nix
Diffstat (limited to 'nixos')
-rw-r--r--nixos/helpers.nix19
-rw-r--r--nixos/hosts/ev/torrent.nix2
-rw-r--r--nixos/hosts/tente/default.nix2
-rw-r--r--nixos/hosts/tente/git.nix2
-rw-r--r--nixos/hosts/tente/matrix.nix2
-rw-r--r--nixos/hosts/tente/web-personal.nix2
6 files changed, 11 insertions, 18 deletions
diff --git a/nixos/helpers.nix b/nixos/helpers.nix
index c6d1ff8..cadf230 100644
--- a/nixos/helpers.nix
+++ b/nixos/helpers.nix
@@ -1,8 +1,5 @@
-{ config, ... }:
+{ config, lib, pkgs, ... }:
-let
- nixpkgs = import <nixpkgs> {};
-in
{
mkNginxConfig = name: ''
access_log /var/log/nginx/${name}.access.log json;
@@ -64,7 +61,7 @@ in
'';
joinWgNamespace = ns: cfg:
- nixpkgs.lib.attrsets.recursiveUpdate cfg {
+ lib.attrsets.recursiveUpdate cfg {
bindsTo = ["netns@${ns}.service"];
after = ["wireguard-wg-${ns}.service"];
unitConfig.JoinsNamespaceOf = "netns@${ns}.service";
@@ -81,13 +78,9 @@ in
TimeoutStopSec = 300;
};
wantedBy = ["multi-user.target"];
- script =
- let
- pkgs = nixpkgs.pkgs;
- in
- ''
- ${pkgs.iproute2}/bin/ip netns exec ${ns} ${pkgs.iproute2}/bin/ip link set dev lo up
- ${pkgs.socat}/bin/socat tcp-listen:${toString port},fork,reuseaddr exec:'${pkgs.iproute2}/bin/ip netns exec ${ns} ${pkgs.socat}/bin/socat STDIO "tcp-connect:localhost:${toString port}"',nofork
- '';
+ script = ''
+ ${pkgs.iproute2}/bin/ip netns exec ${ns} ${pkgs.iproute2}/bin/ip link set dev lo up
+ ${pkgs.socat}/bin/socat tcp-listen:${toString port},fork,reuseaddr exec:'${pkgs.iproute2}/bin/ip netns exec ${ns} ${pkgs.socat}/bin/socat STDIO "tcp-connect:localhost:${toString port}"',nofork
+ '';
};
}
diff --git a/nixos/hosts/ev/torrent.nix b/nixos/hosts/ev/torrent.nix
index ddc4dcb..a09c507 100644
--- a/nixos/hosts/ev/torrent.nix
+++ b/nixos/hosts/ev/torrent.nix
@@ -1,7 +1,7 @@
{ config, lib, pkgs, ... }:
let
- helpers = import <top/helpers.nix> { inherit config; };
+ helpers = import <top/helpers.nix> { inherit config lib pkgs; };
cfg = config.torrent;
in
{
diff --git a/nixos/hosts/tente/default.nix b/nixos/hosts/tente/default.nix
index 23e94bc..ac8f438 100644
--- a/nixos/hosts/tente/default.nix
+++ b/nixos/hosts/tente/default.nix
@@ -8,7 +8,7 @@ let
baseDomain = "push-f.com";
acmeEmail = "martin@push-f.com";
sources = import <top/npins>;
- helpers = import <top/helpers.nix> { inherit config; };
+ helpers = import <top/helpers.nix> { inherit config lib pkgs; };
in
{
imports = [
diff --git a/nixos/hosts/tente/git.nix b/nixos/hosts/tente/git.nix
index ee10a43..c5c6478 100644
--- a/nixos/hosts/tente/git.nix
+++ b/nixos/hosts/tente/git.nix
@@ -2,7 +2,7 @@
let
cfg = config.git;
- helpers = import <top/helpers.nix> { inherit config; };
+ helpers = import <top/helpers.nix> { inherit config lib pkgs; };
in
{
options.git = {
diff --git a/nixos/hosts/tente/matrix.nix b/nixos/hosts/tente/matrix.nix
index cf0f09a..2eb8673 100644
--- a/nixos/hosts/tente/matrix.nix
+++ b/nixos/hosts/tente/matrix.nix
@@ -2,7 +2,7 @@
let
cfg = config.matrix;
- helpers = import <top/helpers.nix> { inherit config; };
+ helpers = import <top/helpers.nix> { inherit config lib pkgs; };
in
{
options.matrix = {
diff --git a/nixos/hosts/tente/web-personal.nix b/nixos/hosts/tente/web-personal.nix
index 109a87d..d706b9d 100644
--- a/nixos/hosts/tente/web-personal.nix
+++ b/nixos/hosts/tente/web-personal.nix
@@ -2,7 +2,7 @@
let
cfg = config.web-personal;
- helpers = import <top/helpers.nix> { inherit config; };
+ helpers = import <top/helpers.nix> { inherit config lib pkgs; };
in
{
options.web-personal = {