about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--nixos/modules/module-list.nix1
-rw-r--r--nixos/modules/programs/quark-goldleaf.nix18
-rw-r--r--pkgs/by-name/qu/quark-goldleaf/99-quark-goldleaf.rules2
-rw-r--r--pkgs/by-name/qu/quark-goldleaf/fix-maven-plugin-versions.patch88
-rw-r--r--pkgs/by-name/qu/quark-goldleaf/package.nix114
-rw-r--r--pkgs/by-name/qu/quark-goldleaf/remove-pom-jfx.patch93
6 files changed, 316 insertions, 0 deletions
diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix
index ec022713e12e..deb7b382e3d1 100644
--- a/nixos/modules/module-list.nix
+++ b/nixos/modules/module-list.nix
@@ -241,6 +241,7 @@
   ./programs/proxychains.nix
   ./programs/qdmr.nix
   ./programs/qt5ct.nix
+  ./programs/quark-goldleaf.nix
   ./programs/regreet.nix
   ./programs/rog-control-center.nix
   ./programs/rust-motd.nix
diff --git a/nixos/modules/programs/quark-goldleaf.nix b/nixos/modules/programs/quark-goldleaf.nix
new file mode 100644
index 000000000000..71aadc8c594e
--- /dev/null
+++ b/nixos/modules/programs/quark-goldleaf.nix
@@ -0,0 +1,18 @@
+{ config, lib, pkgs, ... }:
+let
+  cfg = config.programs.quark-goldleaf;
+in
+{
+  options = {
+    programs.quark-goldleaf = {
+      enable = lib.mkEnableOption "quark-goldleaf with udev rules applied";
+    };
+  };
+
+  config = lib.mkIf cfg.enable {
+    environment.systemPackages = [ pkgs.quark-goldleaf ];
+    services.udev.packages = [ pkgs.quark-goldleaf ];
+  };
+
+  meta.maintainers = pkgs.quark-goldleaf.meta.maintainers;
+}
diff --git a/pkgs/by-name/qu/quark-goldleaf/99-quark-goldleaf.rules b/pkgs/by-name/qu/quark-goldleaf/99-quark-goldleaf.rules
new file mode 100644
index 000000000000..aa79720d7b55
--- /dev/null
+++ b/pkgs/by-name/qu/quark-goldleaf/99-quark-goldleaf.rules
@@ -0,0 +1,2 @@
+# Nintendo Switch HOS
+SUBSYSTEM=="usb", ATTRS{idVendor}=="057e", ATTRS{idProduct}=="3000", MODE="0666"
diff --git a/pkgs/by-name/qu/quark-goldleaf/fix-maven-plugin-versions.patch b/pkgs/by-name/qu/quark-goldleaf/fix-maven-plugin-versions.patch
new file mode 100644
index 000000000000..efe2e13c69cc
--- /dev/null
+++ b/pkgs/by-name/qu/quark-goldleaf/fix-maven-plugin-versions.patch
@@ -0,0 +1,88 @@
+diff --git a/pom.xml b/pom.xml
+index 5a683ca..be71e5d 100644
+--- a/pom.xml
++++ b/pom.xml
+@@ -104,7 +105,7 @@
+             <plugin>
+                 <groupId>org.apache.maven.plugins</groupId>
+                 <artifactId>maven-compiler-plugin</artifactId>
+-                <version>3.1</version>
++                <version>3.11.0</version>
+                 <configuration>
+                     <source>1.8</source>
+                     <target>1.8</target>
+@@ -113,7 +114,7 @@
+             
+             <plugin>
+                 <artifactId>maven-jar-plugin</artifactId>
+-                <version>2.4</version>
++                <version>3.3.0</version>
+                 <executions>
+                     <execution>
+                         <id>default-jar</id>
+@@ -134,7 +135,7 @@
+             <plugin>
+                 <groupId>org.apache.maven.plugins</groupId>
+                 <artifactId>maven-assembly-plugin</artifactId>
+-                <version>3.1.0</version>
++                <version>3.6.0</version>
+                 <configuration>
+                     <finalName>Quark</finalName>
+                     <appendAssemblyId>false</appendAssemblyId>
+@@ -157,6 +158,56 @@
+                     </execution>
+                 </executions>
+             </plugin>
++
++            <plugin>
++                <groupId>org.apache.maven.plugins</groupId>
++                <artifactId>maven-enforcer-plugin</artifactId>
++                <version>3.3.0</version>
++                <executions>
++                    <execution>
++                        <id>require-all-plugin-versions-to-be-set</id>
++                        <phase>validate</phase>
++                        <goals>
++                            <goal>enforce</goal>
++                        </goals>
++                        <configuration>
++                            <rules>
++                                <requirePluginVersions />
++                            </rules>
++                        </configuration>
++                    </execution>
++                </executions>
++            </plugin>
++            <plugin>
++                <groupId>org.apache.maven.plugins</groupId>
++                <artifactId>maven-deploy-plugin</artifactId>
++                <version>3.1.1</version>
++            </plugin>
++            <plugin>
++                <groupId>org.apache.maven.plugins</groupId>
++                <artifactId>maven-resources-plugin</artifactId>
++                <version>3.3.1</version>
++            </plugin>
++            <plugin>
++                <groupId>org.apache.maven.plugins</groupId>
++                <artifactId>maven-site-plugin</artifactId>
++                <version>4.0.0-M9</version>
++            </plugin>
++            <plugin>
++                <groupId>org.apache.maven.plugins</groupId>
++                <artifactId>maven-install-plugin</artifactId>
++                <version>3.1.1</version>
++            </plugin>
++            <plugin>
++                <groupId>org.apache.maven.plugins</groupId>
++                <artifactId>maven-clean-plugin</artifactId>
++                <version>3.3.1</version>
++            </plugin>
++            <plugin>
++                <groupId>org.apache.maven.plugins</groupId>
++                <artifactId>maven-surefire-plugin</artifactId>
++                <version>3.1.2</version>
++            </plugin>
+         </plugins>
+     </build>
+ 
diff --git a/pkgs/by-name/qu/quark-goldleaf/package.nix b/pkgs/by-name/qu/quark-goldleaf/package.nix
new file mode 100644
index 000000000000..71321a76fbd5
--- /dev/null
+++ b/pkgs/by-name/qu/quark-goldleaf/package.nix
@@ -0,0 +1,114 @@
+{ lib
+, jdk
+, maven
+, fetchFromGitHub
+, fetchpatch
+, makeDesktopItem
+, copyDesktopItems
+, imagemagick
+, wrapGAppsHook
+, gtk3
+}:
+
+let
+  jdk' = jdk.override { enableJavaFX = true; };
+  maven' = maven.override { jdk = jdk'; };
+in
+maven'.buildMavenPackage rec {
+  pname = "quark-goldleaf";
+  version = "1.0.0";
+
+  src = fetchFromGitHub {
+    owner = "XorTroll";
+    repo = "Goldleaf";
+    rev = version;
+    hash = "sha256-gagIQGOiygJ0Onm0SrkbFWaovqWX2WJNx7LpSRheCLM=";
+  };
+
+  sourceRoot = "${src.name}/Quark";
+
+  patches = [
+    ./fix-maven-plugin-versions.patch
+    ./remove-pom-jfx.patch
+    (fetchpatch {
+      name = "fix-config-path.patch";
+      url = "https://github.com/XorTroll/Goldleaf/commit/714ecc2755df9c1252615ad02cafff9c0311a739.patch";
+      hash = "sha256-4j+6uLIOdltZ4XIb3OtOzZg9ReH9660gZMMNQpHnn4o=";
+      relative = "Quark";
+    })
+  ];
+
+  mvnHash = "sha256-gA3HsQZFa2POP9cyJLb1l8t3hrJYzDowhJU+5Xl79p4=";
+
+  # set fixed build timestamp for deterministic jar
+  mvnParameters = "-Dproject.build.outputTimestamp=1980-01-01T00:00:02Z";
+
+  nativeBuildInputs = [
+    imagemagick # for icon conversion
+    copyDesktopItems
+    wrapGAppsHook
+  ];
+
+  buildInputs = [ gtk3 ];
+
+  # don't double-wrap
+  dontWrapGApps = true;
+
+  installPhase = ''
+    runHook preInstall
+
+    install -Dm644 ${./99-quark-goldleaf.rules} $out/etc/udev/rules.d/99-quark-goldleaf.rules
+    install -Dm644 target/Quark.jar $out/share/java/quark-goldleaf.jar
+
+    for size in 16 24 32 48 64 128; do
+      mkdir -p $out/share/icons/hicolor/"$size"x"$size"/apps
+      convert -resize "$size"x"$size" src/main/resources/Icon.png $out/share/icons/hicolor/"$size"x"$size"/apps/quark-goldleaf.png
+    done
+
+    runHook postInstall
+  '';
+
+  postFixup = ''
+    # This is in postFixup because gappsWrapperArgs are generated during preFixup
+    makeWrapper ${jdk'}/bin/java $out/bin/quark-goldleaf \
+        "''${gappsWrapperArgs[@]}" \
+        --add-flags "-jar $out/share/java/quark-goldleaf.jar"
+  '';
+
+  desktopItems = [
+    (makeDesktopItem {
+      name = "quark-goldleaf";
+      exec = "quark-goldleaf";
+      icon = "quark-goldleaf";
+      desktopName = "Quark";
+      comment = meta.description;
+      terminal = false;
+      categories = [ "Utility" "FileTransfer" ];
+      keywords = [ "nintendo" "switch" "goldleaf" ];
+    })
+  ];
+
+  meta = {
+    changelog = "https://github.com/XorTroll/Goldleaf/releases/tag/${src.rev}";
+    description = "A GUI tool for transfering files between a computer and a Nintendo Switch running Goldleaf";
+    homepage = "https://github.com/XorTroll/Goldleaf#quark-and-remote-browsing";
+    longDescription = ''
+      ${meta.description}
+
+      For the program to work properly, you will have to install Nintendo Switch udev rules.
+
+      You can either do this by enabling the NixOS module:
+
+      `programs.quark-goldleaf.enable = true;`
+
+      or by adding the package manually to udev packages:
+
+      `services.udev.packages = [ pkgs.quark-goldleaf ];
+    '';
+    license = lib.licenses.gpl3Only;
+    mainProgram = "quark-goldleaf";
+    maintainers = with lib.maintainers; [ tomasajt ];
+    platforms = with lib.platforms; linux ++ darwin;
+  };
+}
+
diff --git a/pkgs/by-name/qu/quark-goldleaf/remove-pom-jfx.patch b/pkgs/by-name/qu/quark-goldleaf/remove-pom-jfx.patch
new file mode 100644
index 000000000000..3a28ee27086a
--- /dev/null
+++ b/pkgs/by-name/qu/quark-goldleaf/remove-pom-jfx.patch
@@ -0,0 +1,93 @@
+diff --git a/pom.xml b/pom.xml
+index 51ce56b..44dcd09 100644
+--- a/pom.xml
++++ b/pom.xml
+@@ -15,72 +15,6 @@
+   </properties>
+ 
+     <dependencies>
+-        <dependency>
+-            <groupId>org.openjfx</groupId>
+-            <artifactId>javafx-controls</artifactId>
+-            <version>17</version>
+-            <classifier>linux</classifier>
+-            <scope>compile</scope>
+-        </dependency>
+-        <dependency>
+-            <groupId>org.openjfx</groupId>
+-            <artifactId>javafx-controls</artifactId>
+-            <version>17</version>
+-            <classifier>win</classifier>
+-            <scope>compile</scope>
+-        </dependency>
+-        <dependency>
+-            <groupId>org.openjfx</groupId>
+-            <artifactId>javafx-controls</artifactId>
+-            <version>17</version>
+-            <classifier>mac</classifier>
+-            <scope>compile</scope>
+-        </dependency>
+-
+-        <dependency>
+-            <groupId>org.openjfx</groupId>
+-            <artifactId>javafx-fxml</artifactId>
+-            <version>17</version>
+-            <classifier>linux</classifier>
+-            <scope>compile</scope> 
+-        </dependency>
+-        <dependency>
+-            <groupId>org.openjfx</groupId>
+-            <artifactId>javafx-fxml</artifactId>
+-            <version>17</version>
+-            <classifier>win</classifier>
+-            <scope>compile</scope> 
+-        </dependency>
+-        <dependency>
+-            <groupId>org.openjfx</groupId>
+-            <artifactId>javafx-fxml</artifactId>
+-            <version>17</version>
+-            <classifier>mac</classifier>
+-            <scope>compile</scope> 
+-        </dependency>
+-
+-        <dependency>
+-            <groupId>org.openjfx</groupId>
+-            <artifactId>javafx-graphics</artifactId>
+-            <version>17</version>
+-            <classifier>linux</classifier>
+-            <scope>compile</scope>
+-        </dependency>
+-        <dependency>
+-            <groupId>org.openjfx</groupId>
+-            <artifactId>javafx-graphics</artifactId>
+-            <version>17</version>
+-            <classifier>win</classifier>
+-            <scope>compile</scope>
+-        </dependency>
+-        <dependency>
+-            <groupId>org.openjfx</groupId>
+-            <artifactId>javafx-graphics</artifactId>
+-            <version>17</version>
+-            <classifier>mac</classifier>
+-            <scope>compile</scope>
+-        </dependency>
+-
+         <dependency>
+             <groupId>org.usb4java</groupId>
+             <artifactId>usb4java-javax</artifactId>
+@@ -123,15 +57,6 @@
+                 </executions>
+             </plugin>
+             
+-            <plugin>
+-                <groupId>org.openjfx</groupId>
+-                <artifactId>javafx-maven-plugin</artifactId>
+-                <version>0.0.8</version>
+-                <configuration>
+-                    <mainClass>xortroll.goldleaf.quark.Main</mainClass>
+-                </configuration>
+-            </plugin>
+-
+             <plugin>
+                 <groupId>org.apache.maven.plugins</groupId>
+                 <artifactId>maven-assembly-plugin</artifactId>