Added WSL host

This commit is contained in:
Nickiel12 2024-07-04 23:30:56 +00:00
parent 3a56737194
commit 78361944cb
4 changed files with 156 additions and 16 deletions

View file

@ -25,7 +25,7 @@
}, },
"devshell": { "devshell": {
"inputs": { "inputs": {
"flake-utils": "flake-utils_4", "flake-utils": "flake-utils_5",
"nixpkgs": [ "nixpkgs": [
"nixvim", "nixvim",
"nixpkgs" "nixpkgs"
@ -103,6 +103,22 @@
} }
}, },
"flake-compat_2": { "flake-compat_2": {
"flake": false,
"locked": {
"lastModified": 1696426674,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-compat_3": {
"locked": { "locked": {
"lastModified": 1696426674, "lastModified": 1696426674,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
@ -116,7 +132,7 @@
"url": "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz" "url": "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz"
} }
}, },
"flake-compat_3": { "flake-compat_4": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1696426674, "lastModified": 1696426674,
@ -211,6 +227,24 @@
"inputs": { "inputs": {
"systems": "systems_4" "systems": "systems_4"
}, },
"locked": {
"lastModified": 1710146030,
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_5": {
"inputs": {
"systems": "systems_5"
},
"locked": { "locked": {
"lastModified": 1701680307, "lastModified": 1701680307,
"narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=", "narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=",
@ -227,7 +261,7 @@
}, },
"git-hooks": { "git-hooks": {
"inputs": { "inputs": {
"flake-compat": "flake-compat_3", "flake-compat": "flake-compat_4",
"gitignore": "gitignore", "gitignore": "gitignore",
"nixpkgs": [ "nixpkgs": [
"nixvim", "nixvim",
@ -399,6 +433,27 @@
"type": "github" "type": "github"
} }
}, },
"nixos-wsl": {
"inputs": {
"flake-compat": "flake-compat_2",
"flake-utils": "flake-utils_4",
"nixpkgs": "nixpkgs_6"
},
"locked": {
"lastModified": 1719220171,
"narHash": "sha256-xywM6JoGT8AwfoOFJBTv8GRlvNu8LYqqqMS/OQ6uCgE=",
"owner": "nix-community",
"repo": "NixOS-WSL",
"rev": "269411cfed6aab694e46f719277c972de96177bb",
"type": "github"
},
"original": {
"owner": "nix-community",
"ref": "main",
"repo": "NixOS-WSL",
"type": "github"
}
},
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1699099776, "lastModified": 1699099776,
@ -496,6 +551,22 @@
} }
}, },
"nixpkgs_6": { "nixpkgs_6": {
"locked": {
"lastModified": 1718835956,
"narHash": "sha256-wM9v2yIxClRYsGHut5vHICZTK7xdrUGfrLkXvSuv6s4=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "dd457de7e08c6d06789b1f5b88fc9327f4d96309",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-24.05",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_7": {
"locked": { "locked": {
"lastModified": 1719254875, "lastModified": 1719254875,
"narHash": "sha256-ECni+IkwXjusHsm9Sexdtq8weAq/yUyt1TWIemXt3Ko=", "narHash": "sha256-ECni+IkwXjusHsm9Sexdtq8weAq/yUyt1TWIemXt3Ko=",
@ -511,7 +582,7 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs_7": { "nixpkgs_8": {
"locked": { "locked": {
"lastModified": 1719254875, "lastModified": 1719254875,
"narHash": "sha256-ECni+IkwXjusHsm9Sexdtq8weAq/yUyt1TWIemXt3Ko=", "narHash": "sha256-ECni+IkwXjusHsm9Sexdtq8weAq/yUyt1TWIemXt3Ko=",
@ -530,12 +601,12 @@
"nixvim": { "nixvim": {
"inputs": { "inputs": {
"devshell": "devshell", "devshell": "devshell",
"flake-compat": "flake-compat_2", "flake-compat": "flake-compat_3",
"flake-parts": "flake-parts", "flake-parts": "flake-parts",
"git-hooks": "git-hooks", "git-hooks": "git-hooks",
"home-manager": "home-manager_2", "home-manager": "home-manager_2",
"nix-darwin": "nix-darwin", "nix-darwin": "nix-darwin",
"nixpkgs": "nixpkgs_7", "nixpkgs": "nixpkgs_8",
"treefmt-nix": "treefmt-nix" "treefmt-nix": "treefmt-nix"
}, },
"locked": { "locked": {
@ -560,7 +631,8 @@
"home-manager": "home-manager", "home-manager": "home-manager",
"kmonad": "kmonad", "kmonad": "kmonad",
"nicks_nextcloud_integrations": "nicks_nextcloud_integrations", "nicks_nextcloud_integrations": "nicks_nextcloud_integrations",
"nixpkgs": "nixpkgs_6", "nixos-wsl": "nixos-wsl",
"nixpkgs": "nixpkgs_7",
"nixpkgs-stable": "nixpkgs-stable", "nixpkgs-stable": "nixpkgs-stable",
"nixvim": "nixvim", "nixvim": "nixvim",
"utils": "utils" "utils": "utils"
@ -696,6 +768,21 @@
"type": "github" "type": "github"
} }
}, },
"systems_6": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"treefmt-nix": { "treefmt-nix": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
@ -719,7 +806,7 @@
}, },
"utils": { "utils": {
"inputs": { "inputs": {
"systems": "systems_5" "systems": "systems_6"
}, },
"locked": { "locked": {
"lastModified": 1710146030, "lastModified": 1710146030,

View file

@ -9,6 +9,8 @@
# url = "github:NixOS/nixpkgs/b477b25191fc94ce764428520b83b6b64366e3c8"; # url = "github:NixOS/nixpkgs/b477b25191fc94ce764428520b83b6b64366e3c8";
}; };
nixos-wsl.url = "github:nix-community/NixOS-WSL/main";
nixpkgs-stable = { nixpkgs-stable = {
url = "github:NixOS/nixpkgs/release-23.11"; url = "github:NixOS/nixpkgs/release-23.11";
}; };
@ -43,6 +45,7 @@
ewwtilities, ewwtilities,
kmonad, kmonad,
atuin, atuin,
nixos-wsl,
... ...
}: }:
let let
@ -90,6 +93,40 @@
]; ];
}; };
# To change username after installing: https://nix-community.github.io/NixOS-WSL/how-to/change-username.html
NicksNixWSL = lib.nixosSystem {
inherit system;
modules = [
nixos-wsl.nixosModules.default
./hosts/WSL
{
networking.hostName = "NicksNixWSL";
system.stateVersion = "24.05";
wsl.enable = true;
wsl.defaultUser = "nixolas";
}
#./hosts/WSL
home-manager.nixosModules.home-manager {
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
extraSpecialArgs = {
inherit user ewwtilities atuin pkgs-stable;
};
users.${user} = {
imports = [
(import ./home.nix)
# Add nixvim to the homemanager
inputs.nixvim.homeManagerModules.nixvim
];
};
};
}
];
};
NicksNixLaptop = lib.nixosSystem { NicksNixLaptop = lib.nixosSystem {
inherit system; inherit system;
specialArgs = { specialArgs = {

View file

@ -13,6 +13,7 @@ let
commandline_only_hosts = [ commandline_only_hosts = [
"Alaska" "Alaska"
"NicksNixWSL"
]; ];
install_packages = with pkgs; [ install_packages = with pkgs; [
@ -85,26 +86,28 @@ let
# Drawing tablet driver # Drawing tablet driver
opentabletdriver opentabletdriver
]; ];
filterNulls = list: builtins.filter (x: x != null) list;
in in
{ {
imports = [ imports = filterNulls [
./modules/atuin.nix ./modules/atuin.nix
./modules/discord.nix
#./modules/emacs.nix
./modules/fusuma.nix
./modules/git.nix ./modules/git.nix
./modules/hyprland
./modules/kitty.nix
./modules/neovim.nix ./modules/neovim.nix
./modules/rofi.nix
./modules/tmux.nix ./modules/tmux.nix
./modules/wezterm.nix ./modules/wezterm.nix
./modules/xdg.nix ./modules/xdg.nix
./modules/yazi.nix ./modules/yazi.nix
./modules/zsh.nix ./modules/zsh.nix
(if (! builtins.elem osConfig.networking.hostName commandline_only_hosts ) then ./modules/hyprland else null)
(if (! builtins.elem osConfig.networking.hostName commandline_only_hosts ) then ../modules/discord.nix else null)
#./modules/emacs.nix
(if (! builtins.elem osConfig.networking.hostName commandline_only_hosts ) then ../modules/fusuma.nix else null)
(if (! builtins.elem osConfig.networking.hostName commandline_only_hosts ) then ../modules/rofi.nix else null)
(if (! builtins.elem osConfig.networking.hostName commandline_only_hosts ) then ../modules/kitty.nix else null)
]; ];
# Let Home Manager install and manage itself. # Let Home Manager install and manage itself.
programs.home-manager.enable = true; programs.home-manager.enable = true;

13
hosts/WSL/default.nix Normal file
View file

@ -0,0 +1,13 @@
{ config, pkgs, ... }:
let
in
{
# See https://nix-community.github.io/NixOS-WSL/how-to/change-username.html
# to reset default WSL login
environment = {
shells = [
"/etc/profiles/per-user/nixolas/bin/zsh"
];
};
}