Skip to content

Commit d69e3eb

Browse files
committed
feat(wsl): add initial WSL configuration
1 parent 51ff172 commit d69e3eb

File tree

8 files changed

+102
-93
lines changed

8 files changed

+102
-93
lines changed

configurations/nixos/nixos.nix

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
{ pkgs, hostName, ... }:
2-
let
3-
hostId = builtins.substring 0 8 (builtins.hashString "sha256" hostName);
4-
in
52
{
63
nix.settings.experimental-features = [
74
"nix-command"
@@ -29,7 +26,6 @@ in
2926

3027
# Configure networking.
3128
networking = {
32-
inherit hostId;
3329
inherit hostName;
3430
firewall.enable = true;
3531
nftables.enable = true;

configurations/nixos/services/incus.nix

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
package = pkgs-unstable.incus;
99
};
1010

11+
users.users.onno.extraGroups = [ "incus-admin" ];
12+
1113
networking.firewall = {
1214
trustedInterfaces = [
1315
"incusbr0"

configurations/wsl/wsl.nix

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{ pkgs, hostName, ... }:
2+
{
3+
nix.settings.experimental-features = [
4+
"nix-command"
5+
"flakes"
6+
];
7+
nixpkgs.hostPlatform = "x86_64-linux";
8+
system.stateVersion = "25.11";
9+
10+
# WSL-specific settings.
11+
wsl = {
12+
enable = true;
13+
defaultUser = "onno";
14+
};
15+
16+
# Configure time and i18n.
17+
time.timeZone = "Europe/Amsterdam";
18+
i18n.defaultLocale = "en_US.UTF-8";
19+
20+
# Configure networking.
21+
networking = {
22+
inherit hostName;
23+
};
24+
25+
# Configure security.
26+
security = {
27+
sudo = {
28+
execWheelOnly = true;
29+
wheelNeedsPassword = false;
30+
};
31+
};
32+
33+
# Enable automatic garbage collection.
34+
nix.gc = {
35+
automatic = true;
36+
dates = "Sat 22:00";
37+
options = "--delete-older-than 30d";
38+
};
39+
40+
# Packages to be installed in system profile.
41+
environment = with pkgs; {
42+
systemPackages = [
43+
git
44+
vim
45+
];
46+
};
47+
}

flake.lock

Lines changed: 40 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@
2626
inputs.nixpkgs.follows = "nixpkgs-darwin";
2727
};
2828

29+
nixos-wsl = {
30+
url = "github:nix-community/NixOS-WSL/release-25.11";
31+
inputs.nixpkgs.follows = "nixpkgs";
32+
};
33+
2934
pre-commit-hooks = {
3035
url = "github:cachix/git-hooks.nix";
3136
inputs.nixpkgs.follows = "nixpkgs";
@@ -39,6 +44,7 @@
3944
disko,
4045
home-manager,
4146
nix-darwin,
47+
nixos-wsl,
4248
nixpkgs,
4349
nixpkgs-unstable,
4450
pre-commit-hooks,
@@ -53,7 +59,7 @@
5359
darwinConfigurations =
5460
let
5561
system = "aarch64-darwin";
56-
pkgs-unstable = nixpkgs-unstable.legacyPackages.${system}.pkgs;
62+
pkgs-unstable = nixpkgs-unstable.legacyPackages.${system};
5763
in
5864
{
5965
macbook-pro = nix-darwin.lib.darwinSystem {
@@ -77,7 +83,7 @@
7783
nixosConfigurations =
7884
let
7985
system = "x86_64-linux";
80-
pkgs-unstable = nixpkgs-unstable.legacyPackages.${system}.pkgs;
86+
pkgs-unstable = nixpkgs-unstable.legacyPackages.${system};
8187
in
8288
{
8389
server-vesta = nixpkgs.lib.nixosSystem {
@@ -99,20 +105,16 @@
99105
];
100106
};
101107

102-
server-vulcan = nixpkgs.lib.nixosSystem {
108+
wsl-nixos = nixpkgs.lib.nixosSystem {
103109
inherit system;
104110
specialArgs = {
105-
hostName = "server-vulcan";
111+
hostName = "wsl-nixos";
106112
inherit catppuccin-hm;
107113
inherit pkgs-unstable;
108114
};
109115
modules = [
110-
disko.nixosModules.disko
111-
./hardware/intel-aipc-devkit.nix
112-
./configurations/nixos/nixos.nix
113-
./configurations/nixos/services/openssh.nix
114-
./configurations/nixos/services/incus.nix
115-
./configurations/nixos/services/tailscale.nix
116+
nixos-wsl.nixosModules.default
117+
./configurations/wsl/wsl.nix
116118
home-manager.nixosModules.home-manager
117119
./home/config.nix
118120
];

hardware/intel-aipc-devkit.nix

Lines changed: 0 additions & 77 deletions
This file was deleted.

home/config.nix

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ in
4343
# Linux-specific configuration.
4444
(lib.mkIf isLinux {
4545
extraGroups = [
46-
"incus-admin"
4746
"wheel"
4847
];
4948
home = "/home/onno";

home/programs/git.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ _: {
4141

4242
ignores = [
4343
".DS_Store"
44+
".agents"
4445
".env"
4546
];
4647
};

0 commit comments

Comments
 (0)