From eeea425cde2884c3e296c1b59c53d97c870e2fa1 Mon Sep 17 00:00:00 2001 From: Sakooooo <78461130+Sakooooo@users.noreply.github.com> Date: Thu, 17 Aug 2023 15:42:16 +0000 Subject: [PATCH] suspicious commit but its me im adding wsl support --- flake.lock | 72 +++++++++++++++++++++++++++++++++ flake.nix | 14 +++++++ hosts/sakowsl/configuration.nix | 36 +++++++++++++++++ 3 files changed, 122 insertions(+) create mode 100644 hosts/sakowsl/configuration.nix diff --git a/flake.lock b/flake.lock index 89f40dd4..31b0e3c9 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,61 @@ { "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" + } + }, + "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": [ @@ -55,10 +111,26 @@ }, "root": { "inputs": { + "NixOS-WSL": "NixOS-WSL", "home-manager": "home-manager", "nixpkgs": "nixpkgs", "nixpkgs-unstable": "nixpkgs-unstable" } + }, + "systems": { + "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 8564c87f..c6699e2a 100644 --- a/flake.nix +++ b/flake.nix @@ -9,6 +9,11 @@ nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable"; home-manager.url = "github:nix-community/home-manager/release-23.05"; home-manager.inputs.nixpkgs.follows = "nixpkgs"; + # nixos wsl + NixOS-WSL = { + url = "github:nix-community/NixOS-WSL"; + inputs.nixpkgs.follows = "nixpkgs"; + }; # flake-compat for nixd #flake-compat = { # url = "github:edolstra/flake-compat"; @@ -23,6 +28,7 @@ self, nixpkgs, home-manager, + NixOS-WSL, ... } @ inputs: let inherit (self) outputs; @@ -66,6 +72,14 @@ ./hosts/sakopc/configuration.nix ]; }; + sakowsl = nixpkgs.lib.nixosSystem { + specialArgs = {inherit inputs outputs;}; + modules = [ + ./hosts/sakowsl/configuration.nix + NixOS-WSL.nixosModules.wsl + ]; + + }; }; }; } diff --git a/hosts/sakowsl/configuration.nix b/hosts/sakowsl/configuration.nix new file mode 100644 index 00000000..f5b98e3e --- /dev/null +++ b/hosts/sakowsl/configuration.nix @@ -0,0 +1,36 @@ +{ lib, pkgs, config, modulesPath, ... }: + +{ + imports = [ + nixos-wsl.nixosModules.wsl + ]; + + wsl = { + enable = true; + automountPath = "/mnt"; + defaultUser = "sako"; + startMenuLaunchers = true; + + # Native systemd for wsl + nativeSystemd = true; + + # Enable native Docker support + # docker-native.enable = true; + + # Enable integration with Docker Desktop (needs to be installed) + # docker-desktop.enable = true; + + }; + + users.users.sako.isNormalUser = true; + + networking.hostName = "sakowsl"; + + # Enable nix flakes + nix.package = pkgs.nixFlakes; + nix.extraOptions = '' + experimental-features = nix-command flakes + ''; + + system.stateVersion = "22.05"; +}