Skip to content

Commit

Permalink
Support envfs (#525)
Browse files Browse the repository at this point in the history
* Support envfs

Disable `populateBin` when `envfs` is enabled

* Use mkIf to disable populateBin
  • Loading branch information
Atry authored Oct 13, 2024
1 parent 3befb10 commit b8ebac4
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion modules/wsl-distro.nix
Original file line number Diff line number Diff line change
Expand Up @@ -215,14 +215,25 @@ in

# require people to use lib.mkForce to make it harder to brick their installation
wsl = {
populateBin = true;
populateBin = mkIf config.services.envfs.enable false;
extraBin = [
{ src = "/init"; name = "wslpath"; }
{ src = "${cfg.binShExe}"; name = "sh"; }
{ src = "${pkgs.util-linux}/bin/mount"; }
];
};

services.envfs.extraFallbackPathCommands =
concatStringsSep "\n"
(map
(entry:
if entry.copy
then "cp -f ${entry.src} $out/${entry.name}"
else "ln -sf ${entry.src} $out/${entry.name}"
)
cfg.extraBin
);

warnings = flatten [
(optional (config.services.resolved.enable && config.wsl.wslConf.network.generateResolvConf)
"systemd-resolved is enabled, but resolv.conf is managed by WSL (wsl.wslConf.network.generateResolvConf)"
Expand Down

0 comments on commit b8ebac4

Please sign in to comment.