Alias to checkout the current nixos version

Extracts the hash from the output of `nixos-version`

When changing things in the nixpkgs repo it is often useful to checkout the commit that corresponds to the current system. That helps to avoid rebuilds and therefore saves a lot of time depending on the difference between the current system and HEAD.

Therefore I have created an git alias that extracts the commit hash from nixos-version and checks out this commit.

[alias]
    nixos-version = !git checkout $(nixos-version | awk -F' ' '{print $1}' | rev | cut -c1-7 | rev)

Edit: Use a different approach to extract the hash. The old one was unreliable.

Comments

Kommentare für diesen Eintrag als RSS Feed

No comments

Leave a Reply