about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSandro Jäckel <sandro.jaeckel@sap.com>2023-01-30 16:53:08 +0100
committerSandro Jäckel <sandro.jaeckel@sap.com>2023-02-08 15:52:38 +0100
commit1c664befd4c198db2c6993f8afde709024bcec6d (patch)
tree563e3ba9af6ee497f7bd044fa8eb8b7cc788ad79
parentd9f07dcee585db581688a72d3bcbea2b15794836 (diff)
nixos/envfs: add extraFallbackPathCommands options
this is mainly useful for restricted platforms like wsl which require
some extra entries in /bin/
-rw-r--r--nixos/modules/tasks/filesystems/envfs.nix14
1 files changed, 11 insertions, 3 deletions
diff --git a/nixos/modules/tasks/filesystems/envfs.nix b/nixos/modules/tasks/filesystems/envfs.nix
index df4ce12407bd9..76344f5f87eaf 100644
--- a/nixos/modules/tasks/filesystems/envfs.nix
+++ b/nixos/modules/tasks/filesystems/envfs.nix
@@ -7,11 +7,11 @@ let
       device = "none";
       fsType = "envfs";
       options = [
-        "fallback-path=${pkgs.runCommand "fallback-path" {} ''
+        "fallback-path=${pkgs.runCommand "fallback-path" {} (''
           mkdir -p $out
           ln -s ${config.environment.usrbinenv} $out/env
           ln -s ${config.environment.binsh} $out/sh
-        ''}"
+        '' + cfg.extraFallbackPathCommands)}"
       ];
     };
     "/bin" = {
@@ -31,11 +31,19 @@ in {
           etc.
         '';
       };
+
       package = lib.mkOption {
         type = lib.types.package;
-        description = lib.mdDoc "Which package to use for the envfs.";
         default = pkgs.envfs;
         defaultText = lib.literalExpression "pkgs.envfs";
+        description = lib.mdDoc "Which package to use for the envfs.";
+      };
+
+      extraFallbackPathCommands = lib.mkOption {
+        type = lib.types.lines;
+        default = "";
+        example = "ln -s $''{pkgs.bash}/bin/bash $out/bash";
+        description = lib.mdDoc "Extra commands to run in the package that contains fallback executables in case not other executable is found";
       };
     };
   };