Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nixos: introduce system.nixosLabel support #10996

Merged
merged 2 commits into from Jan 9, 2016
Merged

Conversation

oxij
Copy link
Member

@oxij oxij commented Nov 12, 2015

This patch introduces an nixosLabel option that does all you'd want from secure and cheap to modify nixosVersion option (cf. commit messages).

E.g. it allows this:

#!/bin/sh
today=`date +%Y%m%d`
branch=`(cd nixpkgs ; git branch 2>/dev/null | sed -n '/^\* / { s|^\* ||; p; }')`
revision=`(cd nixpkgs ; git rev-parse HEAD)`
export NIXOS_LABEL="$today.$branch-${revision:0:7}"
nixos-rebuild switch

which would generate actually useful GRUB menu entries (I'd say this is so useful that this piece of code should be integrated into nixos-rebuild even, but I'm not sure how one is to marry this with channels).

@bjornfor
Copy link
Contributor

+1. (I'd like to create meaningful entries in GRUB.)

@oxij
Copy link
Member Author

oxij commented Nov 28, 2015 via email

@oxij oxij force-pushed the nixos-label branch 2 times, most recently from 2508fc6 to cab387c Compare December 7, 2015 23:17
@jagajaga
Copy link
Member

jagajaga commented Jan 7, 2016

LGTM
ping @edolstra

@edolstra
Copy link
Member

edolstra commented Jan 7, 2016

Could you add a description to the PR? Now I have to guess what this does :-)

@oxij
Copy link
Member Author

oxij commented Jan 8, 2016 via email

@jagajaga
Copy link
Member

jagajaga commented Jan 8, 2016

LGTM
@edolstra can we merge?

Setting nixosVersion to something custom is useful for meaningful GRUB
menus and /nix/store paths, but actuallly changing it rebulids the
whole system path (because of `nixos-version` script and manual
pages). Also, changing it is not a particularly good idea because you
can then be differentitated from other NixOS users by a lot of
programs that read /etc/os-release.

This patch introduces an alternative option that does all you want
from nixosVersion, but rebuilds only the very top system level and
/etc while using your label in the names of system /nix/store paths,
GRUB and other boot loaders' menus, getty greetings and so on.
@oxij
Copy link
Member Author

oxij commented Jan 8, 2016 via email

@oxij
Copy link
Member Author

oxij commented Jan 9, 2016 via email

@jagajaga
Copy link
Member

jagajaga commented Jan 9, 2016

I needed this feature today, so I merge.

jagajaga added a commit that referenced this pull request Jan 9, 2016
nixos: introduce system.nixosLabel support
@jagajaga jagajaga merged commit c03fe79 into NixOS:master Jan 9, 2016
@oxij oxij deleted the nixos-label branch August 29, 2017 11:20
@oxij oxij mentioned this pull request Feb 10, 2018
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants