Skip to content

Commit

Permalink
devtoys: init at 2.0.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
aucub committed Dec 27, 2024
1 parent df50ecf commit d40fb7e
Showing 1 changed file with 118 additions and 0 deletions.
118 changes: 118 additions & 0 deletions pkgs/by-name/de/devtoys/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
{
lib,
stdenv,
fetchurl,
dpkg,
buildFHSEnv,
appimageTools,
writeShellScript,
mesa,
libGL,
fontconfig,
zlib,
lttng-ust_2_12,
icu,
gtk4,
libadwaita,
webkitgtk_6_0,
}:
let
pname = "devtoys";
version = "2.0.8.0";

meta = {
description = "Swiss Army knife for developers";
homepage = "https://github.com/DevToys-app/DevToys";
mainProgram = "devtoys";
platforms = [
"aarch64-linux"
"x86_64-linux"
];
license = lib.licenses.mit;
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
maintainers = with lib.maintainers; [ aucub ];
};

devtoys-unwrapped = stdenv.mkDerivation {
inherit pname version meta;

src =
let
selectSystem =
attrs:
attrs.${stdenv.hostPlatform.system}
or (throw "Unsupported host system ${stdenv.hostPlatform.system}");
arch = selectSystem {
x86_64-linux = "x64";
aarch64-linux = "arm";
};
in
fetchurl {
url = "https://github.com/DevToys-app/DevToys/releases/download/v${version}/devtoys_linux_${arch}.deb";
hash = selectSystem {
x86_64-linux = "sha256-j+JKW6JhooX1ZMJzrqwU2utt8OmrjUQLJlAdKHfmCAc=";
aarch64-linux = "sha256-tBxSS81gzYrEgu3bxfrRP7rrpsElGs1udzDfnC2A0r8=";
};
};

nativeBuildInputs = [
dpkg
];

dontFixup = true;

dontStrip = true;

installPhase = ''
runHook preInstall
mkdir -p $out/lib
cp -r opt/devtoys/devtoys $out/lib/devtoys
cp -r usr/share $out/share
substituteInPlace $out/share/applications/devtoys.desktop \
--replace-fail "/usr/bin/DevToys" "devtoys" \
--replace-fail "/opt/devtoys" "$out/lib"
runHook postInstall
'';
};
in
buildFHSEnv (
appimageTools.defaultFhsEnvArgs
// {
inherit
pname
version
meta
;

targetPkgs =
pkgs:
(with pkgs; [
icu
gtk4
webkitgtk_6_0
]);

runScript = writeShellScript "devtoys-wrapper.sh" ''
exec env FONTCONFIG_PATH=${fontconfig.out}/etc/fonts LD_LIBRARY_PATH=${
lib.makeLibraryPath [
zlib
lttng-ust_2_12
icu
gtk4
libadwaita
webkitgtk_6_0
mesa
libGL
fontconfig
(lib.getLib stdenv.cc.cc)
]
}:${devtoys-unwrapped}/lib/devtoys:$LD_LIBRARY_PATH ${devtoys-unwrapped}/lib/devtoys/DevToys.Linux "$@"
'';

extraInstallCommands = ''
ln -s ${devtoys-unwrapped}/share $out/share
'';
}
)

0 comments on commit d40fb7e

Please sign in to comment.