diff options
author | Janik H. <janik@aq0.de> | 2024-03-09 18:35:53 +0100 |
---|---|---|
committer | Janik H. <janik@aq0.de> | 2024-03-18 22:53:21 +0100 |
commit | 9ec0e31f79d676288278a92c105f11121f694d01 (patch) | |
tree | b6c6054409517567340d3ce131196eea3c59ddf6 /nixos | |
parent | 8e474340ed0592ca21c1398d88dd89bf7100e881 (diff) | |
download | nixlib-9ec0e31f79d676288278a92c105f11121f694d01.tar nixlib-9ec0e31f79d676288278a92c105f11121f694d01.tar.gz nixlib-9ec0e31f79d676288278a92c105f11121f694d01.tar.bz2 nixlib-9ec0e31f79d676288278a92c105f11121f694d01.tar.lz nixlib-9ec0e31f79d676288278a92c105f11121f694d01.tar.xz nixlib-9ec0e31f79d676288278a92c105f11121f694d01.tar.zst nixlib-9ec0e31f79d676288278a92c105f11121f694d01.zip |
nixos/garage: add env-var wrapper for admin cli
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/modules/services/web-servers/garage.nix | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/nixos/modules/services/web-servers/garage.nix b/nixos/modules/services/web-servers/garage.nix index 48dd5b34757c..616be978b6e5 100644 --- a/nixos/modules/services/web-servers/garage.nix +++ b/nixos/modules/services/web-servers/garage.nix @@ -75,7 +75,19 @@ in source = configFile; }; - environment.systemPackages = [ cfg.package ]; # For administration + # For administration + environment.systemPackages = [ + (pkgs.writeScriptBin "garage" '' + # make it so all future variables set are automatically exported as environment variables + set -a + + # source the set environmentFile (since systemd EnvironmentFile is supposed to be a minor subset of posix sh parsing) (with shell arg escaping to avoid quoting issues) + [ -f ${lib.escapeShellArg cfg.environmentFile} ] && . ${lib.escapeShellArg cfg.environmentFile} + + # exec the program with quoted args (also with shell arg escaping for the program path to avoid quoting issues there) + exec ${lib.escapeShellArg (lib.getExe cfg.package)} "$@" + '') + ]; systemd.services.garage = { description = "Garage Object Storage (S3 compatible)"; |