From d9f07dcee585db581688a72d3bcbea2b15794836 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20J=C3=A4ckel?= Date: Mon, 30 Jan 2023 16:52:43 +0100 Subject: [PATCH 1/2] nixos/envfs: use configured environment.usrbinenv and environment.binsh Taken from upstream https://github.com/Mic92/envfs/commit/d91aeefccb4485646be9415c9e5d1d3599eb5199 --- nixos/modules/tasks/filesystems/envfs.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nixos/modules/tasks/filesystems/envfs.nix b/nixos/modules/tasks/filesystems/envfs.nix index 450b805f0f580a6..df4ce12407bd99d 100644 --- a/nixos/modules/tasks/filesystems/envfs.nix +++ b/nixos/modules/tasks/filesystems/envfs.nix @@ -9,8 +9,8 @@ let options = [ "fallback-path=${pkgs.runCommand "fallback-path" {} '' mkdir -p $out - ln -s ${pkgs.coreutils}/bin/env $out/env - ln -s ${config.system.build.binsh}/bin/sh $out/sh + ln -s ${config.environment.usrbinenv} $out/env + ln -s ${config.environment.binsh} $out/sh ''}" ]; }; From 1c664befd4c198db2c6993f8afde709024bcec6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20J=C3=A4ckel?= Date: Mon, 30 Jan 2023 16:53:08 +0100 Subject: [PATCH 2/2] nixos/envfs: add extraFallbackPathCommands options this is mainly useful for restricted platforms like wsl which require some extra entries in /bin/ --- nixos/modules/tasks/filesystems/envfs.nix | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/nixos/modules/tasks/filesystems/envfs.nix b/nixos/modules/tasks/filesystems/envfs.nix index df4ce12407bd99d..76344f5f87eafde 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"; }; }; };