depot/pkgs/by-name/zi/zitadel/console.nix
Luke Granger-Brown 57725ef3ec Squashed 'third_party/nixpkgs/' content from commit 76612b17c0ce
git-subtree-dir: third_party/nixpkgs
git-subtree-split: 76612b17c0ce71689921ca12d9ffdc9c23ce40b2
2024-11-10 23:59:47 +00:00

59 lines
1.3 KiB
Nix

{ generateProtobufCode
, version
, zitadelRepo
}:
{ mkYarnPackage
, fetchYarnDeps
, grpc-gateway
, protoc-gen-grpc-web
, protoc-gen-js
}:
let
protobufGenerated = generateProtobufCode {
pname = "zitadel-console";
nativeBuildInputs = [
grpc-gateway
protoc-gen-grpc-web
protoc-gen-js
];
workDir = "console";
bufArgs = "../proto --include-imports --include-wkt";
outputPath = "src/app/proto";
hash = "sha256-n6BJ1gSSm66yOGdHcSea/nQbjiHZX2YX2zbFT4o75/4=";
};
in
mkYarnPackage rec {
name = "zitadel-console";
inherit version;
src = "${zitadelRepo}/console";
packageJSON = ./package.json;
offlineCache = fetchYarnDeps {
yarnLock = "${src}/yarn.lock";
hash = "sha256-MWATjfhIbo3cqpzOdXP52f/0Td60n99OTU1Qk6oWmXU=";
};
postPatch = ''
substituteInPlace src/styles.scss \
--replace-fail "/node_modules/flag-icons" "flag-icons"
substituteInPlace angular.json \
--replace-fail "./node_modules/tinycolor2" "../../node_modules/tinycolor2"
'';
buildPhase = ''
ln -s "${zitadelRepo}/docs" deps/docs
mkdir deps/console/src/app/proto
cp -r ${protobufGenerated}/* deps/console/src/app/proto/
yarn --offline build
'';
installPhase = ''
cp -r deps/console/dist/console $out
'';
doDist = false;
}