Add WSL host

This commit is contained in:
thiloho
2023-07-31 17:39:46 +00:00
parent acf7a15bc5
commit cbfd99d8a6
3 changed files with 144 additions and 3 deletions

72
flake.lock generated
View File

@@ -1,5 +1,27 @@
{
"nodes": {
"NixOS-WSL": {
"inputs": {
"flake-compat": "flake-compat",
"flake-utils": "flake-utils",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1690553050,
"narHash": "sha256-pK3kF30OykL3v6P8UP6ipihlS34KoGq9SryCj3tHrFw=",
"owner": "nix-community",
"repo": "NixOS-WSL",
"rev": "f7a95a37306c46b42e9ce751977c44c752fd5eca",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "NixOS-WSL",
"type": "github"
}
},
"aurora-blog-template": {
"inputs": {
"nixpkgs": "nixpkgs"
@@ -18,6 +40,40 @@
"type": "github"
}
},
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1673956053,
"narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1689068808,
"narHash": "sha256-6ixXo3wt24N/melDWjq70UuHQLxGV8jZvooRanIHXw0=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "919d646de7be200f3bf08cb76ae1f09402b6f9b4",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"home-manager": {
"inputs": {
"nixpkgs": [
@@ -71,12 +127,28 @@
},
"root": {
"inputs": {
"NixOS-WSL": "NixOS-WSL",
"aurora-blog-template": "aurora-blog-template",
"home-manager": "home-manager",
"nixpkgs": "nixpkgs_2",
"website": "website"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"website": {
"flake": false,
"locked": {

View File

@@ -3,22 +3,29 @@
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
home-manager.url = "github:nix-community/home-manager";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
website = {
url = "github:thiloho/website";
flake = false;
};
aurora-blog-template.url = "github:thiloho/aurora";
NixOS-WSL = {
url = "github:nix-community/NixOS-WSL";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = inputs@{ nixpkgs, home-manager, ... }: {
outputs = inputs@{ nixpkgs, home-manager, NixOS-WSL, ... }: {
nixosConfigurations = let
mkSystem = entrypoint: nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = { inherit inputs; };
modules = [
entrypoint
(if entrypoint == ./nixos-configurations/wsl then NixOS-WSL.nixosModules.wsl else "")
home-manager.nixosModules.home-manager
{
home-manager = {
@@ -32,6 +39,7 @@
pc = mkSystem ./nixos-configurations/pc;
laptop = mkSystem ./nixos-configurations/laptop;
server = mkSystem ./nixos-configurations/server;
wsl = mkSystem ./nixos-configurations/wsl;
};
};
}

View File

@@ -0,0 +1,61 @@
{ lib, pkgs, config, modulesPath, ... }:
{
wsl = {
enable = true;
wslConf.automount.root = "/mnt";
defaultUser = "thiloho";
startMenuLaunchers = true;
nativeSystemd = true;
# Enable native Docker support
# docker-native.enable = true;
# Enable integration with Docker Desktop (needs to be installed)
# docker-desktop.enable = true;
};
networking.hostName = "ThilosPC";
users.users.thiloho.isNormalUser = true;
programs.gnupg.agent = {
enable = true;
enableSSHSupport = true;
pinentryFlavor = "gnome3";
};
home-manager.users.thiloho = { pkgs, lib, config, ... }: {
programs = {
helix = {
enable = true;
defaultEditor = true;
settings.theme = "ayu_dark";
};
git = {
enable = true;
userName = "thiloho";
userEmail = "123883702+thiloho@users.noreply.github.com";
signing = {
signByDefault = true;
key = "68E9DB8C7055C97A";
};
};
};
home = {
stateVersion = "23.05";
packages = with pkgs; [ wget ];
};
};
nixpkgs.config.allowUnfree = true;
# Enable nix flakes
nix.package = pkgs.nixFlakes;
nix.extraOptions = ''
experimental-features = nix-command flakes
'';
system.stateVersion = "23.05";
}