R
Railway9mo ago
jeremy

How to specify a fixed version for a nix package

Is there a way to specify a fixed version for nixPkgs? something like this: nixPkgs = ["...", "zlib", "cdo@2.1.1"] At the moment I downgraded nixpacks altogether with nixpacksVersion but not ideal
Solution:
The only way to install specific versions of packages is to change the nix archive version to one where that package version is used. It is far from ideal and something we are working towards improving. This is just a limitation of how Nix works
Jump to solution
20 Replies
Percy
Percy9mo ago
Project ID: N/A
jeremy
jeremy9mo ago
N/A
Brody
Brody9mo ago
oh it's still Sunday, I'll tag jr in tomorrow
jeremy
jeremy9mo ago
yep, no worries, for now downgrading to nixpacksVersion = "1.15.0" fix the problem
Brody
Brody9mo ago
@jr - I swore there was a way to pin individual nix packages to a specific version
jr
jr9mo ago
Will come back to this thread in a few hours. Swamped atm
Brody
Brody9mo ago
no problem, thanks!
jeremy
jeremy9mo ago
A small bump for this, still curious to know if that's possible. Imo, new update of nixpacks had some braking consequences lately (1.16.0, 1.17.0). Not directly because of nixpacks, but because the bump for other packages that it includes. I would rather want to fix all the packages I am using and manually updating them one by one when I want. Similar to a package.json where I define fixed versions for each packages so I don't get some random breaking changes when updating a patch version ^0.0.x
Adam
Adam9mo ago
That’s best practice! I believe you can set package versions using a nixpacks.toml. @Brody am I correct with this?
Adam
Adam9mo ago
doesn’t say anything in the docs, but I believe if you do “packageName-x.x.x” where x is the version number it will work
Brody
Brody9mo ago
I don't know the syntax either, jr definitely would, but if I had to guess it would be packageName@x.x.x
jeremy
jeremy9mo ago
So let’s say I want to fix node version. That would be nodejs_20@20.5.1 I can give it a try, see what it does during build phase
No description
Brody
Brody9mo ago
it's really just a wild guess
jeremy
jeremy9mo ago
it's a nope for @. I tried zlib@1.2.12
nixPkgs = ["...", "bzip2", "zlib@1.2.12", "hdf5", "netcdf", "eccodes", "cdo"]
nixPkgs = ["...", "bzip2", "zlib@1.2.12", "hdf5", "netcdf", "eccodes", "cdo"]
#8 0.510 error: syntax error, unexpected '@'
#8 0.510
#8 0.510 at /app/.nixpacks/nixpkgs-293a28df6d7ff3dec1e61e37cc4ee6e6c0fb0847.nix:19:72:
#8 0.510
#8 0.510 18| '')
#8 0.510 19| bzip2 cdo eccodes hdf5 netcdf nodejs-18_x openssl yarn-1_x zlib@1.2.12
#8 0.510 error: syntax error, unexpected '@'
#8 0.510
#8 0.510 at /app/.nixpacks/nixpkgs-293a28df6d7ff3dec1e61e37cc4ee6e6c0fb0847.nix:19:72:
#8 0.510
#8 0.510 18| '')
#8 0.510 19| bzip2 cdo eccodes hdf5 netcdf nodejs-18_x openssl yarn-1_x zlib@1.2.12
Trying out with a dash now, but very little hope on this syntax
Brody
Brody9mo ago
my 2 cents, nixpacks is great for a lot of things, but if you want total and complete control over every little thing during the build process, a dockerfile can't be beat both apt and apk provide easy methods to specifying the package version to install
jeremy
jeremy9mo ago
And dash doesn't work either. Sure, that's a solution, I just hoped I didn't have to get to it. It's just convenient to have a one-liner in the railway.json file, rather than creating an additional Dockerfile to handle that
Brody
Brody9mo ago
I getcha, and if it's not supported currently, it definitely should be
Solution
jr
jr9mo ago
The only way to install specific versions of packages is to change the nix archive version to one where that package version is used. It is far from ideal and something we are working towards improving. This is just a limitation of how Nix works
Brody
Brody9mo ago
thought so, thanks jr!
Want results from more Discord servers?
Add your server
More Posts