laptop: add IDEA wrappers

This commit is contained in:
Lgmrszd 2025-01-19 16:25:40 +04:00
parent e24934ae66
commit 012afecf57
No known key found for this signature in database
GPG key ID: 9396B8BA6FBB14DE
3 changed files with 47 additions and 10 deletions

29
lib/default.nix Normal file
View file

@ -0,0 +1,29 @@
{
appwrapper =
{
pkgs,
inputpkg,
pkgsuffix,
libraries,
extrapathpkgs
}: with pkgs; let
name = "${inputpkg.pname}-${pkgsuffix}";
in stdenv.mkDerivation {
inherit name;
inherit (inputpkg) version;
nativeBuildInputs = [ makeWrapper gnused ];
buildCommand = ''
mkdir -p $out/bin
mkdir -p $out/share/applications
cp ${inputpkg}/share/applications/${inputpkg.pname}.desktop $out/share/applications/${name}.desktop
makeWrapper ${inputpkg}/bin/${inputpkg.pname} $out/bin/${name} \
--prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath libraries}" \
--prefix PATH : "${lib.makeBinPath extrapathpkgs}"
substituteInPlace $out/share/applications/${name}.desktop \
--replace-fail "=${inputpkg.pname}" "=${name}"
sed -i -E "s/^Name=(.*)/Name=\1 (${pkgsuffix})/g" "$out/share/applications/${name}.desktop"
echo $out/bin/${name}
'';
dontBuild = true;
};
}