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
.version: don't read from .version
and deduplicate .version-suffix
references
#39416
Conversation
No attempt on aarch64-linux (full log) The following builds were skipped because they don't evaluate on aarch64-linux: osquery Partial log (click to expand)
|
When reading the `nixpkgs` version from `.version` you always have a `\n` at the end because of the final newline. This issue exists since b7d15ed and had to be fixed several times according to the history of `.version`. Furthermore @infinisil recommended I explicitly configured `.editorconfig` to avoid newlines in `.version`.
Success on x86_64-linux (full log) Attempted: osquery Partial log (click to expand)
|
lib/trivial.nix
Outdated
let suffixFile = ../.version-suffix; in | ||
fileContents ../.version | ||
+ (if pathExists suffixFile then fileContents suffixFile else "pre-git"); | ||
nixpkgsVersion = version + suffix; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should adopt a similar naming as the system.nixos
NixOS module is using.
Suggestion:
version
->release
suffix
->versionSuffix
nixpkgsVersion
->version
Maybe prefix some or all with nixpkgs
or nixos
or split out an extra lib namespace for this kind of information?
Any more ideas?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A problem with the renaming is that e.g. the nix repo itself is referring to nixpkgsVersion
, so it will become really painful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess you could keep a compatibility alias for nixpkgsVersion
at least.
No attempt on aarch64-linux (full log) The following builds were skipped because they don't evaluate on aarch64-linux: osquery Partial log (click to expand)
|
Success on x86_64-linux (full log) Attempted: osquery Partial log (click to expand)
|
@dezgeg I guess you're right, we shouldn't break this espcially when it's in |
7d8fe73
to
49f9fa4
Compare
This reverts commit e109784.
The logic regarding the generated `.version-suffix` file is already defined in `lib/trivial.nix` and shouldn't be duplicated in `nixos/version`.
As suggested in NixOS#39416 (comment) the versioning attributes in `lib` should be consistent to `nixos/version` which implicates the following changes: * `lib.trivial.version` -> `lib.trivial.release` * `lib.trivial.suffix` -> `lib.trivial.versionSuffix` * `lib.nixpkgsVersion` -> `lib.version` As `lib.nixpkgsVersion` is referenced several times in `NixOS/nixpkgs`, `NixOS/nix` and probably several user's setups. As the rename will cause a notable impact it's better to keep `lib.nixpkgsVersion` as alias with a warning yielded by `builtins.trace`.
49f9fa4
to
9274ea3
Compare
I added an alias as @dezgeg suggested, furthermore I rebased onto master as my changes in the release notes caused a conflict with master. |
Success on x86_64-linux (full log) Attempted: osquery Partial log (click to expand)
|
No attempt on aarch64-linux (full log) The following builds were skipped because they don't evaluate on aarch64-linux: osquery Partial log (click to expand)
|
As suggested in NixOS#39416 (comment) the versioning attributes in `lib` should be consistent to `nixos/version` which implicates the following changes: * `lib.trivial.version` -> `lib.trivial.release` * `lib.trivial.suffix` -> `lib.trivial.versionSuffix` * `lib.nixpkgsVersion` -> `lib.version` As `lib.nixpkgsVersion` is referenced several times in `NixOS/nixpkgs`, `NixOS/nix` and probably several user's setups. As the rename will cause a notable impact it's better to keep `lib.nixpkgsVersion` as alias with a warning yielded by `builtins.trace`.
Originally introduced in NixOS#39416 (1), however it causes confusion and shouldn't be deprecated (2)(3). /cc @edolstra (1) NixOS#39416 (comment) (2) NixOS@9274ea3#commitcomment-29951594 (3) NixOS/nix#2291
It happened now several times that I very much want to get rid of |
Motivation for this change
See commit messages for further details.
The following changes were done:
fileContents
the problem doesn't exist anymore).version
and.version-suffix
is implemented innixos/version
andlib/trivial.nix
)..version
reference in thepkgs.osquery
derivation (usingstdenv.lib.nixpkgsVersion
now)Running
nix-build nixos/release.nix
produces an output path with the proper version and suffix.Things done
build-use-sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)