mirror of
https://codeberg.org/muon/home.git
synced 2026-07-04 07:59:33 +00:00
120 lines
2.5 KiB
Nix
120 lines
2.5 KiB
Nix
{
|
|
lib,
|
|
stdenv,
|
|
stdenvNoCC,
|
|
bun,
|
|
electron,
|
|
fetchFromGitHub,
|
|
makeWrapper,
|
|
makeBinaryWrapper,
|
|
makeDesktopItem,
|
|
copyDesktopItems,
|
|
sources,
|
|
writableTmpDirAsHomeHook,
|
|
}:
|
|
|
|
stdenvNoCC.mkDerivation (finalAttrs: {
|
|
pname = "dcts-client-shipping";
|
|
version = sources.dcts-client-shipping.version;
|
|
src = sources.dcts-client-shipping.src;
|
|
|
|
node_modules = stdenvNoCC.mkDerivation {
|
|
pname = "${finalAttrs.pname}-node_modules";
|
|
inherit (finalAttrs) version src;
|
|
|
|
impureEnvVars = lib.fetchers.proxyImpureEnvVars ++ [
|
|
"GIT_PROXY_COMMAND"
|
|
"SOCKS_SERVER"
|
|
];
|
|
|
|
nativeBuildInputs = [
|
|
bun
|
|
writableTmpDirAsHomeHook
|
|
];
|
|
|
|
dontConfigure = true;
|
|
|
|
buildPhase = ''
|
|
runHook preBuild
|
|
|
|
cd electron
|
|
bun install \
|
|
--cpu="*" \
|
|
--frozen-lockfile \
|
|
--ignore-scripts \
|
|
--no-progress \
|
|
--os="*"
|
|
|
|
runHook postBuild
|
|
'';
|
|
|
|
installPhase = ''
|
|
runHook preInstall
|
|
|
|
mkdir -p $out/electron
|
|
cp -R node_modules $out/electron/
|
|
|
|
runHook postInstall
|
|
'';
|
|
|
|
# NOTE: Required else we get errors that our fixed-output derivation references store paths
|
|
dontFixup = true;
|
|
|
|
outputHash = "sha256-TwfxQeK1KkKY1n/735sTxcAQfR5hUrONJcWeIaM47SE=";
|
|
outputHashAlgo = "sha256";
|
|
outputHashMode = "recursive";
|
|
};
|
|
|
|
nativeBuildInputs = [
|
|
bun
|
|
makeBinaryWrapper
|
|
copyDesktopItems
|
|
writableTmpDirAsHomeHook
|
|
];
|
|
|
|
desktopItems = [
|
|
(makeDesktopItem {
|
|
name = "dcts";
|
|
desktopName = "DCTS";
|
|
comment = "DCTS Desktop Client - Secure messaging";
|
|
exec = "dcts";
|
|
icon = "dcts";
|
|
categories = [ "Network" "InstantMessaging" ];
|
|
})
|
|
];
|
|
|
|
buildPhase = ''
|
|
runHook preBuild
|
|
|
|
# Copy node_modules from the separate derivation
|
|
cp -R ${finalAttrs.node_modules}/electron/node_modules electron/
|
|
|
|
runHook postBuild
|
|
'';
|
|
|
|
installPhase = ''
|
|
runHook preInstall
|
|
|
|
mkdir -p $out/lib/dcts
|
|
cp -R electron/* $out/lib/dcts/
|
|
|
|
# Create wrapper script
|
|
makeWrapper ${electron}/bin/electron $out/bin/dcts \
|
|
--add-flags $out/lib/dcts \
|
|
--set ELECTRON_OVERRIDE_DIST_PATH ${electron}/bin/
|
|
|
|
# Install icon
|
|
install -Dm644 electron/icon.png $out/share/icons/hicolor/256x256/apps/dcts.png
|
|
|
|
runHook postInstall
|
|
'';
|
|
|
|
meta = {
|
|
description = "DCTS Desktop Client - Electron app for secure messaging";
|
|
homepage = "https://github.com/hackthedev/dcts-client-shipping";
|
|
license = lib.licenses.isc;
|
|
maintainers = [ ];
|
|
platforms = lib.platforms.linux;
|
|
mainProgram = "dcts";
|
|
};
|
|
})
|