From 2c3c68aea5bd49212f35a2ffe7553e0b55de9dd6 Mon Sep 17 00:00:00 2001 From: NullBite Date: Sat, 1 Jun 2024 04:31:23 +0000 Subject: [PATCH] wsl: add systemd startup workaround --- hosts/nixos-wsl/configuration.nix | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/hosts/nixos-wsl/configuration.nix b/hosts/nixos-wsl/configuration.nix index 44d0732..c512f7e 100644 --- a/hosts/nixos-wsl/configuration.nix +++ b/hosts/nixos-wsl/configuration.nix @@ -1,4 +1,4 @@ -{ pkgs, config, lib, ... }: +{ pkgs, config, lib, vars, ... }: { config = { networking.hostName = "nixos-wsl"; @@ -9,6 +9,27 @@ }; wsl.interop.register = true; + users.users.${vars.username}.linger = true; + systemd.services = let + user = config.users.users.${vars.username}; + mainUid = builtins.toString user.uid; + in { + # "user@${mainUid}" = { + # wantedBy = [ "multi-user.target" ]; + # overrideStrategy = "asDropin"; + # }; + workaround-reisolate = { + serviceConfig = { + ExecStartPre = "${pkgs.coreutils}/bin/sleep 10"; + ExecStart = "${pkgs.systemd}/bin/systemctl isolate --no-block default.target"; + Type = "oneshot"; + RemainAfterExit = true; + }; + description = "WSL startup workaround"; + wantedBy = [ "default.target" ]; + }; + }; + networking.networkmanager.enable = false; programs.gnupg.agent = { enable = true;