summary refs log tree commit diff
diff options
context:
space:
mode:
authorMaximilian Bosch <maximilian@mbosch.me>2019-05-12 03:20:44 +0200
committerMaximilian Bosch <maximilian@mbosch.me>2019-05-12 03:20:44 +0200
commit775146165d0161210414566e28e18e3ac021f036 (patch)
treed78d4e72b3427f4e45726dc469b2567c226d6321
parent7fef2e38eab89caad8e9be93079a3fd51cf479f8 (diff)
downloadnixpkgs-775146165d0161210414566e28e18e3ac021f036.tar
nixpkgs-775146165d0161210414566e28e18e3ac021f036.tar.gz
nixpkgs-775146165d0161210414566e28e18e3ac021f036.tar.bz2
nixpkgs-775146165d0161210414566e28e18e3ac021f036.tar.lz
nixpkgs-775146165d0161210414566e28e18e3ac021f036.tar.xz
nixpkgs-775146165d0161210414566e28e18e3ac021f036.tar.zst
nixpkgs-775146165d0161210414566e28e18e3ac021f036.zip
nixos/xss-lock: improve module
* Don't use `literalExample`, raw Nix values can directly be specified
  as an option example which provides support for highlighting in the
  manual as well.

* Escape shell args for `extraOptions`: I.e. the `-n` option might be
  problematic as a longer notification command might be misinterpreted.
-rw-r--r--nixos/modules/programs/xss-lock.nix4
1 files changed, 2 insertions, 2 deletions
diff --git a/nixos/modules/programs/xss-lock.nix b/nixos/modules/programs/xss-lock.nix
index 24aed58cd2a..070463311db 100644
--- a/nixos/modules/programs/xss-lock.nix
+++ b/nixos/modules/programs/xss-lock.nix
@@ -18,7 +18,7 @@ in
 
     extraOptions = mkOption {
       default = [ ];
-      example = literalExample [ "--ignore-sleep" ];
+      example = [ "--ignore-sleep" ];
       type = types.listOf types.str;
       description = ''
         Additional command-line arguments to pass to
@@ -35,7 +35,7 @@ in
       serviceConfig.ExecStart = with lib;
         strings.concatStringsSep " " ([
             "${pkgs.xss-lock}/bin/xss-lock"
-          ] ++ cfg.extraOptions ++ [
+          ] ++ (map escapeShellArg cfg.extraOptions) ++ [
             "--"
             cfg.lockerCommand
         ]);