Nixos without channels

i derived my setup from

and i thought that i saw a discussion that something changed what can be passed to nix so that the build script can be simplified.
the current build script is:

#!/usr/bin/env bash
set -euo pipefail

# nix-instantiate --eval has no raw mode yet
nixpkgsPath=$(nix-instantiate --eval --read-write-mode nixpkgs/path.nix | tr -d \")
# Get the ./root.nix relative to this script
configPath=$(realpath -- "$(dirname -- "${BASH_SOURCE[0]}")/root.nix")

# nixos-rebuild always reads Nixpkgs from the NIX_PATH,
# so we need to set it explicitly to our pinned version
exec nixos-rebuild "$@" -I nixpkgs="$nixpkgsPath" -I nixos-config="$configPath"

is it true that there was such a change?

It might have been system.nix, see Curious about system.nix

5 Likes

Yes, now nixos-rebuild and nixos-install support building from a .nix file (system.nix by convention). So, you don’t have to use that script anymore.

Check out man nixos-rebuild, specifically --file and --attr and see this example system.nix.

1 Like

Here’s my system.nix

2 Likes