This config is a take on a productive terminal-driven development environment based on my own preferences. However, it is trivial to customize to your liking both by removing and adding tools that you prefer.
- The default editor is Micro
- The default shell is
fish - Docker desktop on Windows integration is enabled by default
- The prompt is Starship
fzf,lsd,zoxide, andbrootare integrated intofishby default- These can all be disabled easily by setting
enable = falsein home.nix, or just removing the lines all together
- These can all be disabled easily by setting
direnvis integrated intofishby defaultgitconfig is generated in home.nix with options provided to enable private HTTPS clones with secret tokensfishconfig is generated in home.nix and includes a bunch of plugins
From the great book NixOS and Flakes
Before running the commands below, ensure hostname (networking.hostname or wsl.wslConf.network.hostname) and username in your /etc/nixos/configuration.nix are set to a supported value in this config.
git clone git@github.com:maicol07/nixos-config.git $HOME/.config/nixos
sudo mv /etc/nixos /etc/nixos.bak # Backup the original configuration
cd $HOME/.config/nixos
# If /etc/nixos/nixos.bak/hardware-configuration.nix exists, copy it to the new config
if [ -f /etc/nixos.bak/hardware-configuration.nix ]; then
sudo cp /etc/nixos.bak/hardware-configuration.nix "./hardware/<host>/hardware-configuration.nix"
# Add to git (repo is located in $HOME/.config/nixos)
git add "./hardware/<host>/hardware-configuration.nix"
fi
# Deploy choosing the host (note that absolute paths are not strictly required, relative ones are fine too)
# WSL
sudo nixos-rebuild switch --flake $HOME/.config/nixos#maicol07-pc
sudo nixos-rebuild switch --flake $HOME/.config/nixos#maicol07-galaxy
# Server (non WSL)
sudo nixos-rebuild switch --flake $HOME/.config/nixos#maicol07-serverIn order to keep the template as approachable as possible for new NixOS users, this project uses a flat layout without any nesting or modularization.
flake.nixis where dependencies are specifiednixpkgsis the current release of NixOSnixpkgs-unstableis the current trunk branch of NixOS (ie. all the latest packages)home-manageris used to manage everything related to your home directory (dotfiles etc.)nuris the community-maintained Nix User Repositories for packages that may not be available in the NixOS repositorynixos-wslexposes important WSL-specific configuration optionsnix-index-databasetells you how to install a package when you run a command which requires a binary not in the$PATH
common.nixhas common options for all hosts (shell, user, nix, docker, etc.)wsl.nixonly includes WSL-specific options (Docker Desktop integration, nix-ld, Nvidia in WSL)server.nixis a placeholder for non-WSL server-specific settingshome.nixis where home configurations are sethome/programsis the directory that contains all the programs that are installed on the system and their configurationshome/programs/default.nixis the entry point for all the programshome/programs/programs.nixis where all the programs are definedhome/programs/git.nixis where thegitconfiguration is sethome/programs/micro.nixis where themicroconfiguration is set
home/shellis the directory that contains all the shell configurationshome/shell/default.nixis the entry point for all the shell configurationshome/shell/fish.nixis where thefishconfiguration is sethome/starship.tomlis where thestarshipconfiguration is sethome/starship-minimal.tomlis a streamlined version of thestarshipconfiguration that is used from thefish-async-promptplugin
nix flake updateAll switches:
nix profile diff-closures --profile /nix/var/nix/profiles/systemBetween two specific switches:
nix store diff-closures /nix/var/nix/profiles/system-99-link /run/current-systemNote: The numbers are the generations of the system. You can find them with
nix profile history --profile /nix/var/nix/profiles/systemNote 2: If you only have made one switch then you can use the booted system as base:
nix store diff-closures /run/booted-system /run/current-systemgc(from fish alias)