2022-11-21 17:40:18 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, gradle_7
|
|
|
|
, perl
|
|
|
|
, makeWrapper
|
|
|
|
, writeText
|
|
|
|
, jdk11
|
|
|
|
, gsettings-desktop-schemas
|
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
let
|
2022-11-21 17:40:18 +00:00
|
|
|
version = "1.1.0-1";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "mucommander";
|
|
|
|
repo = "mucommander";
|
|
|
|
rev = version;
|
2022-11-21 17:40:18 +00:00
|
|
|
sha256 = "sha256-sCBbY3aBSuJmyOuy36pg8X2jX6hXwW8SW2UzYyp/isM=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
# there is no .git anyway
|
|
|
|
substituteInPlace build.gradle \
|
2022-11-21 17:40:18 +00:00
|
|
|
--replace "git = grgit.open(dir: project.rootDir)" "" \
|
|
|
|
--replace "id 'org.ajoberstar.grgit' version '3.1.1'" "" \
|
|
|
|
--replace "revision = git.head().id" "revision = '${version}'"
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
# fake build to pre-download deps into fixed-output derivation
|
|
|
|
deps = stdenv.mkDerivation {
|
2022-03-30 09:31:56 +00:00
|
|
|
pname = "mucommander-deps";
|
|
|
|
inherit version src postPatch;
|
2022-11-21 17:40:18 +00:00
|
|
|
nativeBuildInputs = [ gradle_7 perl ];
|
2020-04-24 23:36:52 +00:00
|
|
|
buildPhase = ''
|
|
|
|
export GRADLE_USER_HOME=$(mktemp -d)
|
2022-11-21 17:40:18 +00:00
|
|
|
gradle --no-daemon tgz
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
# perl code mavenizes pathes (com.squareup.okio/okio/1.13.0/a9283170b7305c8d92d25aff02a6ab7e45d06cbe/okio-1.13.0.jar -> com/squareup/okio/okio/1.13.0/okio-1.13.0.jar)
|
2022-11-21 17:40:18 +00:00
|
|
|
# reproducible by sorting
|
2020-04-24 23:36:52 +00:00
|
|
|
installPhase = ''
|
|
|
|
find $GRADLE_USER_HOME/caches/modules-2 -type f -regex '.*\.\(jar\|pom\)' \
|
2022-11-21 17:40:18 +00:00
|
|
|
| LC_ALL=C sort \
|
2020-04-24 23:36:52 +00:00
|
|
|
| perl -pe 's#(.*/([^/]+)/([^/]+)/([^/]+)/[0-9a-f]{30,40}/([^/\s]+))$# ($x = $2) =~ tr|\.|/|; "install -Dm444 $1 \$out/$x/$3/$4/$5" #e' \
|
|
|
|
| sh
|
2022-11-21 17:40:18 +00:00
|
|
|
# copy maven-metadata.xml for commons-codec
|
|
|
|
# thankfully there is only one xml
|
|
|
|
cp $GRADLE_USER_HOME/caches/modules-2/resources-2.1/*/*/maven-metadata.xml $out/commons-codec/commons-codec/maven-metadata.xml
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
outputHashAlgo = "sha256";
|
|
|
|
outputHashMode = "recursive";
|
2022-11-21 17:40:18 +00:00
|
|
|
outputHash = "sha256-15ThPkvcmOfa5m/HMJzjrOOUi/BYbd57p5bBfj5/3n4=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2022-11-21 17:40:18 +00:00
|
|
|
in
|
|
|
|
stdenv.mkDerivation rec {
|
2022-03-30 09:31:56 +00:00
|
|
|
pname = "mucommander";
|
|
|
|
inherit version src postPatch;
|
2022-11-21 17:40:18 +00:00
|
|
|
nativeBuildInputs = [ gradle_7 perl makeWrapper ];
|
|
|
|
|
|
|
|
# Point to our local deps repo
|
|
|
|
gradleInit = writeText "init.gradle" ''
|
|
|
|
logger.lifecycle 'Replacing Maven repositories with ${deps}...'
|
|
|
|
gradle.projectsLoaded {
|
|
|
|
rootProject.allprojects {
|
|
|
|
buildscript {
|
|
|
|
repositories {
|
|
|
|
clear()
|
|
|
|
maven { url '${deps}' }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
repositories {
|
|
|
|
clear()
|
|
|
|
maven { url '${deps}' }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
settingsEvaluated { settings ->
|
|
|
|
settings.pluginManagement {
|
|
|
|
repositories {
|
|
|
|
maven { url '${deps}' }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
buildPhase = ''
|
|
|
|
export GRADLE_USER_HOME=$(mktemp -d)
|
|
|
|
|
2022-11-21 17:40:18 +00:00
|
|
|
gradle --offline --init-script ${gradleInit} --no-daemon tgz
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
2022-11-21 17:40:18 +00:00
|
|
|
mkdir -p $out/share/mucommander
|
|
|
|
tar xvf build/distributions/mucommander-*.tgz --directory=$out/share/mucommander
|
|
|
|
|
|
|
|
makeWrapper $out/share/mucommander/mucommander.sh $out/bin/mucommander \
|
2020-04-24 23:36:52 +00:00
|
|
|
--prefix XDG_DATA_DIRS : ${gsettings-desktop-schemas}/share/gsettings-schemas/${gsettings-desktop-schemas.name} \
|
2020-12-25 13:55:36 +00:00
|
|
|
--set JAVA_HOME ${jdk11}
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2022-11-21 17:40:18 +00:00
|
|
|
homepage = "https://www.mucommander.com/";
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Cross-platform file manager";
|
|
|
|
license = licenses.gpl3;
|
2022-11-21 17:40:18 +00:00
|
|
|
maintainers = with maintainers; [ jiegec ];
|
2020-04-24 23:36:52 +00:00
|
|
|
platforms = platforms.all;
|
|
|
|
};
|
|
|
|
}
|