16 lines
579 B
Bash
16 lines
579 B
Bash
#!/usr/bin/env bash
|
|
|
|
# modified shamelessly from https://jade.fyi/blog/pinning-nixos-with-npins/
|
|
|
|
cd $(dirname $0)
|
|
|
|
# assume that if there are no args, you want to dry-build the configuration
|
|
cmd=${1:-dry-build}
|
|
shift
|
|
|
|
nixpkgs_pin=$(nix-instantiate --eval --expr 'builtins.storePath (import (import ./npins {}).nixpkgs (import ./nixpkgs-config.nix {})).path' |tr -d \")
|
|
nix_path="nixpkgs=${nixpkgs_pin}:nixos-config=${PWD}/configuration.nix"
|
|
|
|
echo running nixos-rebuild "$cmd" --offline "$@"
|
|
|
|
env NIX_PATH="${nix_path}" NIXPKGS_ALLOW_UNFREE=1 nixos-rebuild "$cmd" "$@" --offline
|