summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorSandro <sandro.jaeckel@gmail.com>2023-01-30 22:48:30 +0100
committerGitHub <noreply@github.com>2023-01-30 22:48:30 +0100
commitfa07181d211cd6220c687ecc8ef542df5ba4918d (patch)
treef53ec2d40520a3aaca2a1f95d179a42d9a3fc2bd /modules
parentd90a15f0504f111132875973802393f505f78bbb (diff)
parente6503b94fa29435af421fef198a91e656a84e1dd (diff)
Merge pull request #175 from SuperSandro2000/boot-isContainer-cleanup
Closes https://github.com/nix-community/NixOS-WSL/issues/149
Diffstat (limited to 'modules')
-rw-r--r--modules/wsl-distro.nix33
1 files changed, 15 insertions, 18 deletions
diff --git a/modules/wsl-distro.nix b/modules/wsl-distro.nix
index d9ed003..61de095 100644
--- a/modules/wsl-distro.nix
+++ b/modules/wsl-distro.nix
@@ -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 {
@@ -69,6 +69,7 @@ with lib; {
];
};
+ # dhcp is handled by windows
networking.dhcpcd.enable = false;
users.users.${cfg.defaultUser} = {
@@ -110,20 +111,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.