Add workaround for wsl systemd bus issue
Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
@@ -1,5 +1,36 @@
|
|||||||
{ user, home }:
|
{ user, home }:
|
||||||
{ pkgs, ... }:
|
{ config, pkgs, ... }:
|
||||||
|
let
|
||||||
|
systemctl = "${pkgs.systemd}/bin/systemctl";
|
||||||
|
in
|
||||||
{
|
{
|
||||||
|
# FIXME: https://github.com/nix-community/NixOS-WSL/issues/375
|
||||||
|
# FIXME: https://github.com/Mic92/sops-nix/issues/687
|
||||||
|
# FIXME: https://github.com/microsoft/WSL/issues/8842
|
||||||
|
# FIXME: https://github.com/microsoft/WSL/issues/10205
|
||||||
|
# Fuck Microsoft.
|
||||||
|
security.sudo.extraRules = [
|
||||||
|
{
|
||||||
|
users = [ config.users.users.${user}.name ];
|
||||||
|
commands = [
|
||||||
|
{
|
||||||
|
command = "${systemctl} restart user@${toString config.users.users.${user}.uid}.service";
|
||||||
|
options = [ "NOPASSWD" ];
|
||||||
|
}
|
||||||
|
{
|
||||||
|
command = "${systemctl} restart user@${toString config.users.users.${user}.uid}";
|
||||||
|
options = [ "NOPASSWD" ];
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
users.users.${user}.shell = pkgs.writeShellApplication {
|
||||||
|
name = "wsl-zsh";
|
||||||
|
runtimeInputs = with pkgs; [ systemd ];
|
||||||
|
text = builtins.readFile ./wsl-zsh.sh;
|
||||||
|
passthru.shellPath = "/bin/wsl-zsh";
|
||||||
|
};
|
||||||
|
|
||||||
home-manager.users.${user}.home.packages = with pkgs; [ wsl-wl-clipboard ];
|
home-manager.users.${user}.home.packages = with pkgs; [ wsl-wl-clipboard ];
|
||||||
}
|
}
|
||||||
|
15
hosts/elara/users/nikara/configs/console/wsl/wsl-zsh.sh
Normal file
15
hosts/elara/users/nikara/configs/console/wsl/wsl-zsh.sh
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
# shellcheck shell=bash
|
||||||
|
|
||||||
|
user_bus="${DBUS_SESSION_BUS_ADDRESS#unix:path=}"
|
||||||
|
|
||||||
|
if [ -S "$user_bus" ]; then
|
||||||
|
exec zsh
|
||||||
|
fi
|
||||||
|
|
||||||
|
until [ -S /run/dbus/system_bus_socket ]; do
|
||||||
|
sleep 0.1
|
||||||
|
done
|
||||||
|
|
||||||
|
sudo systemctl restart "user@${UID}.service"
|
||||||
|
|
||||||
|
exec zsh
|
Reference in New Issue
Block a user