depot/nix/pkgs/authentik/docs/node2nix-regen.sh

66 lines
2 KiB
Bash
Executable file

#!/usr/bin/env nix-shell
#!nix-shell -p nodePackages.node2nix -i bash
set -euo pipefail
SRC="$(nix-build $HOME/depot --no-out-link -A nix.pkgs.authentik.src)"
node2nix \
-16 \
-i "$SRC/website/package.json" \
-l "$SRC/website/package-lock.json" \
-o node-packages.nix \
-c node-composition.nix
patch -p1 <<'EOF'
diff -ru old/node-composition.nix new/node-composition.nix
--- old/node-composition.nix 2022-08-16 17:01:51.463379604 +0100
+++ new/node-composition.nix 2022-08-16 17:02:07.143379559 +0100
@@ -2,7 +2,7 @@
{pkgs ? import <nixpkgs> {
inherit system;
- }, system ? builtins.currentSystem, nodejs ? pkgs."nodejs-16_x"}:
+ }, system ? builtins.currentSystem, nodejs ? pkgs."nodejs-16_x", src}:
let
nodeEnv = import ./node-env.nix {
@@ -13,5 +13,5 @@
in
import ./node-packages.nix {
inherit (pkgs) fetchurl nix-gitignore stdenv lib fetchgit;
- inherit nodeEnv;
+ inherit nodeEnv src;
}
diff -ru old/node-packages.nix new/node-packages.nix
--- old/node-packages.nix 2022-08-16 17:01:51.463379604 +0100
+++ new/node-packages.nix 2022-08-16 17:03:09.403381894 +0100
@@ -1,6 +1,6 @@
# This file has been generated by node2nix 1.11.1. Do not edit!
-{nodeEnv, fetchurl, fetchgit, nix-gitignore, stdenv, lib, globalBuildInputs ? []}:
+{nodeEnv, fetchurl, fetchgit, nix-gitignore, stdenv, lib, globalBuildInputs ? [], src}:
let
sources = {
@@ -7710,13 +7710,9 @@
nodeDependencies = nodeEnv.buildNodeDependencies (lib.overrideExisting args {
src = stdenv.mkDerivation {
name = args.name + "-package-json";
- src = nix-gitignore.gitignoreSourcePure [
- "*"
- "!package.json"
- "!package-lock.json"
- ] args.src;
+ inherit (args) src;
dontBuild = true;
- installPhase = "mkdir -p $out; cp -r ./* $out;";
+ installPhase = "mkdir -p $out; cp -r ./package.json ./package-lock.json $out;";
};
});
}
EOF
sed -E -i \
-e 's,(\.\./)+nix\/store\/[^-]+-source\/website,"${src}/website",' \
node-packages.nix