diff --git a/hosts/nixos-wsl/configuration.nix b/hosts/nixos-wsl/configuration.nix index 874d710..1c28a0d 100644 --- a/hosts/nixos-wsl/configuration.nix +++ b/hosts/nixos-wsl/configuration.nix @@ -2,7 +2,12 @@ { config = { networking.hostName = "nixos-wsl"; - nixfiles.profile.base.enable = true; + + nixfiles = { + profile.base.enable = true; + binfmt.enable = true; + }; + networking.networkmanager.enable = false; programs.gnupg.agent = { enable = true; diff --git a/system/hardware/binfmt.nix b/system/hardware/binfmt.nix index 9247702..2bc75d1 100644 --- a/system/hardware/binfmt.nix +++ b/system/hardware/binfmt.nix @@ -1,4 +1,4 @@ -{ pkgs, config, lib, ... }: +{ pkgs, config, lib, options, ... }: let configForSystem = (system: @@ -27,9 +27,16 @@ in }; }; - config = lib.mkMerge [ - (lib.mkIf (cfg.enable && (builtins.length emulatedSystems) > 0) { - boot.binfmt = {inherit emulatedSystems;}; + config = let + enable = cfg.enable && (builtins.length emulatedSystems) > 0; + in lib.mkMerge [ + (lib.mkIf enable { + boot.binfmt = {inherit emulatedSystems;}; + }) + + # keep Windows binfmt registration on wsl + (lib.mkIf (cfg.enable && lib.hasAttrByPath [ "wsl" "interop" "register" ] options) { + wsl.interop.register = lib.mkDefault true; }) ]; }