The quickest way to change your nix configuration
NixOS is great, but it is a bit tedious to always type out vim /etc/nixos/...
etc to make changes to your system, nor do I want a complicated setup for my nix configuration files. So I devised a little script to speed up the progress, which I saved to configure.sh
allowing me to configure NixOS by just opening my terminal and typing ./configure.sh
#!/run/current-system/sw/bin/bash
sudo $EDITOR /etc/nixos/configuration.nix
read -p "Want to apply the config? [y/n]" choice
if [[ "$choice" == "y" ]]; then
nixos-rebuild switch --use-remote-sudo
fi
It will open the nix configuration in the editor of your choice and after finishing your edit session, offer to apply it immediately. $EDITOR
will resolve to nano by default, but you can change it easily by changing the environment variable from your nix config:
environment.variables = {
EDITOR = "hx";
};