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-manger: fix runtime closure #5174

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

NobbZ
Copy link
Contributor

@NobbZ NobbZ commented Mar 24, 2024

Description

Without this fix a nix-buid . -A home-manager would successfully
create a home-manager. And one could use the included binary until
the next garbage collection, after that it would fail with an
error that it can not find the home-manager sources.

Similarily a nix-copy-closured home-manager would fail with the
same error on the copies target machine.

This problem existed on both, the flake as well as the non-flake build
of home-manager.

Checklist

  • Change is backwards compatible.

  • Code formatted with ./format.

  • Code tested through nix-shell --pure tests -A run.all or nix develop --ignore-environment .#all using Flakes.

  • 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.

Maintainer CC

@rycee

@pdg137
Copy link

pdg137 commented Mar 24, 2024

Thanks for submitting this fix! I have been using this workaround to get the source dependency properly registered:

  home-manager-src = pkgs.fetchFromGitHub {
    owner = "nix-community";
    repo = "home-manager";
    # 23.11 release
    rev = "652fda4ca6dafeb090943422c34ae9145787af37";
    hash = "sha256-cLbLPTL1CDmETVh4p0nQtvoF+FSEjsnJTFpTxhXywhQ=";
  };

  src-ref-pkg = pkgs.stdenv.mkDerivation {
    name = "source-ref-pkg";
    dontUnpack = true;
    buildPhase = ''
      mkdir $out
      ln -s "${home-manager-src}" $out/src
    '';
  };

  home-manager = pkgs.buildEnv {
    name = "home-manager";
    paths = [
      (import home-manager-src {inherit pkgs;}).home-manager
      src-ref-pkg
    ];
  };

I verified that nix-build https://github.com/nix-community/home-manager/archive/996a74808639cc4084c42e224ae5fcc58c3f0823.zip -A home-manager builds a home-manager with the correct dependencies that can run successfully after a garbage collection.

@sumnerevans sumnerevans requested a review from rycee March 25, 2024 17:03
Without this fix a `nix-buid . -A home-manager` would successfully
create a `home-manager`. And one could use the included binary until
the next garbage collection, after that it would fail with an
error that it can not find the `home-manager` sources.

Similarily a `nix-copy-closure`d `home-manager` would fail with the
same error on the copies target machine.

This problem existed on both, the flake as well as the non-flake build
of `home-manager`.
Copy link

stale bot commented Jul 26, 2024

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

  • GitHub sometimes doesn't notify people who commented / reviewed a PR previously when you (force) push commits. If you have addressed the reviews you can officially ask for a review from those who commented to you or anyone else.
  • If it is unfinished but you plan to finish it, please mark it as a draft.
  • If you don't expect to work on it any time soon, please consider closing it with a short comment encouraging someone else to pick up your work.
  • To get things rolling again, rebase the PR against the target branch and address valid comments.

If you are not the original author of the PR

  • If you want to pick up the work on this PR, please create a new PR and indicate that it supercedes and closes this PR.

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.

2 participants