Skip to content

Commit

Permalink
Use upstream settings instead of workarounds to disable unsupported s…
Browse files Browse the repository at this point in the history
…ettings

Closes #149
  • Loading branch information
SuperSandro2000 committed Dec 17, 2022
1 parent fab2833 commit 56a9e30
Showing 1 changed file with 15 additions and 18 deletions.
33 changes: 15 additions & 18 deletions modules/wsl-distro.nix
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,20 @@ with lib; {
mkIf cfg.enable (
mkMerge [
{
# We don't need a boot loader
boot.loader.grub.enable = false;
system.build.installBootLoader = "${pkgs.coreutils}/bin/true";
boot.initrd.enable = false;
system.build.initialRamdisk = pkgs.runCommand "fake-initrd" { } ''
mkdir $out
touch $out/${config.system.boot.loader.initrdFile}
'';
system.build.initialRamdiskSecretAppender = pkgs.writeShellScriptBin "append-initrd-secrets" "";
# WSL uses its own kernel and boot loader
boot = {
initrd.enable = false;
kernel.enable = false;
loader.grub.enable = false;
modprobeConfig.enable = false;
};

# WSL does not support virtual consoles
console.enable = false;

hardware.opengl.enable = true; # Enable GPU acceleration

environment = {

# Only set the options if the files are managed by WSL
etc = mkMerge [
(mkIf config.wsl.wslConf.network.generateHosts {
Expand All @@ -69,6 +69,7 @@ with lib; {
];
};

# dhcp is handled by windows
networking.dhcpcd.enable = false;

users.users.${cfg.defaultUser} = {
Expand Down Expand Up @@ -102,20 +103,16 @@ with lib; {
'';
};

# no udev devices can be attached
services.udev.enable = lib.mkDefault false;

systemd = {
# Disable systemd units that don't make sense on WSL
services = {
# no virtual console to switch to
"serial-getty@ttyS0".enable = false;
"serial-getty@hvc0".enable = false;
"getty@tty1".enable = false;
"autovt@".enable = false;
firewall.enable = false;
systemd-resolved.enable = false;
systemd-resolved.enable = lib.mkDefault false;
# system clock cannot be changed
systemd-timesyncd.enable = false;
# no udev devices can be attached
systemd-udevd.enable = false;
};

# Don't allow emergency mode, because we don't have a console.
Expand Down

0 comments on commit 56a9e30

Please sign in to comment.