From b900d6761a19f088a66b97b685b6f4893d68f01b Mon Sep 17 00:00:00 2001 From: Gabe Venberg Date: Wed, 15 May 2024 12:00:33 -0500 Subject: [PATCH] added wsl config --- flake.lock | 87 ++++++++++++++++++++++++--- flake.nix | 6 ++ hosts/archlaptop-vm/default.nix | 20 ------ hosts/home-workstation.nix | 1 - hosts/workstation-vm/default.nix | 20 ------ hosts/wsl-workstation.nix | 74 +++++++++++++++++++++++ modules/home-manager/terminal/zsh.nix | 1 - 7 files changed, 160 insertions(+), 49 deletions(-) create mode 100644 hosts/wsl-workstation.nix diff --git a/flake.lock b/flake.lock index 83caa76..35887c5 100644 --- a/flake.lock +++ b/flake.lock @@ -2,7 +2,7 @@ "nodes": { "devshell": { "inputs": { - "flake-utils": "flake-utils", + "flake-utils": "flake-utils_2", "nixpkgs": [ "nixvim", "nixpkgs" @@ -23,6 +23,22 @@ } }, "flake-compat": { + "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_2": { "locked": { "lastModified": 1696426674, "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", @@ -36,7 +52,7 @@ "url": "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz" } }, - "flake-compat_2": { + "flake-compat_3": { "flake": false, "locked": { "lastModified": 1696426674, @@ -77,6 +93,24 @@ "inputs": { "systems": "systems" }, + "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_2": { + "inputs": { + "systems": "systems_2" + }, "locked": { "lastModified": 1701680307, "narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=", @@ -91,9 +125,9 @@ "type": "github" } }, - "flake-utils_2": { + "flake-utils_3": { "inputs": { - "systems": "systems_2" + "systems": "systems_3" }, "locked": { "lastModified": 1710146030, @@ -193,6 +227,29 @@ "type": "github" } }, + "nixos-wsl": { + "inputs": { + "flake-compat": "flake-compat", + "flake-utils": "flake-utils", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1715612368, + "narHash": "sha256-rpXM1gGZY1KacCvKLx5Hnzxp+iLRVVVrt70KiMKvalo=", + "owner": "nix-community", + "repo": "NixOS-WSL", + "rev": "0802ef2739396a18d56c2fd088b95006671f6f48", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "main", + "repo": "NixOS-WSL", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1713714899, @@ -212,7 +269,7 @@ "nixvim": { "inputs": { "devshell": "devshell", - "flake-compat": "flake-compat", + "flake-compat": "flake-compat_2", "flake-parts": "flake-parts", "home-manager": "home-manager_2", "nix-darwin": "nix-darwin", @@ -237,8 +294,8 @@ }, "pre-commit-hooks": { "inputs": { - "flake-compat": "flake-compat_2", - "flake-utils": "flake-utils_2", + "flake-compat": "flake-compat_3", + "flake-utils": "flake-utils_3", "gitignore": "gitignore", "nixpkgs": [ "nixvim", @@ -266,6 +323,7 @@ "root": { "inputs": { "home-manager": "home-manager", + "nixos-wsl": "nixos-wsl", "nixpkgs": "nixpkgs", "nixvim": "nixvim" } @@ -299,6 +357,21 @@ "repo": "default", "type": "github" } + }, + "systems_3": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 43389f1..4b3339d 100644 --- a/flake.nix +++ b/flake.nix @@ -5,6 +5,11 @@ # Nixpkgs nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + nixos-wsl = { + url = "github:nix-community/NixOS-WSL/main"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + home-manager = { url = "github:nix-community/home-manager"; inputs.nixpkgs.follows = "nixpkgs"; @@ -48,6 +53,7 @@ nixosConfigurations = { archlaptop-vm = import ./hosts/archlaptop-vm {inherit inputs outputs;}; workstation-vm = import ./hosts/workstation-vm {inherit inputs outputs;}; + gv-wsl = import ./hosts/wsl-workstation.nix {inherit inputs outputs;}; }; # Standalone home-manager configuration entrypoint diff --git a/hosts/archlaptop-vm/default.nix b/hosts/archlaptop-vm/default.nix index c688815..7672989 100644 --- a/hosts/archlaptop-vm/default.nix +++ b/hosts/archlaptop-vm/default.nix @@ -37,18 +37,6 @@ inputs.nixpkgs.lib.nixosSystem { # Select internationalisation properties. i18n.defaultLocale = "en_US.UTF-8"; - i18n.extraLocaleSettings = { - LC_ADDRESS = "en_US.UTF-8"; - LC_IDENTIFICATION = "en_US.UTF-8"; - LC_MEASUREMENT = "en_US.UTF-8"; - LC_MONETARY = "en_US.UTF-8"; - LC_NAME = "en_US.UTF-8"; - LC_NUMERIC = "en_US.UTF-8"; - LC_PAPER = "en_US.UTF-8"; - LC_TELEPHONE = "en_US.UTF-8"; - LC_TIME = "en_US.UTF-8"; - }; - # Configure keymap in X11 services.xserver = { xkb.layout = "us"; @@ -87,7 +75,6 @@ inputs.nixpkgs.lib.nixosSystem { }; imports = [ ../../roles/home-manager/terminal.nix - ../../modules/home-manager/nvim ../../modules/home-manager/common.nix ../../modules/home-manager/email.nix inputs.nixvim.homeManagerModules.nixvim @@ -109,13 +96,6 @@ inputs.nixpkgs.lib.nixosSystem { # Before changing this value read the documentation for this option # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). system.stateVersion = "23.11"; # Did you read the comment? - - # Enable the X11 windowing system. - # services.xserver.enable = true; - # - # # Enable the Cinnamon Desktop Environment. - # services.xserver.displayManager.lightdm.enable = true; - # services.xserver.desktopManager.cinnamon.enable = true; }) ]; } diff --git a/hosts/home-workstation.nix b/hosts/home-workstation.nix index 032c78d..65e717a 100644 --- a/hosts/home-workstation.nix +++ b/hosts/home-workstation.nix @@ -16,7 +16,6 @@ inputs.home-manager.lib.homeManagerConfiguration { }: { # machine specific options home = { - enable-speech = true; nvim = { enable-lsp = true; enable-treesitter = true; diff --git a/hosts/workstation-vm/default.nix b/hosts/workstation-vm/default.nix index 919d25f..ae099e1 100644 --- a/hosts/workstation-vm/default.nix +++ b/hosts/workstation-vm/default.nix @@ -37,18 +37,6 @@ inputs.nixpkgs.lib.nixosSystem { # Select internationalisation properties. i18n.defaultLocale = "en_US.UTF-8"; - i18n.extraLocaleSettings = { - LC_ADDRESS = "en_US.UTF-8"; - LC_IDENTIFICATION = "en_US.UTF-8"; - LC_MEASUREMENT = "en_US.UTF-8"; - LC_MONETARY = "en_US.UTF-8"; - LC_NAME = "en_US.UTF-8"; - LC_NUMERIC = "en_US.UTF-8"; - LC_PAPER = "en_US.UTF-8"; - LC_TELEPHONE = "en_US.UTF-8"; - LC_TIME = "en_US.UTF-8"; - }; - # Configure keymap in X11 services.xserver = { xkb.layout = "us"; @@ -91,7 +79,6 @@ inputs.nixpkgs.lib.nixosSystem { }; imports = [ ../../roles/home-manager/terminal.nix - ../../modules/home-manager/nvim ../../modules/home-manager/common.nix inputs.nixvim.homeManagerModules.nixvim ]; @@ -112,13 +99,6 @@ inputs.nixpkgs.lib.nixosSystem { # Before changing this value read the documentation for this option # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). system.stateVersion = "23.11"; # Did you read the comment? - - # Enable the X11 windowing system. - # services.xserver.enable = true; - # - # # Enable the Cinnamon Desktop Environment. - # services.xserver.displayManager.lightdm.enable = true; - # services.xserver.desktopManager.cinnamon.enable = true; }) ]; } diff --git a/hosts/wsl-workstation.nix b/hosts/wsl-workstation.nix new file mode 100644 index 0000000..8d31bc1 --- /dev/null +++ b/hosts/wsl-workstation.nix @@ -0,0 +1,74 @@ +{ + inputs, + outputs, +}: +inputs.nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = {inherit inputs outputs;}; + # > Our main nixos configuration file < + modules = [ + inputs.home-manager.nixosModules.home-manager + inputs.nixos-wsl.nixosModules.default + ../../modules/hostopts.nix + ../../modules/nixos/common.nix + ({ + config, + pkgs, + ... + }: { + wsl.enable=true; + host = { + user = "gabe"; + }; + networking.hostName = "workstation-vm"; # Define your hostname. + # Set your time zone. + time.timeZone = "America/Chicago"; + + programs.zsh.enable=true; + environment.shells = with pkgs; [zsh]; + # Define a user account. Don't forget to set a password with ‘passwd’. + users.users.${config.host.user} = { + isNormalUser = true; + description = "Gabe Venberg"; + shell = pkgs.zsh; + extraGroups = ["wheel"]; + }; + home-manager.users.${config.host.user} = { + inputs, + osConfig, + ... + }: { + host = osConfig.host; + home = { + enable-speech = true; + nvim = { + enable-lsp = true; + enable-treesitter = true; + }; + git = { + profile = { + name = "Gabe Venberg"; + email = "gabevenberg@gmail.com"; + }; + workProfile.enable = false; + }; + }; + imports = [ + ../../roles/home-manager/terminal.nix + ../../modules/home-manager/common.nix + inputs.nixvim.homeManagerModules.nixvim + ]; + }; + + # Select internationalisation properties. + i18n.defaultLocale = "en_US.UTF-8"; + # This value determines the NixOS release from which the default + # settings for stateful data, like file locations and database versions + # on your system were taken. It‘s perfectly fine and recommended to leave + # this value at the release version of the first install of this system. + # Before changing this value read the documentation for this option + # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). + system.stateVersion = "23.11"; # Did you read the comment? + }) + ]; +} diff --git a/modules/home-manager/terminal/zsh.nix b/modules/home-manager/terminal/zsh.nix index a5d4aa5..808c122 100644 --- a/modules/home-manager/terminal/zsh.nix +++ b/modules/home-manager/terminal/zsh.nix @@ -86,7 +86,6 @@ "brackets" "pattern" "regexp" - "cursor" "root" "line" ];