mirror of
https://github.com/nix-community/NixOS-WSL.git
synced 2026-11-07 14:59:35 +00:00
utils/shell-wrapper: hardcode paths to the right sh/env executables (#459)
This commit is contained in:
+6
-1
@@ -1,8 +1,13 @@
|
||||
{ rustPlatform }:
|
||||
{ rustPlatform, bash, coreutils }:
|
||||
rustPlatform.buildRustPackage {
|
||||
pname = "nixos-wsl-utils";
|
||||
version = "1.0.0";
|
||||
|
||||
src = ./.;
|
||||
cargoLock.lockFile = ./Cargo.lock;
|
||||
|
||||
env = {
|
||||
NIXOS_WSL_SH = "${bash}/bin/sh";
|
||||
NIXOS_WSL_ENV = "${coreutils}/bin/env";
|
||||
};
|
||||
}
|
||||
|
||||
@@ -19,8 +19,11 @@ fn real_main() -> anyhow::Result<()> {
|
||||
// Skip if environment was already set
|
||||
if env::var_os("__NIXOS_SET_ENVIRONMENT_DONE") != Some("1".into()) {
|
||||
// Load the environment from /etc/set-environment
|
||||
let output = Command::new("/bin/sh")
|
||||
.args(&["-c", ". /etc/set-environment && /usr/bin/env -0"])
|
||||
let output = Command::new(env!("NIXOS_WSL_SH"))
|
||||
.args(&[
|
||||
"-c",
|
||||
&format!(". /etc/set-environment && {} -0", env!("NIXOS_WSL_ENV")),
|
||||
])
|
||||
.output()
|
||||
.context("when reading /etc/set-environment")?;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user