From 2330fe3104a212052095fb8f20ca4f4797404ce8 Mon Sep 17 00:00:00 2001
From: matt1432 <matt@nelim.org>
Date: Tue, 9 Jan 2024 13:28:14 -0500
Subject: [PATCH] fix: put empty string if doesn't have secrets

---
 common/modules/global.nix | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/common/modules/global.nix b/common/modules/global.nix
index c222bf6e..822b7218 100644
--- a/common/modules/global.nix
+++ b/common/modules/global.nix
@@ -4,14 +4,17 @@
   nixpkgs,
   ...
 }:
-with lib; {
+with lib; let
+  inherit (config.sops.secrets) access-token;
+in {
   # Minimize dowloads of indirect nixpkgs flakes
   nix = {
     registry.nixpkgs.flake = nixpkgs;
     nixPath = ["nixpkgs=${nixpkgs}"];
-    extraOptions = optionalAttrs (hasAttr "sops" config) ''
-      !include ${config.sops.secrets.access-token.path}
-    '';
+    extraOptions =
+      if (hasAttr "sops" config)
+      then "!include ${access-token.path}"
+      else "";
   };
 
   # Global hm settings