diff --git a/pkgs/by-name/sf/sftool-gui/package.nix b/pkgs/by-name/sf/sftool-gui/package.nix new file mode 100644 index 000000000000..24c5f55d0336 --- /dev/null +++ b/pkgs/by-name/sf/sftool-gui/package.nix @@ -0,0 +1,75 @@ +{ + lib, + stdenv, + rustPlatform, + cargo-tauri, + glib-networking, + nodejs, + libgudev, + systemdLibs, + pnpm, + openssl, + nix-update-script, + pkg-config, + webkitgtk_4_1, + wrapGAppsHook4, + autoPatchelfHook, + fetchFromGitHub, +}: +rustPlatform.buildRustPackage (finalAttrs: { + pname = "sftool-gui"; + version = "1.0.2"; + src = fetchFromGitHub { + owner = "OpenSiFli"; + repo = "sftool-gui"; + tag = "v${finalAttrs.version}"; + hash = "sha256-FD3eQN4Uto4q7gdyfK5KUyZJ5ZiIJeUKkqaCZRWdQNo="; + }; + + cargoHash = "sha256-XAU3ru+TxUo99OQwcXNLJ8gzBOZUkC8UCAApz7M/QTM="; + cargoRoot = "src-tauri"; + + pnpmDeps = pnpm.fetchDeps { + fetcherVersion = 2; + inherit (finalAttrs) pname version src; + hash = "sha256-gamgu9koBf+JLDswi3eGXRZybF8UiYE8CoifpQCgLaI="; + }; + + nativeBuildInputs = [ + cargo-tauri.hook + pnpm.configHook + nodejs + pkg-config + ] + ++ lib.optionals stdenv.hostPlatform.isLinux [ + wrapGAppsHook4 + autoPatchelfHook + ]; + + buildInputs = [ + openssl + ] + ++ lib.optionals stdenv.hostPlatform.isLinux [ + glib-networking # Most Tauri apps need networking + webkitgtk_4_1 + libgudev + systemdLibs + ]; + + # Set our Tauri source directory + # And make sure we build there too + buildAndTestSubdir = finalAttrs.cargoRoot; + + passthru = { + inherit (finalAttrs) pnpmDeps; + updateScript = nix-update-script { }; + }; + + meta = { + description = "Download tool for the SiFli family of chips"; + homepage = "https://github.com/OpenSiFli/sftool-gui"; + license = lib.licenses.asl20; + maintainers = with lib.maintainers; [ eihqnh ]; + mainProgram = "sftool"; + }; +}) diff --git a/pkgs/by-name/sf/sftool/package.nix b/pkgs/by-name/sf/sftool/package.nix new file mode 100644 index 000000000000..b120150aa26c --- /dev/null +++ b/pkgs/by-name/sf/sftool/package.nix @@ -0,0 +1,40 @@ +{ + lib, + pkg-config, + rustPlatform, + stdenv, + systemdLibs, + fetchFromGitHub, + nix-update-script, +}: + +rustPlatform.buildRustPackage (finalAttrs: { + pname = "sftool"; + version = "0.1.13"; + src = fetchFromGitHub { + owner = "OpenSiFli"; + repo = "sftool"; + tag = finalAttrs.version; + hash = "sha256-/5RVBWHrZpPK2R4khnvZAnFyMfSZStCnQO5g7Ao9Ck4="; + }; + + cargoHash = "sha256-fteBYld3JzsTn/KMy5w/6Ts7x1PsYmi8zhBvgYVw5os="; + + nativeBuildInputs = [ + pkg-config + ]; + + buildInputs = lib.optionals stdenv.hostPlatform.isLinux [ + systemdLibs # libudev-sys + ]; + + passthru.updateScript = nix-update-script { }; + + meta = { + description = "Download tool for the SiFli family of chips"; + homepage = "https://github.com/OpenSiFli/sftool"; + license = lib.licenses.asl20; + maintainers = with lib.maintainers; [ eihqnh ]; + mainProgram = "sftool"; + }; +})