Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
By default, Nix Flake Checker will reject Nixpkgs branches that have their status set to "beta" or "unmaintained". All other statuses are allowed. That policy works well most of the time, but there are some situations where that policy is undesirable. Here are some examples: 1. A user might want Nix Flake Checker to give them an error if they’re using a deprecated Nixpkgs branch. This way, Nix Flake Checker will remind the user to update before a branch becomes unmaintained. (This is what I want to do, personally). 2. A user might want to upgrade to a Nixpkgs branch while that branch is in beta. This way, the user can report issues with a particular NixOS, and (hopefully) get those issues fixed before that NixOS release is declared stable. (This is what @dpc wants to do [1][2]). 3. An organisation might want to forbid the use of rolling branches. This way, the organisation only has to deal with breaking changes once every six months. Before this change, here’s what you would need to do in order to make Nix Flake Checker enforce those three policies: 1. flake-checker --condition "supportedRefs.contains(gitRef) && !(gitRef.contains('24.05'))" 2. flake-checker --condition "supportedRefs.contains(gitRef) || gitRef.contains('24.11')" 3. flake-checker --condition "supportedRefs.contains(gitRef) && !(gitRef.contains('unstable'))" Number 1 and 2 are especially problematic because they must manually be updated whenever new channels are created or an existing channel’s status changes. This change adds a new CEL variable named refStatuses. refStatuses makes it easier to override Nix Flake Checker’s default policy for allowed branches. Here’s how you would implement those three policies using the new refStatuses variable. 1. flake-checker --condition "supportedRefs.contains(gitRef) && refStatuses[gitRef] != 'deprecated'" 2. flake-checker --condition "supportedRefs.contains(gitRef) || refStatuses[gitRef] == 'beta'" 3. flake-checker --condition "supportedRefs.contains(gitRef) && refStatuses[gitRef] != 'rolling'" [1]: DeterminateSystems/flake-checker-action#47 [2]: #149
- Loading branch information