feat: merge own wsl config

This commit is contained in:
2026-02-28 01:57:42 +00:00
parent 4e2264dc03
commit bf41ee6e0a
14 changed files with 272 additions and 129 deletions

View File

@@ -54,28 +54,29 @@ in {
"ata_piix"
"uhci_hcd"
"xen_blkfront"
] ++ (if pkgs.system != "aarch64-linux" then [ "vmw_pvscsi" ] else []);
] ++ (if pkgs.stdenv.hostPlatform.system != "aarch64-linux" then [ "vmw_pvscsi" ] else []);
boot.initrd.kernelModules = ["nvme"];
disko.devices = {
disk.vda = {
device = lib.mkDefault "/dev/vda";
content = {
type = "table";
format = "msdos";
partitions = [
{
name = "root";
part-type = "primary";
fs-type = "ext4";
bootable = true;
type = "gpt";
partitions = {
boot = {
size = "1M";
type = "EF02";
priority = 1;
};
root = {
size = "100%";
content = {
type = "filesystem";
format = "ext4";
type = "filesystem";
format = "ext4";
mountpoint = "/";
};
}
];
};
};
};
};
};

View File

@@ -8,7 +8,7 @@
modulesPath,
config,
...
}: let system = pkgs.system; in {
}: let system = pkgs.stdenv.hostPlatform.system; in {
imports = [
self.nixosModules.hectic
inputs.sops-nix.nixosModules.sops

View File

@@ -0,0 +1,23 @@
{
flake,
self,
inputs,
system,
...
}: let
# Use folder name as system name
name = builtins.baseNameOf ./.;
in self.lib.nixpkgs-lib.nixosSystem {
pkgs = import inputs.nixpkgs {
inherit system;
overlays = [ self.overlays.default ];
config.allowUnfree = true;
};
modules = [
{ networking.hostName = name; }
inputs.nixos-wsl.nixosModules.default
{ wsl.enable = true; }
(import ./${name}.nix { inherit flake self inputs; })
];
}

89
nixos/system/wsl/wsl.nix Normal file
View File

@@ -0,0 +1,89 @@
{
inputs,
flake,
self,
}: {
lib,
pkgs,
config,
...
}: {
imports = [
self.nixosModules.hectic
];
hectic = {
archetype.base.enable = true;
program.zsh.enable = true;
program.nixvim.enable = true;
user.yukkop.enable = true;
};
wsl.defaultUser = "yukkop";
# 16 GiB swap
swapDevices = [{
device = "/var/lib/swapfile";
size = 16 * 1024;
}];
users.groups.owner = {};
services.openssh = {
enable = true;
settings = {
PasswordAuthentication = false;
UseDns = true;
X11Forwarding = false;
PermitRootLogin = "no";
};
};
virtualisation.docker.enable = true;
hardware.opengl.enable = true;
console.keyMap = "us";
environment.systemPackages = with pkgs; [
ripgrep
man-pages
man-pages-posix
man-db
ffmpeg
];
documentation.dev.enable = true;
documentation.man.man-db.enable = false;
documentation.man.mandoc.enable = true;
services.samba = {
enable = true;
shares.sshfs = {
path = "/home/yukkop/umbriel/vproxy";
browseable = true;
"read only" = false;
"guest ok" = true;
};
};
networking.firewall.allowedTCPPorts = [ 139 445 ];
networking.firewall.allowedUDPPorts = [ 137 138 ];
fonts.packages = with pkgs; [
nerd-fonts.jetbrains-mono
];
environment.variables = {
EDITOR = "nvim";
VISUAL = "nvim";
};
# WSL-local shell aliases
programs.bash.shellAliases = {
nrs = "sudo nixos-rebuild switch --flake /home/yukkop/pj/util.nix#wsl";
};
# WSL: keep imperative stateVersion in the system module
system.stateVersion = "25.05";
}