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

home switch --update -- --impure silently fails to update #207

Open
ilyagr opened this issue Jan 2, 2025 · 1 comment
Open

home switch --update -- --impure silently fails to update #207

ilyagr opened this issue Jan 2, 2025 · 1 comment

Comments

@ilyagr
Copy link

ilyagr commented Jan 2, 2025

This is a follow-up to #206. This issue has a relatively easy workaround.

The --update flag to nh home switch does not work with -- --impure (the command succeeds, but the update never happens). This seems to
be because it causes nh to invoke

 nix flake update --flake /Users/ilyagr/.config/home-manager/

when it should be

 nix flake update --flake /Users/ilyagr/.config/home-manager/ --impure

Fortunately, there is a workaround of running nix flake update --flake /Users/ilyagr/.config/home-manager/ --impure manually instead of using nh home switch --update.

$  nh home switch -v ~/.config/home-manager/ --update -- --impure
TRACE nh::logging:86: Logging OK
DEBUG nh:32: Main {
    verbose: true,
    command: Home(
        HomeArgs {
            subcommand: Switch(
                HomeRebuildArgs {
                    common: CommonRebuildArgs {
                        dry: false,
                        ask: false,
                        installable: Flake {
                            reference: "/Users/ilyagr/.config/home-manager/",
                            attribute: [],
                        },
                        no_nom: false,
                        out_link: None,
                    },
                    update_args: UpdateArgs {
                        update: true,
                        update_input: None,
                    },
                    configuration: None,
                    extra_args: [
                        "--impure",
                    ],
                    backup_extension: None,
                },
            ),
        },
    ),
}
DEBUG nh:33: NH_VERSION=4.0.0-beta.5 NH_REV=Some("b7a8570")
> Updating all flake inputs
DEBUG nh::commands:97: cmd=Exec { nix flake update --flake /Users/ilyagr/.config/home-manager/ }
error: the path '~/.config/home-manager/home.nix' can not be resolved in pure mode
DEBUG nh::home:47: out_path=("/var/folders/lj/rv4h95_d0mxb9ryztzpz4qph0000gn/T/nh-oswpuJfJ/result", TempDir { path: "/var/folders/lj/rv4h95_d0mxb9ryztzpz4qph0000gn/T/nh-oswpuJfJ" })
DEBUG nh::commands:120: cmd=Exec { nix eval --impure --apply ' x: x ? "[email protected]" ' '/Users/ilyagr/.config/home-manager/#homeConfigurations' }
DEBUG nh::commands:120: cmd=Exec { nix eval --impure --apply ' x: x ? "ilyagr" ' '/Users/ilyagr/.config/home-manager/#homeConfigurations' }
> Building Home-Manager configuration
DEBUG nh::commands:193: cmd=Pipeline { nix build '/Users/ilyagr/.config/home-manager/#homeConfigurations.ilyagr.config.home.activationPackage' --log-format internal-json --verbose --out-link /var/folders/lj/rv4h95_d0mxb9ryztzpz4qph0000gn/T/nh-oswpuJfJ/result --impure | nom --json }
⏱ 3s^C
@ilyagr
Copy link
Author

ilyagr commented Jan 2, 2025

Thinking out loud: looking at b2a9724 , I also wonder what other arguments people would want to pass to nix build by using nh home switch -- extra_args, and whether those arguments make sense for nix eval or nix flake update. I am not sure whether this is an issue. It doesn't affect me, but if that becomes a problem, then maybe the nh home commands do need an --impure flag after all, or they could recognize when -- --impure is present.

@ilyagr ilyagr changed the title home switch --update -- --impure does not work home switch --update -- --impure silently fails to update Jan 4, 2025
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

No branches or pull requests

1 participant