Skip to content

Instantly share code, notes, and snippets.

Last active April 14, 2023 01:11
  • Star 8 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
The simplest Nix Flake for nixos-rebuild
# This can be built with nixos-rebuild --flake .#myhost build
description = "the simplest flake for nixos-rebuild";
inputs = {
nixpkgs = {
# Using the nixos-unstable branch specifically, which is the
# closest you can get to following the equivalent channel with flakes.
url = "github:NixOS/nixpkgs/nixos-unstable";
# Outputs can be anything, but the wiki + some commands define their own
# specific keys. Wiki page:
outputs = { self, nixpkgs }: {
# nixosConfigurations is the key that nixos-rebuild looks for.
nixosConfigurations = {
myhost = nixpkgs.lib.nixosSystem {
# A lot of times online you will see the use of flake-utils + a
# function which iterates over many possible systems. My system
# is x86_64-linux, so I'm only going to define that
system = "x86_64-linux";
# Import our old system configuration.nix
modules = [
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment