mgorn
November 14, 2023, 10:15pm
1
Hi
I have the following flake
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
};
outputs = { self, nixpkgs, ... }:
let
system = "aarch64-darwin";
pkgs = import nixpkgs {
inherit system;
config = {
permittedInsecurePackages = [ "nodejs-14.21.3" "openssl-1.1.1w" ];
};
};
in
{
devShells.${system}.default = pkgs.mkShell {
buildInputs = with pkgs; [
nodejs-14_x
];
};
};
}
when I run nix develop
I get
My system python is
So I am guessing the flake is pulling the python from
https://search.nixos.org/packages?channel=unstable&show=python3Full&from=0&size=50&sort=relevance&type=packages&query=python3
Is it possible to filter/select nixpkgs in the flake so that an older version of python gets selected?
1 Like
APCodes
November 14, 2023, 10:26pm
2
There are many different versions of python 3 available on nixpkgs. Just pick one you like and put it into your buildInputs
.
For instance python39
or python310
.
mgorn
November 14, 2023, 11:00pm
3
I tried that, for example
Still complains about finding Python 3.11
mgorn
November 14, 2023, 11:04pm
4
Here is the source for node 14
{ callPackage, python3, lib, stdenv, openssl, enableNpm ? true }:
let
buildNodejs = callPackage ./nodejs.nix {
inherit openssl;
python = python3;
};
in
buildNodejs {
inherit enableNpm;
version = "14.21.3";
sha256 = "sha256-RY7AkuYK1wDdzwectj1DXBXaTHuz0/mbmo5YqZ5UB14=";
patches = lib.optional stdenv.isDarwin ./bypass-xcodebuild.diff;
}
is that maybe the problem, that the node 14 source is pulling in python3?
mgorn
November 14, 2023, 11:33pm
5
I’ve added an overlay to the flake
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
};
outputs = { self, nixpkgs, ... }:
let
system = "aarch64-darwin";
pkgs = import nixpkgs {
inherit system;
config = {
permittedInsecurePackages = [ "nodejs-14.21.3" "openssl-1.1.1w" ];
};
overlays = [
(final: prev: { python3 = prev.python310; })
];
};
in
{
devShells.${system}.default = pkgs.mkShell {
buildInputs = [
pkgs.nodejs-14_x
];
};
};
}
my system is now downloading 600mb and building 400 packages. Will report how it went.
1 Like
mgorn
November 15, 2023, 8:12am
6
Ok amazingly this worked. But it seems like a overkill just to install node 14. Should I explore finding a node 14 binary on the net and specifying it as an input to my flake instead? Suggestions from someone more experienced than me? What would something like that look loke?
APCodes
November 15, 2023, 9:14am
7
That appears to be the problem, yes. In my opinion that is a bug in the package. It was probably made when there was no Python 3.11 around.
However that may be, NodeJS 14 has reached end-of-life and might be dropped from nixpkgs at some undefined yet not so distant future date. So it most likely won’t get an update. See this discussion for example:
NixOS:master
← marsam:drop-nodejs_14
opened 03:44PM - 01 Oct 23 UTC
## Description of changes
Node.js 14 has reached End-of-Life (EoL) on 2023-04… -30
<!--
For package updates please link to a changelog or describe changes, this helps your fellow maintainers discover breaking updates.
For new packages please briefly describe the package or provide a link to its homepage.
-->
## Things done
- Built on platform(s)
- [x] x86_64-linux
- [ ] aarch64-linux
- [x] x86_64-darwin
- [ ] aarch64-darwin
- [ ] For non-Linux: Is `sandbox = true` set in `nix.conf`? (See [Nix manual](https://nixos.org/manual/nix/stable/command-ref/conf-file.html))
- [ ] Tested, as applicable:
- [NixOS test(s)](https://nixos.org/manual/nixos/unstable/index.html#sec-nixos-tests) (look inside [nixos/tests](https://github.com/NixOS/nixpkgs/blob/master/nixos/tests))
- and/or [package tests](https://nixos.org/manual/nixpkgs/unstable/#sec-package-tests)
- or, for functions and "core" functionality, tests in [lib/tests](https://github.com/NixOS/nixpkgs/blob/master/lib/tests) or [pkgs/test](https://github.com/NixOS/nixpkgs/blob/master/pkgs/test)
- made sure NixOS tests are [linked](https://nixos.org/manual/nixpkgs/unstable/#ssec-nixos-tests-linking) to the relevant packages
- [ ] 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](https://github.com/Mic92/nixpkgs-review#usage)
- [x] Tested basic functionality of all binary files (usually in `./result/bin/`)
- [23.11 Release Notes](https://github.com/NixOS/nixpkgs/blob/master/nixos/doc/manual/release-notes/rl-2311.section.md) (or backporting [23.05 Release notes](https://github.com/NixOS/nixpkgs/blob/master/nixos/doc/manual/release-notes/rl-2305.section.md))
- [ ] (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
- [x] Fits [CONTRIBUTING.md](https://github.com/NixOS/nixpkgs/blob/master/CONTRIBUTING.md).
<!--
To help with the large amounts of pull requests, we would appreciate your
reviews of other pull requests, especially simple package updates. Just leave a
comment describing what you have tested in the relevant package/service.
Reviewing helps to reduce the average time-to-merge for everyone.
Thanks a lot if you do!
List of open PRs: https://github.com/NixOS/nixpkgs/pulls
Reviewing guidelines: https://nixos.org/manual/nixpkgs/unstable/#chap-reviewing-contributions
-->
And it is flagged insecure for a reason, due to its dependency on openssl-1.1
Once it gets removed from nixpkgs you might want to pin your flake inputs to the last git commit with nodejs 14 still in it.
The problem with getting a random node binary from the web might be that you’d have to create a new nix derivation for that if you want to use them the same way, unless someone else already packaged it correctly somewhere.
If you look at the actual builder for nodejs on nixpkgs you will see that this one, too, builds the C++ from source:
{ lib, stdenv, fetchurl, openssl, python, zlib, libuv, util-linux, http-parser
, pkg-config, which, buildPackages
# for `.pkgs` attribute
, callPackage
# Updater dependencies
, writeScript, coreutils, gnugrep, jq, curl, common-updater-scripts, nix, runtimeShell
, gnupg
, darwin, xcbuild
, procps, icu
}:
{ enableNpm ? true, version, sha256, patches ? [] } @args:
let
inherit (darwin.apple_sdk.frameworks) CoreServices ApplicationServices;
majorVersion = lib.versions.major version;
minorVersion = lib.versions.minor version;
pname = if enableNpm then "nodejs" else "nodejs-slim";
This file has been truncated. show original
mgorn
November 15, 2023, 3:40pm
8
Ok. Since it is about to be removed I will just install node14 the old way and revisit flakes for this project once we’ve managed to get it to a supported version of node. Thanks for the help and the time you spent on this.
1 Like