about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLassulus <github@lassul.us>2021-04-24 19:34:18 +0200
committerGitHub <noreply@github.com>2021-04-24 19:34:18 +0200
commit118485230c02d13f62133bce43177ffd49495694 (patch)
tree577305ac48017047fad9b6b29eac9dc56eaadcf2
parent4b6cd9daa810d2cef044daf9faf0411d69624b12 (diff)
parent7d6380769c6b87e03f015cfe0376a0b7484a5b7c (diff)
Merge pull request #119725 from helsinki-systems/feat/flexoptix-app
flexoptix-app: Init at 5.9.0
-rw-r--r--nixos/modules/module-list.nix1
-rw-r--r--nixos/modules/programs/flexoptix-app.nix25
-rw-r--r--pkgs/tools/misc/flexoptix-app/default.nix47
-rw-r--r--pkgs/top-level/all-packages.nix2
4 files changed, 75 insertions, 0 deletions
diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix
index 11c18a9df4b49..98ba5ba48b44d 100644
--- a/nixos/modules/module-list.nix
+++ b/nixos/modules/module-list.nix
@@ -133,6 +133,7 @@
   ./programs/file-roller.nix
   ./programs/firejail.nix
   ./programs/fish.nix
+  ./programs/flexoptix-app.nix
   ./programs/freetds.nix
   ./programs/fuse.nix
   ./programs/geary.nix
diff --git a/nixos/modules/programs/flexoptix-app.nix b/nixos/modules/programs/flexoptix-app.nix
new file mode 100644
index 0000000000000..93dcdfeb51473
--- /dev/null
+++ b/nixos/modules/programs/flexoptix-app.nix
@@ -0,0 +1,25 @@
+{ config, pkgs, lib, ... }:
+
+with lib;
+
+let
+  cfg = config.programs.flexoptix-app;
+in {
+  options = {
+    programs.flexoptix-app = {
+      enable = mkEnableOption "FLEXOPTIX app + udev rules";
+
+      package = mkOption {
+        description = "FLEXOPTIX app package to use";
+        type = types.package;
+        default = pkgs.flexoptix-app;
+        defaultText = "\${pkgs.flexoptix-app}";
+      };
+    };
+  };
+
+  config = mkIf cfg.enable {
+    environment.systemPackages = [ cfg.package ];
+    services.udev.packages = [ cfg.package ];
+  };
+}
diff --git a/pkgs/tools/misc/flexoptix-app/default.nix b/pkgs/tools/misc/flexoptix-app/default.nix
new file mode 100644
index 0000000000000..40f30bd7ad909
--- /dev/null
+++ b/pkgs/tools/misc/flexoptix-app/default.nix
@@ -0,0 +1,47 @@
+{ lib, appimageTools, fetchurl }: let
+  pname = "flexoptix-app";
+  version = "5.9.0";
+  name = "${pname}-${version}";
+
+  src = fetchurl {
+    name = "${name}.AppImage";
+    url = "https://flexbox.reconfigure.me/download/electron/linux/x64/FLEXOPTIX%20App.${version}.AppImage";
+    sha256 = "0gbqaj9b11mxx0knmmh2d5863kaslbb3r6c4h8rjhg8qy4cws7hj";
+  };
+
+  udevRules = fetchurl {
+    url = "https://www.flexoptix.net/skin/udev_rules/99-tprogrammer.rules";
+    sha256 = "0mr1bhgvavq1ax4206z1vr2y64s3r676w9jjl9ysziklbrsvk5rr";
+  };
+
+  appimageContents = appimageTools.extractType2 {
+    inherit name src;
+  };
+
+in appimageTools.wrapType2 {
+  inherit name src;
+
+  multiPkgs = null; # no 32bit needed
+  extraPkgs = { pkgs, ... }@args: [
+    pkgs.hidapi
+  ] ++ appimageTools.defaultFhsEnvArgs.multiPkgs args;
+
+  extraInstallCommands = ''
+    mv $out/bin/{${name},${pname}}
+    install -Dm444 ${appimageContents}/flexoptix-app.desktop -t $out/share/applications
+    install -Dm444 ${appimageContents}/flexoptix-app.png -t $out/share/pixmaps
+    substituteInPlace $out/share/applications/flexoptix-app.desktop \
+      --replace 'Exec=AppRun' "Exec=$out/bin/${pname}"
+    mkdir -p $out/lib/udev/rules.d
+    ln -s ${udevRules} $out/lib/udev/rules.d/99-tprogrammer.rules
+  '';
+
+  meta = {
+    description = "Configure FLEXOPTIX Universal Transcievers in seconds";
+    homepage = "https://www.flexoptix.net";
+    changelog = "https://www.flexoptix.net/en/flexoptix-app/?os=linux#flexapp__modal__changelog";
+    license = lib.licenses.unfree;
+    maintainers = with lib.maintainers; [ das_j ];
+    platforms = [ "x86_64-linux" ];
+  };
+}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 76c68e6b3952a..016ffb025a675 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -4513,6 +4513,8 @@ in
 
   flent = python3Packages.callPackage ../applications/networking/flent { };
 
+  flexoptix-app = callPackage ../tools/misc/flexoptix-app { };
+
   flpsed = callPackage ../applications/editors/flpsed { };
 
   fluentd = callPackage ../tools/misc/fluentd { };