| 6 Feb 2024 |
ghpzin | Did you git add that file ? | 10:49:59 |
Nicola Squartini | yes, here is the flake:
{
description = "Blog";
inputs = {
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
};
outputs = { flake-utils, nixpkgs, self }:
flake-utils.lib.eachDefaultSystem (system:
let pkgs = import nixpkgs { inherit system; }; in
{
devShells.default = pkgs.mkShell {
packages = with pkgs; [
nodejs_21
prefetch-npm-deps
];
};
formatter = pkgs.nixpkgs-fmt;
packages.default =
let
packageJson = builtins.fromJSON (builtins.readFile ./package.json);
in
pkgs.buildNpmPackage {
pname = packageJson.name;
version = packageJson.version;
npmDepsHash = "sha256-gjQCVQI7Tp+L6ZF9phJFZQaaPwtPDp0xVOYMF+CPHIg=";
src = ./.;
BUILD_ID = self.rev or self.dirtyRev;
NEXT_TELEMETRY_DISABLED = 1;
#installPhase = ''
# runHook preInstall
# cp -r out $out
# runHook postInstall
#'';
};
}
);
}
| 10:50:29 |
Nicola Squartini | nix build works as long as I don't add local imports | 10:51:02 |
Nicola Squartini | imports from node_modules don't have issues | 10:51:38 |
Nicola Squartini | In reply to @9hp71n:matrix.org Did you git add that file ? ahh, you are right! I actually forgot to add that fiel | 10:54:29 |
Nicola Squartini | sorry about that | 10:55:04 |
Nicola Squartini | thank you so much 🙏 | 10:56:39 |
| 8 Feb 2024 |
@adis:blad.is | Is there any rationale for keeeping buildNpmPackage around anymore? Imo it should be dropped in favour of just using stdenv.mkDerivation | 01:26:21 |
@kranzes:matrix.org | Explain | 03:12:07 |
@kranzes:matrix.org | Is this because of npmHooks? | 03:12:36 |
@kranzes:matrix.org | Or whatever that's called | 03:12:47 |
@kranzes:matrix.org | I don't mind buildNpmPackage | 03:13:12 |
@adis:blad.is | In reply to @kranzes:matrix.org Is this because of npmHooks? This is because it's not really doing much, so it's a functional stdenv abstraction for not much gain | 04:11:08 |
@adis:blad.is | Essentially it's just this:
stdenv.mkDerivation (args // {
inherit npmDeps npmBuildScript;
nativeBuildInputs = nativeBuildInputs
++ [ nodejs npmConfigHook npmBuildHook npmInstallHook nodejs.python ]
++ lib.optionals stdenv.isDarwin [ darwin.cctools ];
buildInputs = buildInputs ++ [ nodejs ];
strictDeps = true;
# Stripping takes way too long with the amount of files required by a typical Node.js project.
dontStrip = args.dontStrip or true;
meta = (args.meta or { }) // { platforms = args.meta.platforms or nodejs.meta.platforms; };
})
| 04:11:32 |
@adis:blad.is | My take is: Just use the hooks | 04:12:49 |
@adis:blad.is | stdenv.mkDerivation wrappers are an anti-pattern | 04:13:19 |
@adis:blad.is | Using the hooks is more composable as well | 04:14:06 |
@adis:blad.is | It makes it possible to for example build a Go application backend and the web frontend all in one derivation | 04:14:58 |
@adis:blad.is | That's already possible mind you | 04:15:36 |
@adis:blad.is | But because we have buildNpmPackage that's not as obvious as it could be | 04:15:42 |
| 10 Feb 2024 |
Pol | Hey, I'm trying to build a NPM package here: https://github.com/NixOS/nixpkgs/pull/287527
Can you have a look at the build log in the first post and give some pointers and/or documentation ? | 08:45:01 |
@julia:the-apothecary.club | looks like you solved your issue? | 09:35:04 |
Sandro 🐧 | Reducing dependencies of applications that use yarn
https://github.com/NixOS/nixpkgs/pull/281902 | 13:17:17 |
Pol | In reply to @julia:the-apothecary.club looks like you solved your issue? Not yet. | 22:50:40 |
Pol | Apparently it doesn't find jq and sponge, but those dependencies are in nativeBuildInputs, I don't understand why it doesn't find it. | 22:51:38 |
Pol | See the log :https://github.com/NixOS/nixpkgs/pull/287527/checks?check_run_id=21438575929 | 22:51:42 |
Pol | I've also open an issue here: https://github.com/NixOS/nixpkgs/pull/287894 | 23:11:03 |
Pol | In reply to @drupol:matrix.org Apparently it doesn't find jq and sponge, but those dependencies are in nativeBuildInputs, I don't understand why it doesn't find it. I got rid of jq and sponge, so that issue is no more relevant! | 23:13:14 |
| 11 Feb 2024 |
@julia:the-apothecary.club | In reply to @drupol:matrix.org See the log :https://github.com/NixOS/nixpkgs/pull/287527/checks?check_run_id=21438575929 hmm. I mean it looks like a specific package is failing to build. what's the build output locally?
it's a build hard to tell from the ofborg logs because nix builds things in parallel | 03:10:17 |
@julia:the-apothecary.club | doing it locally means the builds which succeed get saved and you can more easily ignore the good ones | 03:10:43 |