Skip to content

Instantly share code, notes, and snippets.

@danidiaz
Last active March 29, 2025 22:16
Show Gist options
  • Save danidiaz/9608d6dc72eec40ff2a64a8435fc7327 to your computer and use it in GitHub Desktop.
Save danidiaz/9608d6dc72eec40ff2a64a8435fc7327 to your computer and use it in GitHub Desktop.
Nixos configuration
# start flake-less configuration with WSL and git
#
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page, on
# https://search.nixos.org/options and in the NixOS manual (`nixos-help`).
# NixOS-WSL specific options are documented on the NixOS-WSL repository:
# https://github.com/nix-community/NixOS-WSL
{ config, lib, pkgs, ... }:
{
imports = [
# include NixOS-WSL modules
<nixos-wsl/modules>
];
# https://nixos-and-flakes.thiscute.world/nixos-with-flakes/nixos-with-flakes-enabled
# Enable the Flakes feature and the accompanying new nix command-line tool
nix.settings.experimental-features = [ "nix-command" "flakes" ];
environment.systemPackages = [
# Flakes clones its dependencies through the git command,
# so git must be installed first
pkgs.git
pkgs.vim
pkgs.wget
pkgs.curl
pkgs.tmux
pkgs.jq
pkgs.awscli2
];
# Set the default editor to vim
environment.variables.EDITOR = "vim";
wsl.enable = true;
wsl.defaultUser = "nixos";
# 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 = "24.05"; # Did you read the comment?
}
{
# # moved this to the flake, inside nixos-wsl.nixosModules.default
# imports = [
# # include NixOS-WSL modules
# <nixos-wsl/modules>
# ];
# https://nixos-and-flakes.thiscute.world/nixos-with-flakes/nixos-with-flakes-enabled
# Enable the Flakes feature and the accompanying new nix command-line tool
nix.settings.experimental-features = [ "nix-command" "flakes" ];
environment.systemPackages = [
# Flakes clones its dependencies through the git command,
# so git must be installed first
pkgs.git
pkgs.vim
pkgs.neovim
pkgs.wget
pkgs.curl
pkgs.tmux
pkgs.jq
pkgs.awscli2
];
# Set the default editor to vim
environment.variables.EDITOR = "vim";
# # moved this to the flake
# wsl.enable = true;
# wsl.defaultUser = "nixos";
# 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 = "24.05"; # Did you read the comment?
}
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
nixos-wsl.url = "github:nix-community/NixOS-WSL/main";
};
outputs = { self, nixpkgs, nixos-wsl, ... }: {
nixosConfigurations = {
nixos = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
nixos-wsl.nixosModules.default
{
system.stateVersion = "24.05";
wsl.enable = true;
wsl.defaultUser = "nixos";
}
./configuration.nix
];
};
};
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment