mirror of
https://github.com/sstent/vmimages.git
synced 2026-01-25 22:51:49 +00:00
68 lines
1.9 KiB
Nix
68 lines
1.9 KiB
Nix
{ lib, pkgs, config, modulesPath, ... }:
|
|
{
|
|
|
|
nixpkgs.overlays = overlays;
|
|
# Enable nix flakes
|
|
nix.package = pkgs.nixFlakes;
|
|
nix.extraOptions = ''
|
|
experimental-features = nix-command flakes
|
|
'';
|
|
system.stateVersion = "22.11";
|
|
|
|
wsl = {
|
|
enable = true;
|
|
wslConf.automount.root = "/mnt";
|
|
defaultUser = "sstent";
|
|
startMenuLaunchers = true;
|
|
interop.preserveArgvZero = true;
|
|
nativeSystemd = true;
|
|
# Enable native Docker support
|
|
# docker-native.enable = true;
|
|
|
|
# Enable integration with Docker Desktop (needs to be installed)
|
|
# docker-desktop.enable = true;
|
|
};
|
|
|
|
mymods = {
|
|
user_sstent.enable = true;
|
|
};
|
|
|
|
environment.systemPackages =
|
|
[ pkgs.socat pkgs.npiperelay ];
|
|
|
|
npiperelay = import ../../pkgs/npiperelay { inherit pkgs; };
|
|
|
|
systemd.user.services.ssh-proxy = {
|
|
description = "WSL Proxy";
|
|
serviceConfig = {
|
|
ExecStart = "${pkgs.writeShellScript "start-proxy" ''
|
|
rm -f /tmp/.ssh-sock
|
|
setsid ${pkgs.socat}/bin/socat UNIX-LISTEN:/tmp/.ssh-sock,fork EXEC:"/run/current-system/sw/bin/npiperelay.exe -ei -s //./pipe/openssh-ssh-agent",nofork
|
|
''}";
|
|
};
|
|
wantedBy = [ "default.target" ];
|
|
};
|
|
|
|
#pkgs.callPackage ./npiperelay.nix {};
|
|
|
|
systemd.services.nixs-wsl-systemd-fix = {
|
|
description = "Fix the /dev/shm symlink to be a mount";
|
|
unitConfig = {
|
|
DefaultDependencies = "no";
|
|
Before = [ "sysinit.target" "systemd-tmpfiles-setup-dev.service" "systemd-tmpfiles-setup.service" "systemd-sysctl.service" ];
|
|
ConditionPathExists = "/dev/shm";
|
|
ConditionPathIsSymbolicLink = "/dev/shm";
|
|
ConditionPathIsMountPoint = "/run/shm";
|
|
};
|
|
serviceConfig = {
|
|
Type = "oneshot";
|
|
ExecStart = [
|
|
"${pkgs.coreutils-full}/bin/rm /dev/shm"
|
|
"/run/wrappers/bin/mount --bind -o X-mount.mkdir /run/shm /dev/shm"
|
|
];
|
|
};
|
|
wantedBy = [ "sysinit.target" ];
|
|
};
|
|
|
|
}
|