diff options
| author | tv <tv@krebsco.de> | 2025-06-05 17:06:34 +0200 | 
|---|---|---|
| committer | tv <tv@krebsco.de> | 2025-06-05 17:06:34 +0200 | 
| commit | 5650362c7d14412eb5b71bd63078fdec79440654 (patch) | |
| tree | 581f181b6ee4a52fca67259551d9f73c31bb2378 | |
| parent | b9cda941af87b233bccb29fbed60227c04be654b (diff) | |
variables: init
| -rw-r--r-- | configs/default.nix | 1 | ||||
| -rw-r--r-- | configs/variables.nix | 19 | 
2 files changed, 20 insertions, 0 deletions
| diff --git a/configs/default.nix b/configs/default.nix index 06fd83a..fb8627d 100644 --- a/configs/default.nix +++ b/configs/default.nix @@ -19,6 +19,7 @@      ./ssh.nix      ./sshd.nix      ./tmux.nix +    ./variables.nix      ./vim.nix      ./xdg.nix      { 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; +} | 
