Skip to content

home-manager-auto-upgrade#8353

Merged
khaneliman merged 6 commits into
nix-community:masterfrom
s0racat:home-manager-auto-upgrade
Apr 23, 2026
Merged

home-manager-auto-upgrade#8353
khaneliman merged 6 commits into
nix-community:masterfrom
s0racat:home-manager-auto-upgrade

Conversation

@s0racat
Copy link
Copy Markdown
Contributor

@s0racat s0racat commented Dec 15, 2025

Description

Checklist

  • Change is backwards compatible.

  • Code formatted with nix fmt or
    nix-shell -p treefmt nixfmt deadnix keep-sorted --run treefmt.

  • Code tested through nix run .#tests -- test-all or
    nix-shell --pure tests -A run.all.

  • Test cases updated/added. See example.

  • [] Commit messages are formatted like

    {component}: {description}
    
    {long description}
    

    See CONTRIBUTING for more information and recent commit messages for examples.

  • If this PR adds a new module

    • Added myself as module maintainer. See example.
    • Generate a news entry. See News
    • Basic tests added. See Tests
  • If this PR adds an exciting new feature or contains a breaking change.

    • Generate a news entry. See News

@home-manager-ci home-manager-ci Bot requested a review from pinage404 December 15, 2025 13:27
@s0racat s0racat changed the title Home manager auto upgrade home-manager-auto-upgrade Dec 15, 2025
@pinage404
Copy link
Copy Markdown
Contributor

I don't use it since a while

Could you remove me as a maintainer please ?

I may review later

@s0racat
Copy link
Copy Markdown
Contributor Author

s0racat commented Dec 16, 2025

I don't use it since a while

Could you remove me as a maintainer please ?

I may review later

I removed you from the maintainers and added me.
Review this PR please.
Thanks.

@s0racat
Copy link
Copy Markdown
Contributor Author

s0racat commented Dec 16, 2025

Please do not merge this pull request.
I'll try to improve module and eliminate error

@s0racat
Copy link
Copy Markdown
Contributor Author

s0racat commented Dec 17, 2025

@pinage404
I’ve finished fixing this module.
Please review it.

Comment thread modules/services/home-manager-auto-upgrade.nix Outdated
Comment on lines +150 to +151
- null: use legacy behavior (deprecated)
- []: run no pre-switch commands
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

thought(non-blocking): i am surprised,i think i have never seen this kind of behavior before in Nix's options

i would not be surprise to have another option like behavior with values legacy or explicit

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Changed to use legacy behavior when preSwitchCommands is not set (=null).
I also find this implementation confusing

Comment thread modules/services/home-manager-auto-upgrade.nix Outdated
echo "Changing to flake directory $FLAKE_DIR"
cd "$FLAKE_DIR"
echo "Update flake inputs"
nix flake update
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

thought(non-blocking): maybe this should go in the preSwitchScript

What do you think about it ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

These lines are not included in the latest changes.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sorry, i put the comment in the wrong line

Unit.Description = "Home Manager upgrade";
Unit = {
Description = "Home Manager upgrade";
X-SwitchMethod = "keep-old";
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

question(blocking): i don't understand this line :

  • What is the purpose of it ?
  • Is it a standard thing of SystemD ?
  • Is it a standard thing of Home Manager ?
  • Do there is any doc about it somewhere ?

I would prefer to understand every line before approving something

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks !

@pinage404
Copy link
Copy Markdown
Contributor

Maybe it could be worth to add a note in the release notes ?

@s0racat
Copy link
Copy Markdown
Contributor Author

s0racat commented Jan 11, 2026

Maybe it could be worth to add a note in the release notes ?

It might be good to add.

echo "Changing to flake directory $FLAKE_DIR"
cd "$FLAKE_DIR"
echo "Update flake inputs"
nix flake update
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sorry, i put the comment in the wrong line

Comment on lines +74 to 75
echo "Update Nix channels"
nix-channel --update
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

thought(non-blocking): maybe this should go in the preSwitchScript

What do you think about it ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I thought nix-channel --update was required for non-flake users.
Is there any other good way to implement it?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Maybe they could have manually pinned every dependency in their repo and would like to override with a simpler git pull ?

Unit.Description = "Home Manager upgrade";
Unit = {
Description = "Home Manager upgrade";
X-SwitchMethod = "keep-old";
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks !

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't know the standard format for this, i will let home-manager's maintainer check this

Copy link
Copy Markdown
Collaborator

@khaneliman khaneliman left a comment

Choose a reason for hiding this comment

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

Please fixup/squash commits to follow contribution guidelines.

Comment thread modules/misc/news/2026/01/2026-01-13_10-11-50.nix Outdated
Comment thread modules/services/home-manager-auto-upgrade.nix
@s0racat s0racat requested a review from khaneliman January 25, 2026 05:05
@s0racat
Copy link
Copy Markdown
Contributor Author

s0racat commented Jan 27, 2026

pr status ?
please rereview code @khaneliman

@s0racat
Copy link
Copy Markdown
Contributor Author

s0racat commented Mar 4, 2026

could you like to review code @khaneliman

@khaneliman khaneliman force-pushed the home-manager-auto-upgrade branch 2 times, most recently from b4d785a to 2185669 Compare April 22, 2026 23:42
s0racat added 5 commits April 22, 2026 18:45
Add a flags option for passing extra arguments to home-manager
switch and a preSwitchCommands option for running commands before the
switch.

Preserve the legacy flake update behavior behind a deprecation warning,
clean up the shell script, and cover the flake path in tests.
Improve the option descriptions for enable, useFlake, flakeDir,
and the systemd timer format.
Document the new flags and preSwitchCommands options for the
auto-upgrade service.
@khaneliman khaneliman force-pushed the home-manager-auto-upgrade branch from 2185669 to a525c56 Compare April 22, 2026 23:45
Migrate the preSwitchCommands default to
lib.hm.deprecations.mkStateVersionOptionDefault instead of using a
null sentinel.

Keep the legacy flake update behavior for older state versions and add
tests for the explicit, legacy, and current flake paths.
@khaneliman
Copy link
Copy Markdown
Collaborator

Alright, organized the commits and migrated the default deprecation to use my new state version helper.

@s0racat
Copy link
Copy Markdown
Contributor Author

s0racat commented Apr 23, 2026

thank you for fixing!

@khaneliman khaneliman merged commit 667b3c4 into nix-community:master Apr 23, 2026
8 checks passed
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.

bug: home-manager-auto-upgrade service is stopped by reloadSystemd.

3 participants