upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/nix/module.nix
diff options
context:
space:
mode:
authorDanConwayDev <DanConwayDev@protonmail.com>2026-01-11 21:07:33 +0000
committerDanConwayDev <DanConwayDev@protonmail.com>2026-01-11 21:07:33 +0000
commit809982cdc78e287bc9f3fc0dbac5e2aab2fd7f7d (patch)
tree6e2663dcb1d2db77b870dbf833b9969696e63dcd /nix/module.nix
parentc89d3b6b3646b707b53146226bb7afd21cca11fa (diff)
fix(config): trim whitespace from relay-owner-nsec CLI/env input
When relay_owner_nsec is provided via CLI argument or environment variable (e.g., read from a file by the NixOS module), trim any leading/trailing whitespace including newlines. This matches the behavior when reading from the .relay-owner.nsec file directly. Fixes issue where NixOS module reads nsec file with 'cat', which includes the trailing newline, making the nsec invalid when passed as a CLI argument. Also reverted the tr workaround in nix/module.nix since ngit-grasp now handles this correctly.
Diffstat (limited to 'nix/module.nix')
-rw-r--r--nix/module.nix3
1 files changed, 1 insertions, 2 deletions
diff --git a/nix/module.nix b/nix/module.nix
index 60b8d5f..d820b67 100644
--- a/nix/module.nix
+++ b/nix/module.nix
@@ -245,8 +245,7 @@ let
245 # Command to run 245 # Command to run
246 ExecStart = if cfg.relayOwnerNsecFile != null then 246 ExecStart = if cfg.relayOwnerNsecFile != null then
247 # Use nsec from file - need to use shell to read the file 247 # Use nsec from file - need to use shell to read the file
248 # Use tr to remove trailing newline which would invalidate the nsec 248 "${pkgs.bash}/bin/bash -c '${ngit-grasp}/bin/ngit-grasp --relay-owner-nsec \"$(cat ${cfg.relayOwnerNsecFile})\"'"
249 "${pkgs.bash}/bin/bash -c '${ngit-grasp}/bin/ngit-grasp --relay-owner-nsec \"$(cat ${cfg.relayOwnerNsecFile} | tr -d \"\\n\")\"'"
250 else 249 else
251 # Let ngit-grasp auto-generate nsec in .relay-owner.nsec file in dataDir 250 # Let ngit-grasp auto-generate nsec in .relay-owner.nsec file in dataDir
252 "${ngit-grasp}/bin/ngit-grasp"; 251 "${ngit-grasp}/bin/ngit-grasp";