diff options
author | Gregor Kleen <gkleen@yggdrasil.li> | 2022-02-25 14:07:11 +0100 |
---|---|---|
committer | Gregor Kleen <gkleen@yggdrasil.li> | 2022-02-25 14:07:11 +0100 |
commit | 28df3554c05b31386e1e0ab33c3ed8db56990eea (patch) | |
tree | 24acd49a89d03b221baf5ac17b90d36fe6ac6a98 /overlays | |
parent | d32915c061ec628d87ec615b583cd136685284d4 (diff) | |
download | nixos-28df3554c05b31386e1e0ab33c3ed8db56990eea.tar nixos-28df3554c05b31386e1e0ab33c3ed8db56990eea.tar.gz nixos-28df3554c05b31386e1e0ab33c3ed8db56990eea.tar.bz2 nixos-28df3554c05b31386e1e0ab33c3ed8db56990eea.tar.xz nixos-28df3554c05b31386e1e0ab33c3ed8db56990eea.zip |
surtr: ma1sd: ...
Diffstat (limited to 'overlays')
-rw-r--r-- | overlays/ma1sd.nix | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/overlays/ma1sd.nix b/overlays/ma1sd.nix new file mode 100644 index 00000000..3218879b --- /dev/null +++ b/overlays/ma1sd.nix | |||
@@ -0,0 +1,60 @@ | |||
1 | final: prev: { | ||
2 | ma1sd = let | ||
3 | pname = "ma1sd"; | ||
4 | version = "2.5.0"; | ||
5 | rev = version; | ||
6 | |||
7 | src = prev.fetchFromGitHub { | ||
8 | inherit rev; | ||
9 | owner = "ma1uta"; | ||
10 | repo = "ma1sd"; | ||
11 | hash = "sha256-K3kaujAhWsRQuTMW3SZOnE7Rmu8+tDXaxpLrb45OI4A="; | ||
12 | }; | ||
13 | |||
14 | |||
15 | deps = prev.stdenv.mkDerivation { | ||
16 | pname = "${pname}-deps"; | ||
17 | inherit src version; | ||
18 | nativeBuildInputs = with final; [ gradle_6 perl git ]; | ||
19 | |||
20 | buildPhase = '' | ||
21 | export MA1SD_BUILD_VERSION=${rev} | ||
22 | export GRADLE_USER_HOME=$(mktemp -d); | ||
23 | gradle --no-daemon build -x test | ||
24 | ''; | ||
25 | |||
26 | # 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) | ||
27 | installPhase = '' | ||
28 | find $GRADLE_USER_HOME/caches/modules-2 -type f -regex '.*\.\(jar\|pom\)' \ | ||
29 | | perl -pe 's#(.*/([^/]+)/([^/]+)/([^/]+)/[0-9a-f]{30,40}/([^/\s]+))$# ($x = $2) =~ tr|\.|/|; "install -Dm444 $1 \$out/$x/$3/$4/$5" #e' \ | ||
30 | | sh | ||
31 | ''; | ||
32 | |||
33 | dontStrip = true; | ||
34 | |||
35 | outputHashAlgo = "sha256"; | ||
36 | outputHashMode = "recursive"; | ||
37 | outputHash = "sha256-P81aY1rOnZdb2UskPIrBe8dfWAicJ3TivBv/NEns5ro="; | ||
38 | }; | ||
39 | in prev.stdenv.mkDerivation { | ||
40 | inherit pname src version; | ||
41 | nativeBuildInputs = with final; [ gradle_6 perl makeWrapper ]; | ||
42 | buildInputs = with final; [ jre ]; | ||
43 | |||
44 | buildPhase = '' | ||
45 | runHook preBuild | ||
46 | export MA1SD_BUILD_VERSION=${rev} | ||
47 | export GRADLE_USER_HOME=$(mktemp -d) | ||
48 | sed -ie "s#mavenCentral()#mavenLocal(); maven { url '${deps}' }#g; s#mavenCentral()##g" build.gradle | ||
49 | gradle --offline --no-daemon build -x test | ||
50 | runHook postBuild | ||
51 | ''; | ||
52 | |||
53 | installPhase = '' | ||
54 | runHook preInstall | ||
55 | install -D build/libs/source.jar $out/lib/ma1sd.jar | ||
56 | makeWrapper ${final.jre}/bin/java $out/bin/ma1sd --add-flags "-jar $out/lib/ma1sd.jar" | ||
57 | runHook postInstall | ||
58 | ''; | ||
59 | }; | ||
60 | } | ||