standardnotes: refactoring to use appimageTools instead of appimage-run
This commit is contained in:
parent
b316cec9b6
commit
e01ce7f91f
|
@ -1,7 +1,10 @@
|
|||
{ stdenv, appimage-run, fetchurl, runtimeShell }:
|
||||
{ stdenv, appimageTools, autoPatchelfHook, desktop-file-utils
|
||||
, fetchurl, runtimeShell }:
|
||||
|
||||
let
|
||||
version = "3.3.3";
|
||||
pname = "standardnotes";
|
||||
name = "${pname}-${version}";
|
||||
|
||||
plat = {
|
||||
i386-linux = "-i386";
|
||||
|
@ -12,27 +15,33 @@ let
|
|||
i386-linux = "2ccdf23588b09d645811e562d4fd7e02ac0e367bf2b34e373d8470d48544036d";
|
||||
x86_64-linux = "6366d0a37cbf2cf51008a666e40bada763dd1539173de01e093bcbe4146a6bd8";
|
||||
}.${stdenv.hostPlatform.system};
|
||||
in
|
||||
|
||||
stdenv.mkDerivation {
|
||||
pname = "standardnotes";
|
||||
inherit version;
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://github.com/standardnotes/desktop/releases/download/v${version}/standard-notes-${version}${plat}.AppImage";
|
||||
inherit sha256;
|
||||
};
|
||||
|
||||
buildInputs = [ appimage-run ];
|
||||
appimageContents = appimageTools.extract {
|
||||
inherit name src;
|
||||
};
|
||||
|
||||
dontUnpack = true;
|
||||
nativeBuildInputs = [ autoPatchelfHook desktop-file-utils ];
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/{bin,share}
|
||||
cp $src $out/share/standardNotes.AppImage
|
||||
echo "#!${runtimeShell}" > $out/bin/standardnotes
|
||||
echo "${appimage-run}/bin/appimage-run $out/share/standardNotes.AppImage" >> $out/bin/standardnotes
|
||||
chmod +x $out/bin/standardnotes $out/share/standardNotes.AppImage
|
||||
in appimageTools.wrapType2 rec {
|
||||
inherit name src;
|
||||
|
||||
extraInstallCommands = ''
|
||||
# directory in /nix/store so readonly
|
||||
cp -r ${appimageContents}/* $out
|
||||
cd $out
|
||||
chmod -R +w $out
|
||||
mv $out/bin/${name} $out/bin/${pname}
|
||||
|
||||
# fixup and install desktop file
|
||||
${desktop-file-utils}/bin/desktop-file-install --dir $out/share/applications \
|
||||
--set-key Exec --set-value ${pname} standard-notes.desktop
|
||||
|
||||
rm usr/lib/* AppRun standard-notes.desktop .so*
|
||||
'';
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
|
|
Loading…
Reference in New Issue