From a9ae2895f43898f66e999c2c5b5287384658fc4e Mon Sep 17 00:00:00 2001 From: Ilya Epifanov Date: Sat, 15 Jun 2024 13:18:25 +0200 Subject: [PATCH 1/3] inav-configurator: add versioning support --- .../robotics/inav-configurator/default.nix | 69 +++++++++++++++++++ pkgs/by-name/in/inav-configurator/package.nix | 61 ---------------- pkgs/top-level/all-packages.nix | 6 ++ 3 files changed, 75 insertions(+), 61 deletions(-) create mode 100644 pkgs/applications/science/robotics/inav-configurator/default.nix delete mode 100644 pkgs/by-name/in/inav-configurator/package.nix diff --git a/pkgs/applications/science/robotics/inav-configurator/default.nix b/pkgs/applications/science/robotics/inav-configurator/default.nix new file mode 100644 index 0000000000000..23d91c3f719d7 --- /dev/null +++ b/pkgs/applications/science/robotics/inav-configurator/default.nix @@ -0,0 +1,69 @@ +{ lib, stdenv, fetchurl, makeDesktopItem, copyDesktopItems, nwjs, wrapGAppsHook3, gsettings-desktop-schemas, version, hash, packed ? false }: + +let + shortVersion = lib.versions.major version; + bin_name = "inav-configurator"; +in +stdenv.mkDerivation rec { + pname = "${bin_name}-" + shortVersion; + inherit version; + + src = fetchurl { + url = "https://github.com/iNavFlight/inav-configurator/releases/download/${version}/INAV-Configurator_linux64_${version}.tar.gz"; + inherit hash; + }; + + postUnpack = '' + find -name "lib*.so" -delete + find -name "lib*.so.*" -delete + ''; + + nativeBuildInputs = [ copyDesktopItems wrapGAppsHook3 ]; + + buildInputs = [ gsettings-desktop-schemas ]; + + installPhase = let + icon = fetchurl { + url = "https://raw.githubusercontent.com/iNavFlight/inav-configurator/bf3fc89e6df51ecb83a386cd000eebf16859879e/images/inav_icon_128.png"; + hash = "sha256-/EMleYuNk6s3lg4wYwXGUSLbppgmXrdJZkUX9n8jBMU="; + }; + in '' + runHook preInstall + + mkdir -p $out/bin \ + $out/opt/${pname} + + cp -r * $out/opt/${pname}/ + install -m 444 -D ${icon} $out/share/icons/hicolor/128x128/apps/${pname}.png + + chmod +x $out/opt/${pname}/inav-configurator + makeWrapper ${nwjs}/bin/nw $out/bin/${pname} \ + --add-flags $out/opt/${pname}${if packed then "/${bin_name}" else ""} + + runHook postInstall + ''; + + desktopItems = makeDesktopItem { + name = pname; + exec = pname; + icon = pname; + comment = "INAV configuration tool " + version; + desktopName = "INAV Configurator " + version; + genericName = "Flight controller configuration tool"; + }; + + meta = { + description = "The INAV flight control system configuration tool"; + mainProgram = pname; + longDescription = '' + A crossplatform configuration tool for the INAV flight control system. + Various types of aircraft are supported by the tool and by INAV, e.g. + quadcopters, hexacopters, octocopters and fixed-wing aircraft. + ''; + homepage = "https://github.com/iNavFlight/inav/wiki"; + sourceProvenance = [ lib.sourceTypes.binaryNativeCode ]; + license = lib.licenses.gpl3Only; + maintainers = with lib.maintainers; [ tilcreator wucke13 ilya-epifanov ]; + platforms = lib.platforms.linux; + }; +} diff --git a/pkgs/by-name/in/inav-configurator/package.nix b/pkgs/by-name/in/inav-configurator/package.nix deleted file mode 100644 index 6862b909b044a..0000000000000 --- a/pkgs/by-name/in/inav-configurator/package.nix +++ /dev/null @@ -1,61 +0,0 @@ -{ lib, stdenv, fetchurl, makeDesktopItem, copyDesktopItems, nwjs, wrapGAppsHook3, gsettings-desktop-schemas, gtk3 }: - -stdenv.mkDerivation rec { - pname = "inav-configurator"; - version = "5.1.0"; - - src = fetchurl { - url = "https://github.com/iNavFlight/inav-configurator/releases/download/${version}/INAV-Configurator_linux64_${version}.tar.gz"; - sha256 = "sha256-ZvZxQICa5fnJBTx0aW/hqQCuhQW9MkcVa2sOjPYaPXM="; - }; - - icon = fetchurl { - url = "https://raw.githubusercontent.com/iNavFlight/inav-configurator/bf3fc89e6df51ecb83a386cd000eebf16859879e/images/inav_icon_128.png"; - sha256 = "1i844dzzc5s5cr4vfpi6k2kdn8jiqq2n6c0fjqvsp4wdidwjahzw"; - }; - - nativeBuildInputs = [ copyDesktopItems wrapGAppsHook3 ]; - - buildInputs = [ gsettings-desktop-schemas gtk3 ]; - - installPhase = '' - runHook preInstall - - mkdir -p $out/bin \ - $out/opt/${pname} - - cp -r inav-configurator $out/opt/inav-configurator/ - install -m 444 -D $icon $out/share/icons/hicolor/128x128/apps/${pname}.png - - chmod +x $out/opt/inav-configurator/inav-configurator - makeWrapper ${nwjs}/bin/nw $out/bin/${pname} --add-flags $out/opt/inav-configurator/inav-configurator - - runHook postInstall - ''; - - desktopItems = [ - (makeDesktopItem { - name = pname; - exec = pname; - icon = pname; - comment = "iNavFlight configuration tool"; - desktopName = "iNav Configurator"; - genericName = "Flight controller configuration tool"; - }) - ]; - - meta = with lib; { - description = "INav flight control system configuration tool"; - mainProgram = "inav-configurator"; - longDescription = '' - A crossplatform configuration tool for the iNav flight control system. - Various types of aircraft are supported by the tool and by iNav, e.g. - quadcopters, hexacopters, octocopters and fixed-wing aircraft. - ''; - homepage = "https://github.com/iNavFlight/inav/wiki"; - sourceProvenance = with sourceTypes; [ binaryNativeCode ]; - license = licenses.gpl3Only; - maintainers = with maintainers; [ tilcreator wucke13 ]; - platforms = platforms.linux; - }; -} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 65b291f35ddc6..86f6f471ce1db 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -17877,6 +17877,12 @@ with pkgs; apmplanner2 = libsForQt5.callPackage ../applications/science/robotics/apmplanner2 { }; + inav-configurator = callPackage ../applications/science/robotics/inav-configurator { + version = "5.1.0"; + hash = "sha256-ZvZxQICa5fnJBTx0aW/hqQCuhQW9MkcVa2sOjPYaPXM="; + packed = true; + }; + ### MISC android-file-transfer = libsForQt5.callPackage ../tools/filesystems/android-file-transfer { }; From 5240d1f2e3620bba5ddff347c2cbda92203f8394 Mon Sep 17 00:00:00 2001 From: Ilya Epifanov Date: Sat, 21 Dec 2024 10:49:37 +0100 Subject: [PATCH 2/3] inav-configurator: moved to pkgs/by-name --- .../default.nix => by-name/in/inav-configurator/package.nix} | 0 pkgs/top-level/all-packages.nix | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename pkgs/{applications/science/robotics/inav-configurator/default.nix => by-name/in/inav-configurator/package.nix} (100%) diff --git a/pkgs/applications/science/robotics/inav-configurator/default.nix b/pkgs/by-name/in/inav-configurator/package.nix similarity index 100% rename from pkgs/applications/science/robotics/inav-configurator/default.nix rename to pkgs/by-name/in/inav-configurator/package.nix diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 86f6f471ce1db..cd8de9e91d8c2 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -17877,7 +17877,7 @@ with pkgs; apmplanner2 = libsForQt5.callPackage ../applications/science/robotics/apmplanner2 { }; - inav-configurator = callPackage ../applications/science/robotics/inav-configurator { + inav-configurator = callPackage ../by-name/in/inav-configurator/package.nix { version = "5.1.0"; hash = "sha256-ZvZxQICa5fnJBTx0aW/hqQCuhQW9MkcVa2sOjPYaPXM="; packed = true; From 2d9209295b5f99ca45dbc95cef5a179f46ef89fe Mon Sep 17 00:00:00 2001 From: Ilya Epifanov Date: Thu, 14 Nov 2024 11:23:09 +0100 Subject: [PATCH 3/3] inav-configurator -> inav-configurator5 --- nixos/doc/manual/release-notes/rl-2411.section.md | 2 ++ pkgs/top-level/all-packages.nix | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/nixos/doc/manual/release-notes/rl-2411.section.md b/nixos/doc/manual/release-notes/rl-2411.section.md index 209655cc9925a..e056c299713e0 100644 --- a/nixos/doc/manual/release-notes/rl-2411.section.md +++ b/nixos/doc/manual/release-notes/rl-2411.section.md @@ -223,6 +223,8 @@ ## Backward Incompatibilities {#sec-release-24.11-incompatibilities} +- `inav-configurator` package was renamed into `inav-configurator5`. Please use an appropriate version matching your firmware. + - Nixpkgs now requires Nix 2.3.17 or newer to allow for zstd compressed binary artifacts. - The `sound` options have been removed or renamed, as they had a lot of unintended side effects. See [below](#sec-release-24.11-migration-sound) for details. diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index cd8de9e91d8c2..757f2b894f110 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -17877,7 +17877,7 @@ with pkgs; apmplanner2 = libsForQt5.callPackage ../applications/science/robotics/apmplanner2 { }; - inav-configurator = callPackage ../by-name/in/inav-configurator/package.nix { + inav-configurator5 = callPackage ../by-name/in/inav-configurator/package.nix { version = "5.1.0"; hash = "sha256-ZvZxQICa5fnJBTx0aW/hqQCuhQW9MkcVa2sOjPYaPXM="; packed = true;