Skip to content

Local nixpkgs derivation added using buildRustPackage#53

Merged
cachebag merged 2 commits intocachebag:masterfrom
joncorv:master
Nov 22, 2025
Merged

Local nixpkgs derivation added using buildRustPackage#53
cachebag merged 2 commits intocachebag:masterfrom
joncorv:master

Conversation

@joncorv
Copy link
Contributor

@joncorv joncorv commented Nov 21, 2025

hi hi hello,

I love this tool. great work.

so for submitting to nixpkgs, external overlays are not allowed, so you must implement buildRustPackage.

So -- this default.nix / package.nix allows you to test locally that your app will compile on the CI / CD platform for nix. From the repository root, you would just need to run "nix build" and it will error if any dependencies are not met. Please note that when the cargo.lock changes the cargoHash String will need to be updated. You'll need to remove the hash to be an empty string for the CLI tool to give you the actual new hash.

Last thing --- for the submission to nixpkgs, this will need to be tweaked with some nix specific hooks, and it will instead of build locally, it will build from your github based on a a tagged version / release. I can help with that, but I would need you to be comfortable with 2 new files in your repository root, or else it's annoying to test your app in the future when new versions are released and the nixpkgs package.nix is updated.

OK Thanks. let me know what you think.

@joncorv joncorv changed the title Local nixpkgs deviation added using buildRustPackage Local nixpkgs derivation added using buildRustPackage Nov 21, 2025
@cachebag cachebag self-requested a review November 21, 2025 18:00
@cachebag cachebag assigned cachebag and joncorv and unassigned cachebag Nov 21, 2025
@cachebag cachebag added the feature New feature or request label Nov 21, 2025
Copy link
Owner

@cachebag cachebag left a comment

Choose a reason for hiding this comment

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

This looks good! I don't mind adding these in I'm happy to support Nix packaging.

My current flake.nix does this right now

nmrs/flake.nix

Line 60 in 31a41f4

packages.default = naersk-package.buildPackage ./.;

I'm not the most adept with this since I don't use Nix; but would you need to replace this with a call to the new package.nix so that nix build uses the actual nixpkgs-style derivation? I currently error out on nix build, which I assume is due to the flake still using naersk.

If so could you throw that patch in here really quick and I'll merge.

Thanks so much again!

@joncorv
Copy link
Contributor Author

joncorv commented Nov 22, 2025

Oh one note -- nix build will default to using flake.nix, and if flake.nix isn't found, only then will it try to find default.nix.

So the command to test the derivation is nix build -f default.nix. That build will match what happens with nixpkgs (except for some exceptions, like that it will build from your github repository instead of locally)

In this circumstance, the way to look at it is so that default.nix and package.nix are for deployment, and shell.nix is the development environment.

@joncorv
Copy link
Contributor Author

joncorv commented Nov 22, 2025

Also fwiw, you may not need this because you're not using nixos for dev, but those dependencies i just added will make your flake.nix work on nixos, especially on systems that aren't running gnome/gtk

@cachebag
Copy link
Owner

@joncorv
Ah! Terrific, thanks! Everything looks good on my end.

@cachebag cachebag merged commit 21e6f11 into cachebag:master Nov 22, 2025
1 check passed
@cachebag cachebag mentioned this pull request Nov 22, 2025
@joncorv
Copy link
Contributor Author

joncorv commented Nov 22, 2025

The holidays are going to hit for me here in the next few days, but I'll get this up on nixpkgs for you when i have a sec. I'm happy to maintain the versioning so nix keeps up with your latest releases too.

I'll add both of us as maintainers on the nixpkgs repository. So if I die, or decide to become a hippy and move into a commune in the middle of nowhere, you'll still be able to go in and update things. It's pretty easy, since you'll just essentially need to update the version number to whatever your version # tag is on your release on Github, and as long as the dependencies haven't changed, it will take care of the rest.

Anyway, cool tool man. Looking forward to having it on Nix!

oh ps --- here is what info goes up in the nixpkgs maintainer repository. just let me know what info to add for you.

List of active NixOS maintainers.

handle = {
  # Required
  name = "Your name";
  github = "GithubUsername";
  githubId = your-github-id;

where

  • handle is the handle you are going to use in nixpkgs expressions,
  • name is a name that people would know and recognize you by,
  • github is your GitHub handle (as it appears in the URL of your profile page, https://github.com/<userhandle>),
  • githubId is your GitHub user ID, which can be found at https://api.github.com/users/<userhandle>,
  • email is your maintainer email address,

here are a few examples of other peoples:

  Acconut = {
    email = "marius@transloadit.com";
    github = "Acconut";
    githubId = 1375043;
    name = "Marius Kleidl";
  };
  acesyde = {
    name = "Pierre-Emmanuel Mercier";
    email = "acesyde@gmail.com";
    github = "acesyde";
    githubId = 958435;
  };

@cachebag
Copy link
Owner

cachebag commented Nov 22, 2025

@joncorv
Much appreciated. Let's hope we both don't die for at least a little while.

Here you go:

 cachebag = {
    email = "alhakimiakrmj@gmail.com";
    github = "cachebag";
    githubId = 111914307;
    name = "Akrm Al-Hakimi";
  };

@joncorv
Copy link
Contributor Author

joncorv commented Dec 2, 2025

ok i just submitted the pull request to nixpkgs. you are added as a maintainer to the repository as well. i'll keep an eye on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants