Skip to content

Conversation

@gepbird
Copy link
Contributor

@gepbird gepbird commented Apr 19, 2025

Depends on #399817

See #399817 (comment) as a use case

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 25.05 Release Notes (or backporting 24.11 and 25.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@github-actions github-actions bot added 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. labels Apr 19, 2025
@nix-owners nix-owners bot requested a review from ymstnt April 19, 2025 08:39
@gepbird gepbird force-pushed the pocket-id-overridable branch from 1d22853 to b475ba6 Compare April 19, 2025 09:05
@github-actions github-actions bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux. and removed 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. labels Apr 19, 2025
Copy link
Member

Choose a reason for hiding this comment

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

Is it by design that these attributes are still outside of finalAttrs scope?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If you're talking about the attributes in the let block, I'd like to keep them there, inherit them in the final derivation, and reference them with finalAttrs, I think it's more readable. I prefer not declaring those in the main derivation. If I missed your point, can you please clarify it?

Copy link
Member

@Aleksanaa Aleksanaa Apr 19, 2025

Choose a reason for hiding this comment

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

For example, if you put them into finalAttrs, when you have to change source version, you can easily override them with

pocket-id.overrideAttrs (prev: {
  version = "0.49.0";

  src = prev.src.overrideAttrs {
    hash = "";
  };

  backend = prev.backend.overrideAttrs {
    vendorHash = "";
  };

  frontend = prev.frontend.overrideAttrs {
    npmDepsHash = "";
  };
})

So we don't have to copy definition of backend and frontend again.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see your point now. When overriding nested attributes, eg. pocket-id.frontend.src, one should be able to do:

pocket-id.overrideAttrs (prev: {
  src = prev.fetchFromGitHub {
    hash = "";
  };
})

instead of:

pocket-id.overrideAttrs (prev: {
  frontend = prev.frontend.overrideAttrs {
    src = prev.fetchFromGitHub {
      hash = "";
    };
  };
};

Thanks for the idea, it's much simpler to use!

@gepbird gepbird force-pushed the pocket-id-overridable branch from b475ba6 to c07b1a9 Compare April 19, 2025 16:07
Copy link
Contributor

@marcusramberg marcusramberg left a comment

Choose a reason for hiding this comment

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

lgtm! :)

@wegank wegank added the 12.approvals: 1 This PR was reviewed and approved by one person. label Apr 19, 2025
@Aleksanaa Aleksanaa merged commit 4d61ccc into NixOS:master Apr 20, 2025
24 of 28 checks passed
@gepbird gepbird deleted the pocket-id-overridable branch April 20, 2025 07:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux. 12.approvals: 1 This PR was reviewed and approved by one person.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants