Skip to content

Instantly share code, notes, and snippets.

@misuzu
misuzu / flake.nix
Last active Jan 10, 2023
Migrate NixOS from channels to flakes (with home-manager)
View flake.nix
# https://www.tweag.io/blog/2020-07-31-nixos-flakes/
# To switch from channels to flakes execute:
# cd /etc/nixos
# sudo wget -O flake.nix https://gist.githubusercontent.com/misuzu/80af74212ba76d03f6a7a6f2e8ae1620/raw/flake.nix
# sudo git init
# sudo git add . # won't work without this
# nix-shell -p nixFlakes --run "sudo nix --experimental-features 'flakes nix-command' build .#nixosConfigurations.$(hostname).config.system.build.toplevel"
# sudo ./result/bin/switch-to-configuration switch