From 167ee92ef9e6857e545b7cd35e15a9a67d14eb0d Mon Sep 17 00:00:00 2001 From: Shaurya Singh Date: Sat, 25 Nov 2023 14:30:01 -0500 Subject: [PATCH] wsl --- hosts/default.nix | 9 +++++++++ hosts/wsl2/configuration.nix | 28 ++++++++++++++++++++++++++++ users/default.nix | 6 ++++++ users/wsl/home.nix | 15 +++++++++++++++ 4 files changed, 58 insertions(+) create mode 100644 hosts/wsl2/configuration.nix create mode 100644 users/wsl/home.nix diff --git a/hosts/default.nix b/hosts/default.nix index 41582270..d7c0b935 100644 --- a/hosts/default.nix +++ b/hosts/default.nix @@ -16,5 +16,14 @@ _: modules = [ ./c1/configuration.nix ]; }; + wsl2 = { + system = "x86_64-linux"; + stateVersion = "22.05"; # only change this if you know what you are doing. + wsl = true; + + modules = [ + ./wsl2/configuration.nix + ]; + }; }; } diff --git a/hosts/wsl2/configuration.nix b/hosts/wsl2/configuration.nix new file mode 100644 index 00000000..5c40fb3f --- /dev/null +++ b/hosts/wsl2/configuration.nix @@ -0,0 +1,28 @@ +{ pkgs, modulesPath, ... }: + +{ + imports = [ "${modulesPath}/profiles/minimal.nix" ]; + + wsl = { + enable = true; + defaultUser = "shaurizard"; + startMenuLaunchers = true; + wslConf.automount.root = "/mnt"; + }; + + hardware.opengl.enable = true; + + environment.systemPackages = with pkgs; [ + git + home-manager + ]; + + users.users.shaurizard = { + isNormalUser = true; + home = "/home/shaurizard"; + shell = pkgs.zsh; + extraGroups = [ "wheel" ]; + }; + + programs.zsh.enable = true; +} \ No newline at end of file diff --git a/users/default.nix b/users/default.nix index 37902db2..3ccbdc58 100644 --- a/users/default.nix +++ b/users/default.nix @@ -14,5 +14,11 @@ _: modules = [ ./shaurizard/home.nix ]; }; + + "shaurizard@wsl2" = { + system = "x86_64-linux"; + stateVersion = "23.05"; + modules = [ ./wsl/home.nix ]; + }; }; } diff --git a/users/wsl/home.nix b/users/wsl/home.nix new file mode 100644 index 00000000..03a2727e --- /dev/null +++ b/users/wsl/home.nix @@ -0,0 +1,15 @@ +{ pkgs, ... }: + +/* + home-manager configuration + Useful links: + - Home Manager Manual: https://nix-community.gitlab.io/home-manager/ + - Appendix A. Configuration Options: https://nix-community.gitlab.io/home-manager/options.html +*/ +{ + home = { + packages = builtins.attrValues { + inherit (pkgs) neofetch; + }; + }; +} \ No newline at end of file