summaryrefslogtreecommitdiffstats
path: root/configs/variables.nix
diff options
context:
space:
mode:
Diffstat (limited to 'configs/variables.nix')
-rw-r--r--configs/variables.nix19
1 files changed, 19 insertions, 0 deletions
diff --git a/configs/variables.nix b/configs/variables.nix
new file mode 100644
index 0000000..cdfaceb
--- /dev/null
+++ b/configs/variables.nix
@@ -0,0 +1,19 @@
+{ config, lib, ... }: {
+ options.hrm.environment.variables = lib.mkOption {
+ type = lib.types.attrsOf lib.types.str;
+ default = {};
+ description = ''
+ This is a stricter version of `environment.variables`, using
+ `escapeShellArg` instead of `"` for quoting.
+
+ Use this when you don't have the need to reference other variables or
+ inject code into `/nix/store/*-set-environment`. This is also useful
+ for variables that need be used in contexts that don't perform shell
+ initialization, like e.g. `systemd.services.*.environment`;
+ '';
+ };
+ config.environment.variables =
+ lib.mapAttrs
+ (_name: value: ''"${lib.escapeShellArg value}"'')
+ config.hrm.environment.variables;
+}