Created
February 27, 2025 13:39
-
-
Save batonac/68c2262d18e0450e957524660ac0e257 to your computer and use it in GitHub Desktop.
Starter Flake for NixOS WSL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| inputs = { | |
| nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; | |
| nixos-wsl = { | |
| url = "github:nix-community/NixOS-WSL/main"; | |
| inputs.nixpkgs.follows = "nixpkgs"; | |
| }; | |
| vscode-server = { | |
| url = "github:nix-community/nixos-vscode-server"; | |
| inputs.nixpkgs.follows = "nixpkgs"; | |
| }; | |
| }; | |
| outputs = | |
| { | |
| self, | |
| nixpkgs, | |
| nixos-wsl, | |
| vscode-server, | |
| ... | |
| }: | |
| { | |
| nixosConfigurations = { | |
| nixos = nixpkgs.lib.nixosSystem { | |
| system = "x86_64-linux"; | |
| modules = [ | |
| nixos-wsl.nixosModules.default | |
| vscode-server.nixosModules.default | |
| ( | |
| { pkgs, lib, ... }: | |
| let | |
| pythonPackages = pkgs.python3.withPackages ( | |
| python-pkgs: with python-pkgs; [ | |
| black | |
| flake8 | |
| isort | |
| pandas | |
| requests | |
| ] | |
| ); | |
| in | |
| { | |
| environment.systemPackages = with pkgs; [ | |
| curl | |
| git | |
| nano | |
| nixfmt-rfc-style | |
| nixos-container | |
| nodejs_22 | |
| pythonPackages | |
| tzdata | |
| wget | |
| ]; | |
| nix.settings = { | |
| experimental-features = [ | |
| "nix-command" | |
| "flakes" | |
| ]; | |
| }; | |
| programs = { | |
| direnv.enable = true; | |
| }; | |
| services.vscode-server.enable = true; | |
| system = { | |
| stateVersion = "24.11"; | |
| }; | |
| users = { | |
| users.nixos = { | |
| isNormalUser = true; | |
| extraGroups = [ | |
| "docker" | |
| "nixbld" | |
| "wheel" | |
| ]; | |
| shell = pkgs.bashInteractive; | |
| }; | |
| }; | |
| wsl = { | |
| enable = true; | |
| defaultUser = "nixos"; | |
| docker-desktop.enable = true; | |
| startMenuLaunchers = true; | |
| useWindowsDriver = true; | |
| }; | |
| } | |
| ) | |
| ]; | |
| }; | |
| }; | |
| }; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment