summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorK900 <me@0upti.me>2023-02-01 12:15:04 +0300
committerK900 <me@0upti.me>2023-02-01 15:47:19 +0300
commitdeef7819e9863464365bc251c1070708e0925fc0 (patch)
tree253d10ccb9177bcbd723b06082ad73150e8d1d7f /modules
parent0487b4de4abc076d36325684226ea3bb312b88f8 (diff)
feat: use a Rust tool to do the PATH manipulations
Overkill? Yes. Fuck bash? Also yes.
Diffstat (limited to 'modules')
-rw-r--r--modules/wsl-distro.nix9
1 files changed, 3 insertions, 6 deletions
diff --git a/modules/wsl-distro.nix b/modules/wsl-distro.nix
index 615da2f..72cdf63 100644
--- a/modules/wsl-distro.nix
+++ b/modules/wsl-distro.nix
@@ -26,7 +26,7 @@ with lib; {
defaultUser = config.users.users.${cfg.defaultUser};
};
- shim = pkgs.callPackage ../scripts/native-systemd-shim/shim.nix { };
+ nativeUtils = pkgs.callPackage ../scripts/native-utils { };
bashWrapper = pkgs.runCommand "nixos-wsl-bash-wrapper" { nativeBuildInputs = [ pkgs.makeWrapper ]; } ''
makeWrapper ${pkgs.bashInteractive}/bin/sh $out/bin/sh --prefix PATH ':' ${lib.makeBinPath [pkgs.systemd pkgs.gnugrep]}
@@ -166,7 +166,7 @@ with lib; {
shimSystemd = stringAfter [ ] ''
echo "setting up /sbin/init shim..."
mkdir -p /sbin
- ln -sf ${shim}/bin/nixos-wsl-native-systemd-shim /sbin/init
+ ln -sf ${nativeUtils}/bin/systemd-shim /sbin/init
'';
setupLogin = stringAfter [ ] ''
echo "setting up /bin/login..."
@@ -179,10 +179,7 @@ with lib; {
# preserve $PATH from parent
variables.PATH = [ "$PATH" ];
extraInit = ''
- export WSLPATH=$(echo "$PATH" | tr ':' '\0' | command grep -az "^${cfg.wslConf.automount.root}" | tr '\0' ':')
- ${if cfg.interop.includePath then "" else ''
- export PATH=$(echo "$PATH" | tr ':' '\0' | command grep -avz "^${cfg.wslConf.automount.root}" | tr '\0' ':')
- ''}
+ eval $(${nativeUtils}/bin/split-path --automount-root="${cfg.wslConf.automount.root}" ${lib.optionalString cfg.interop.includePath "--include-interop"})
'';
};
})