-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
home-manager: add a way to set the priority of the home-manager-path package #4421
Open
e-nikolov
wants to merge
1
commit into
nix-community:master
Choose a base branch
from
e-nikolov:priorities
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
e-nikolov
force-pushed
the
priorities
branch
from
September 15, 2023 13:25
5f4d0f5
to
6de10fa
Compare
2 tasks
e-nikolov
force-pushed
the
priorities
branch
from
December 17, 2023 12:49
0857029
to
9ceaf0f
Compare
…package Adds the --priority flag to the home-manager switch command and the meta.priority module option to allow overriding the default priority of the installed home-manager-path package in the user profile.
e-nikolov
force-pushed
the
priorities
branch
from
December 17, 2023 13:12
9ceaf0f
to
ac8303f
Compare
Thank you for your contribution! I marked this pull request as stale due to inactivity. Please read the relevant sections below before commenting. If you are the original author of the PR
If you are not the original author of the PR
|
Would this fix #5258 ? |
Thank you for your contribution! I marked this pull request as stale due to inactivity. Please read the relevant sections below before commenting. If you are the original author of the PR
If you are not the original author of the PR
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Partially addresses #2995
Adds the --priority flag to the home-manager switch command and the meta.priority module option to allow overriding the default priority of the installed home-manager-path package in the user profile.
One common use-case is in single-user installations of nix in containers or WSL that have no native systemd. Currently it is very difficult to configure home-manager to manage the nix installation. The issue is that the original nix is installed with the default priority of 5 and then home-manager will try to install its own nix with a priority of 5 which will fail due to the priority conflict.
For nix profile install, there is only a way to set the priority while installing a package, and no way to update the priority of an existing package, other than uninstalling it and reinstalling it with a new priority. This is rather difficult when the conflicting package is nix itself. You have to install a second nix with a lower priority, delete the original nix and then install home-manager, configure it to manage a 3rd nix and then delete the second nix.
With the functionality in this PR, it makes this problem easier to solve by installing home-manager packages with a higher priority and then deleting the original nix.
This PR works well for nix profile install, but in the case of nix-env, I think there is no way to atomically install a package and set its priority with the same command. It's only possible to install the package via nix-env --install and then update its priority via nix-env --set-flag priority. If there is already a conflicting package, nix-env --install will fail and we won't be able to reach the nix-env --set-flag part.
In any case, this functionality is more useful in the nix profile case because it does not have a way to update the priority of an existing package, while with nix-env you could lower the priority of the old nix before installing home-manager to avoid the conflict.
I am not sure how to write a proper test that verifies the priority of the resulting package after the nix profile install. Are there any existing tests that do something similar?
Checklist
Change is backwards compatible.
Code formatted with
./format
.Code tested through
nix-shell --pure tests -A run.all
ornix develop --ignore-environment .#all
using Flakes.Test cases updated/added. See example.
Commit messages are formatted like
See CONTRIBUTING for more information and recent commit messages for examples.
If this PR adds a new module
Maintainer CC
@rycee