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

[RFC] Add lifecycle stages to nixpkgs #22096

Closed
wants to merge 10 commits into from

Conversation

moretea
Copy link
Contributor

@moretea moretea commented Jan 24, 2017

This morning, we chatted a bit in the IRC channel about how we could inform users that the channel that they are using is out of date. @grahamc offered to maintain 16.09 one more month after 17.03 is released, to provide some time for people to upgrade to the new stable release, before it becomes unsupported.

Adding lifecycles to nixpkgs

The idea is that a nix-channel evolves over time:

unstable --> stable --> deprecated --> unsupported

It is branched of master, undergoes stabilization after which it will be maintained until $NEXT_RELEASE_DATE. Then it becomes deprecated for one month (whilst we still maintain it). After $NEXT_RELEASE_DATE + 1 month it will be unsupported.

Once a channel becomes deprecated, users should be shown a warning telling them to upgrade, and inform them when the channel will become unsupported.

Once a channel is unsupported, evaluation should be prevented by an builtins.abort. The abort message should include pointers on how to get the latest version of that release working.


I understand that aborting is quite a heavy tool to use. I'm open to alternative suggestions. My main problem with builtins.trace is that it's quite hard to discover when you go for a cup of coffee and don't bother to scroll back up to the nix evaluation part.

@grahamc
Copy link
Member

grahamc commented Jan 24, 2017

I like it, but hard 👎 on actually preventing evaluation.

@moretea
Copy link
Contributor Author

moretea commented Jan 24, 2017

We could try to get some logging primitive into nix (see NixOS/nix#1197)

@dezgeg
Copy link
Contributor

dezgeg commented Jan 24, 2017

You could block evaluation by default but have it allowed with setting some option iKnowIAmRunningOldVersion = "16.09"; or something.

@edolstra
Copy link
Member

I don't like Nix evaluation to print huge messages (or in fact any messages) because these end up spamming my console every time I run a Nix command. (In fact, commands like nixos-rebuild may well show the same message multiple times.)

As to the implementation, why not just put the check in /default.nix? There's already a version check there. We don't need a hidden file plus a library function that isn't actually generic enough to put in the library.

It may also be more appropriate to put the check in the NixOS evaluation (where we already have an assertion / warnings mechanism). After all, we have stable NixOS channels, not Nixpkgs channels.

@LnL7
Copy link
Member

LnL7 commented Jan 24, 2017

I also disagree with aborting evaluation of and old release, but warning people about it is great!

@grahamc
Copy link
Member

grahamc commented Jan 24, 2017

@edolstra I can be on board with not Nix evals printing messages. Wouldn't moving it to default.nix do the same thing? Do you have a different suggestion on how to get the word out? Example: we could make nixos-rebuild itself do this.

@moretea
Copy link
Contributor Author

moretea commented Jan 24, 2017

I've looked into the assertion / warning mechanism in the module system. It suffers from the same problem as using builtins.trace itself; the warning is completely hidden by the build output that comes after this.

image

(which is followed by many pages of build output)

I do like the suggestion to put it in the nixos module system.
What about putting it in nixos/modules/misc/version.nix?

@nbp nbp mentioned this pull request Feb 26, 2017
4 tasks
@moretea
Copy link
Contributor Author

moretea commented Mar 6, 2017

The previous few commits implement a new approach.

The warnings are now collected into both a warnings.json file and a warnings.txt.raw file. The latter one is printed in the activation script.

I've added the warnings.json as well, so that other tools might be able to inspect them.


We probably should make nixos-rebuild print these warnings, and then pass a flag to the activation script to not print those warnings again.
This would make it possible to see the warning every time you'd switch to a problematic profile, but still prevent printing the same warning twice.

Copy link
Member

@grahamc grahamc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, can you show an example of what this looks like during a rebuild?

I also wonder what it'll take to backport this to ancient versions of NixOS, but this isn't any reason to not do this.

in the root of the git repository.
</para>
<para>
Wether or not the old stable should be marked deprecated or unsupported depends on
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whether

</para>
<para>
Wether or not the old stable should be marked deprecated or unsupported depends on
which commitments the security team is willing to make.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@moretea
Copy link
Contributor Author

moretea commented Mar 6, 2017

I included a screenshot of how it would look like below.
image

As you see, the warning is not outputted during the nix evaluation phase, but outputted in the activation script.

Reproduce it by:

  1. echo 'deprecated' > .version-unsupported-state
  2. $(NIX_PATH=nixpkgs=$(pwd):nixos-config=$(pwd)/configuration.nix nix-build nixos -A system)/bin/switch-to-configuration dry-activate
  3. Creating a configuration.nix with the following content.
{ config, pkgs, ... }: {
  fileSystems."/" = {
    device = "/dev/sda1";
    fsType = "ext4";
  };

  boot.loader.grub.enable = true;
  boot.loader.grub.device = "/dev/sda";
}

@nbp
Copy link
Member

nbp commented Mar 6, 2017

One suggestion I have, is that any message which tells the user that something is wrong should also provide enough information such that the user can fix the issue such as a link to some documentation.

Each NixOS branch will have a .version-state.nix file, which will have
an attribute "state" that is either set to "supported", "deprecated"
or "unsupported".

If the state is not equal to "supported", a warning will be generated.

Optionally, it can include a "description" attribute that can be used
to communicate to the end user. E.g. how to upgrade to the newer
release.
@moretea
Copy link
Contributor Author

moretea commented Mar 7, 2017

@nbp a very valid point. I've incorporated that.

I'll split the PR in two separate ones; one containing the NixOS state part, and the other will contain the change in reporting warnings.

@Profpatsch
Copy link
Member

Ah, I guess then I can scrap the code I started writing a few days ago. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants