!NhAsaYbbgmzHtXTPQJ:funklause.de

Nix NodeJS

213 Members
63 Servers

Load older messages


SenderMessageTime
24 Jul 2023
@janne.hess:helsinki-systems.deJanne Heß
{ lib
, stdenv
, fetchFromGitHub
, gitMinimal
, cacert
, yarn
, makeBinaryWrapper
, nodejs
, nodePackages
, python3
, nixosTests
}: let

  version = "1.9.8";

  src = fetchFromGitHub {
    owner = "hedgedoc";
    repo = "hedgedoc";
    rev = version;
    sha256 = "sha256-gp1TeYHwH7ffaSMifdURb2p+U8u6Xs4JU4b4qACEIDw=";
  };

  offlineCache = stdenv.mkDerivation {
    name = "hedgedoc-${version}-offline-cache";
    inherit src;

    nativeBuildInputs = [
      cacert # needed for git
      gitMinimal # needed for a dep
      nodePackages.npm # needed for a dep
      yarn
    ];

    HOME = "/build";
    buildPhase = ''
      yarn config set enableTelemetry 0
      yarn config set cacheFolder $out
      yarn
    '';

    outputHashMode = "recursive";
    outputHash = "sha256-4TPc9J9u0rO9WfZVbFWwVAM5WY3n5zJdhIlNYiZNRoM=";
  };

in stdenv.mkDerivation rec {
  pname = "hedgedoc";
  inherit version src;

  nativeBuildInputs = [
    makeBinaryWrapper
    yarn
    python3 # needed for sqlite node-gyp
  ];
  extraBuildInputs = [ python3 ];

  dontConfigure = true;

  HOME = "/build";
  buildPhase = ''
    runHook preBuild

    yarn config set enableTelemetry 0
    yarn config set cacheFolder ${offlineCache}

    # This will fail but create the sqlite3 files we can patch
    yarn --immutable-cache || :

    # Ensure we don't download any node things
    sed -i 's:--fallback-to-build:--build-from-source --nodedir=${nodejs}/include/node:g' node_modules/sqlite3/package.json
    export CPPFLAGS="-I${nodejs}/include/node"

    # Perform the actual install
    yarn --immutable-cache
    yarn run build

    patchShebangs bin/*

    runHook postBuild
  '';

  installPhase = ''
    runHook preInstall

    mkdir -p $out
    cp -R {app.js,bin,lib,locales,node_modules,package.json,public} $out

    makeWrapper ${nodejs}/bin/node $out/bin/hedgedoc \
      --add-flags $out/app.js \
      --set NODE_ENV production \
      --set NODE_PATH "$out/lib/node_modules"

    runHook postInstall
  '';

  passthru = {
    tests = { inherit (nixosTests) hedgedoc; };
  };

  meta = with lib; {
    description = "Realtime collaborative markdown notes on all platforms";
    license = licenses.agpl3;
    homepage = "https://hedgedoc.org";
    maintainers = with maintainers; [ SuperSandro2000 ];
    platforms = platforms.linux;
  };
}
08:17:43
@janne.hess:helsinki-systems.deJanne Heß(also cleaned up the wrapper and added NODE_ENV)08:18:13
@janne.hess:helsinki-systems.deJanne Heß *
{ lib
, stdenv
, fetchFromGitHub
, gitMinimal
, cacert
, yarn
, makeBinaryWrapper
, nodejs
, nodePackages
, python3
, nixosTests
}: let

  version = "1.9.8";

  src = fetchFromGitHub {
    owner = "hedgedoc";
    repo = "hedgedoc";
    rev = version;
    hash = "sha256-gp1TeYHwH7ffaSMifdURb2p+U8u6Xs4JU4b4qACEIDw=";
  };

  offlineCache = stdenv.mkDerivation {
    name = "hedgedoc-${version}-offline-cache";
    inherit src;

    nativeBuildInputs = [
      cacert # needed for git
      gitMinimal # needed for a dep
      nodePackages.npm # needed for a dep
      yarn
    ];

    HOME = "/build";
    buildPhase = ''
      yarn config set enableTelemetry 0
      yarn config set cacheFolder $out
      yarn
    '';

    outputHashMode = "recursive";
    outputHash = "sha256-4TPc9J9u0rO9WfZVbFWwVAM5WY3n5zJdhIlNYiZNRoM=";
  };

in stdenv.mkDerivation rec {
  pname = "hedgedoc";
  inherit version src;

  nativeBuildInputs = [
    makeBinaryWrapper
    yarn
    python3 # needed for sqlite node-gyp
  ];
  extraBuildInputs = [ python3 ];

  dontConfigure = true;

  HOME = "/build";
  buildPhase = ''
    runHook preBuild

    yarn config set enableTelemetry 0
    yarn config set cacheFolder ${offlineCache}

    # This will fail but create the sqlite3 files we can patch
    yarn --immutable-cache || :

    # Ensure we don't download any node things
    sed -i 's:--fallback-to-build:--build-from-source --nodedir=${nodejs}/include/node:g' node_modules/sqlite3/package.json
    export CPPFLAGS="-I${nodejs}/include/node"

    # Perform the actual install
    yarn --immutable-cache
    yarn run build

    patchShebangs bin/*

    runHook postBuild
  '';

  installPhase = ''
    runHook preInstall

    mkdir -p $out
    cp -R {app.js,bin,lib,locales,node_modules,package.json,public} $out

    makeWrapper ${nodejs}/bin/node $out/bin/hedgedoc \
      --add-flags $out/app.js \
      --set NODE_ENV production \
      --set NODE_PATH "$out/lib/node_modules"

    runHook postInstall
  '';

  passthru = {
    tests = { inherit (nixosTests) hedgedoc; };
  };

  meta = with lib; {
    description = "Realtime collaborative markdown notes on all platforms";
    license = licenses.agpl3;
    homepage = "https://hedgedoc.org";
    maintainers = with maintainers; [ SuperSandro2000 ];
    platforms = platforms.linux;
  };
}
08:45:42
@sandro:supersandro.deSandro 🐧 I can take a look later at this, maybe you can already create a PR.
Thanks for digging into this
09:56:34
25 Jul 2023
@federicodschonborn:matrix.orgFederico Damián Schonborn changed their profile picture.01:56:41
@hexa:lossy.networkhexaUh, have we found a solution out of the missing integrity debacle?17:23:57
@hexa:lossy.networkhexa upstream issues seems to be going nowhere17:27:27
@hexa:lossy.networkhexa something like cargoLock.outputHashes would be great 17:28:55
@hexa:lossy.networkhexaI can create an issue, if we want to track this better than me rambling in this room17:29:26
@lily:lily.flowersLily Foster
In reply to @hexa:lossy.network
I can create an issue, if we want to track this better than me rambling in this room
Yeah, feel free to make an issue and add it to our To-Do project board and ping me. I have a rough plan that I can outline in the issue, but I just need to sit down and finish refactoring prefetch-npm-deps enough to implement it (so having an issue to track is probably a good idea)
20:20:55
@huantian:huantian.devhuantianthreading time, it seems build is failing on hydra again? 22:51:47
@huantian:huantian.devhuantianbut it just built fine on my system22:51:56
27 Jul 2023
@ribosomerocker:matrix.orgribosomerocker joined the room.03:04:29
28 Jul 2023
@hexa:lossy.networkhexa gdamjan: incoming security issues for several appservices 14:22:23
@hexa:lossy.networkhexaimage.png
Download image.png
14:22:24
@hexa:lossy.networkhexawondering if you can expedite your efforts 😕14:22:36
@gdamjan:spodeli.orggdamjan:/14:22:43
@gdamjan:spodeli.orggdamjandid go too far14:22:47
@gdamjan:spodeli.orggdamjan * didn't go too far14:22:53
@gdamjan:spodeli.orggdamjanwhatever happened with that yarn2nix issue?15:11:16
@lily:lily.flowersLily Foster
In reply to @gdamjan:spodeli.org
whatever happened with that yarn2nix issue?
Which one?
15:22:56
@lily:lily.flowersLily FosterFor v2 lockfiles?15:23:01
@gdamjan:spodeli.orggdamjan no, it was about installing only the older version of a dependency when there were two versions of ajv in yarn.lock (one is direct dependency, the other is a deep dependency) 15:25:23
@lily:lily.flowersLily Foster Oh, is it a yarn2nix problem or fetchYarnDeps problem? (If there is an open nixpkgs issue can you link it so I can add it to our project board too?) 15:26:25
@gdamjan:spodeli.orggdamjanthere probably isn't. not by me anyway15:27:00
@lily:lily.flowersLily Foster
In reply to @gdamjan:spodeli.org
there probably isn't. not by me anyway
If you have the relevant info, would you mind opening one so I can add it then? Thank you! ❤️
15:27:50
@gdamjan:spodeli.orggdamjanyeah sure. can you send me a similar bug report so I know not to miss anything?15:28:32
@gdamjan:spodeli.orggdamjan it's a yarn2nix issue (it's what mkYarnPackage is using right) 15:29:56
@lily:lily.flowersLily Foster
In reply to @gdamjan:spodeli.org
it's a yarn2nix issue (it's what mkYarnPackage is using right)
You can use fetchYarnDeps with mkYarnPackage (in fact I'm pretty sure it was added originally for that reason, to avoid needing to vendor yarn.lock/yarn.nix when using mkYarnPackage). But if you aren't using fetchYarnDeps anywhere then yeah it's strictly a yarn2nix problem
15:32:12
@lily:lily.flowersLily Foster
In reply to @gdamjan:spodeli.org
yeah sure. can you send me a similar bug report so I know not to miss anything?

I mean here was a recent nodejs-related issue, if that's what you're asking for: https://github.com/NixOS/nixpkgs/issues/244285

I mostly just want a derivation to reproduce

15:36:06

Show newer messages


Back to Room ListRoom Version: 6