nixos-config/pkgs/incus-ui/default.nix

90 lines
2.1 KiB
Nix
Raw Normal View History

2024-02-05 11:46:52 +01:00
{
lib,
stdenv,
fetchFromGitHub,
fetchYarnDeps,
nodejs,
prefetch-yarn-deps,
2024-04-26 12:19:50 +02:00
fixup-yarn-lock,
2024-02-05 11:46:52 +01:00
yarn,
gnused,
rsync,
2023-12-23 20:20:04 +01:00
}:
2024-04-16 19:32:32 +02:00
stdenv.mkDerivation (finalAttrs: {
pname = "incus-ui";
2024-04-26 12:19:50 +02:00
version = "0.8";
2024-04-16 19:32:32 +02:00
src = fetchFromGitHub {
owner = "canonical";
repo = "lxd-ui";
rev = finalAttrs.version;
2024-04-26 12:19:50 +02:00
hash = "sha256-oD/GPm84oFXHcZ8vTUzNgQinrHwNuvpeVjsrp8ibIZY=";
2024-04-16 19:32:32 +02:00
};
offlineCache = fetchYarnDeps {
yarnLock = "${finalAttrs.src}/yarn.lock";
2024-04-26 12:19:50 +02:00
hash = "sha256-hRZ0vbksxnUv4XMrbhP2PI94UYYzwrydJHSx+uf+MbI=";
2024-04-16 19:32:32 +02:00
};
patches = [
./ui-canonical-0001-Branding.patch
./ui-canonical-0002-Update-navigation.patch
./ui-canonical-0003-Update-certificate-generation.patch
./ui-canonical-0004-Remove-external-links.patch
./ui-canonical-0005-Remove-Canonical-image-servers.patch
./ui-canonical-0006-Remove-version-check.patch
];
nativeBuildInputs = [
nodejs
prefetch-yarn-deps
2024-04-26 12:19:50 +02:00
fixup-yarn-lock
2024-04-16 19:32:32 +02:00
yarn
];
configurePhase = ''
runHook preConfigure
2024-04-26 12:19:50 +02:00
${gnused}/bin/sed -e "s/devlxd/guestapi/g" \
-e "s/dev\/lxd/dev\/incus/g" \
-e "s/LXD/Incus/g" \
-e "s/Lxd/Incus_/g" \
-e "s/lxd/incus/g" -i src/*/*.ts* src/*/*/*.ts* src/*/*/*/*.ts*
2024-04-16 19:32:32 +02:00
export HOME=$(mktemp -d)
yarn config --offline set yarn-offline-mirror "$offlineCache"
fixup-yarn-lock yarn.lock
yarn --offline --frozen-lockfile --ignore-platform --ignore-scripts --no-progress --non-interactive install
patchShebangs node_modules
cp ${./favicon-32x32.png} public/assets/img/favicon-32x32.png
runHook postConfigure
'';
buildPhase = ''
runHook preBuild
yarn --offline build
runHook postBuild
'';
installPhase = ''
runHook preInstall
mkdir -p $out
${rsync}/bin/rsync -a build/ui/ $out/
runHook postInstall
'';
meta = with lib; {
description = "Easy and accessible container and virtual machine management. A browser interface for LXD";
homepage = "https://github.com/canonical/lxd-ui";
license = licenses.gpl3;
maintainers = with maintainers; [ ];
platforms = platforms.linux;
};
})