From 71d37d8535798cfec0311815bb34fc098e77855e Mon Sep 17 00:00:00 2001 From: Nicolas Benes Date: Sat, 25 Mar 2023 14:35:27 +0100 Subject: [PATCH 1/5] libnitrokey: init at 3.8 --- .../libraries/libnitrokey/default.nix | 41 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 + 2 files changed, 43 insertions(+) create mode 100644 pkgs/development/libraries/libnitrokey/default.nix diff --git a/pkgs/development/libraries/libnitrokey/default.nix b/pkgs/development/libraries/libnitrokey/default.nix new file mode 100644 index 0000000000000..2f06fe8eafba4 --- /dev/null +++ b/pkgs/development/libraries/libnitrokey/default.nix @@ -0,0 +1,41 @@ +{ lib +, stdenv +, fetchFromGitHub +, cmake +, pkg-config +, hidapi +, libusb1 +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "libnitrokey"; + version = "3.8"; + + src = fetchFromGitHub { + owner = "Nitrokey"; + repo = "libnitrokey"; + rev = "v${finalAttrs.version}"; + hash = "sha256-9ZMR1g04gNzslax6NpD6KykfUfjpKFIizaMMn06iJa0="; + }; + + nativeBuildInputs = [ + cmake + pkg-config + ]; + + cmakeFlags = [ + "-DADD_GIT_INFO=OFF" + "-DCMAKE_INSTALL_UDEVRULESDIR=etc/udev/rules.d" + ]; + + buildInputs = [ libusb1 ]; + + propagatedBuildInputs = [ hidapi ]; + + meta = with lib; { + description = "Communicate with Nitrokey devices in a clean and easy manner"; + homepage = "https://github.com/Nitrokey/libnitrokey"; + license = licenses.lgpl3; + maintainers = with maintainers; [ panicgh raitobezarius ]; + }; +}) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 957ee76bcdde7..dfaa75b3f089b 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -21594,6 +21594,8 @@ with pkgs; libnice = callPackage ../development/libraries/libnice { }; + libnitrokey = callPackage ../development/libraries/libnitrokey { }; + libnsl = callPackage ../development/libraries/libnsl { }; liboping = callPackage ../development/libraries/liboping { }; From 771d39638bc45280dadabdbf2734024b5843681e Mon Sep 17 00:00:00 2001 From: Nicolas Benes Date: Sat, 25 Mar 2023 18:13:33 +0100 Subject: [PATCH 2/5] nitrokey-udev-rules: replace with libnitrokey --- nixos/modules/hardware/nitrokey.nix | 2 +- .../security/nitrokey-app/udev-rules.nix | 20 ------------------- pkgs/top-level/aliases.nix | 1 + pkgs/top-level/all-packages.nix | 1 - 4 files changed, 2 insertions(+), 22 deletions(-) delete mode 100644 pkgs/tools/security/nitrokey-app/udev-rules.nix diff --git a/nixos/modules/hardware/nitrokey.nix b/nixos/modules/hardware/nitrokey.nix index fa9dd4d6d8f99..e2e88a8eade49 100644 --- a/nixos/modules/hardware/nitrokey.nix +++ b/nixos/modules/hardware/nitrokey.nix @@ -22,6 +22,6 @@ in }; config = mkIf cfg.enable { - services.udev.packages = [ pkgs.nitrokey-udev-rules ]; + services.udev.packages = [ pkgs.libnitrokey ]; }; } diff --git a/pkgs/tools/security/nitrokey-app/udev-rules.nix b/pkgs/tools/security/nitrokey-app/udev-rules.nix deleted file mode 100644 index 11dcd63d77616..0000000000000 --- a/pkgs/tools/security/nitrokey-app/udev-rules.nix +++ /dev/null @@ -1,20 +0,0 @@ -{ lib, stdenv, nitrokey-app }: - - -stdenv.mkDerivation { - name = "nitrokey-udev-rules-${lib.getVersion nitrokey-app}"; - - inherit (nitrokey-app) src; - - dontBuild = true; - - installPhase = '' - mkdir -p $out/etc/udev/rules.d - cp libnitrokey/data/41-nitrokey.rules $out/etc/udev/rules.d - ''; - - meta = { - description = "udev rules for Nitrokeys"; - inherit (nitrokey-app.meta) homepage license maintainers; - }; -} diff --git a/pkgs/top-level/aliases.nix b/pkgs/top-level/aliases.nix index ad5b2967052a2..63d435cbe8c17 100644 --- a/pkgs/top-level/aliases.nix +++ b/pkgs/top-level/aliases.nix @@ -1071,6 +1071,7 @@ mapAliases ({ nfsUtils = throw "'nfsUtils' has been renamed to/replaced by 'nfs-utils'"; # Converted to throw 2022-02-22 nginxUnstable = throw "'nginxUnstable' has been renamed to/replaced by 'nginxMainline'"; # Converted to throw 2022-02-22 nilfs_utils = throw "'nilfs_utils' has been renamed to/replaced by 'nilfs-utils'"; # Converted to throw 2022-02-22 + nitrokey-udev-rules = libnitrokey; # Added 2023-03-25 nix-direnv-flakes = nix-direnv; nix-review = nixpkgs-review; # Added 2019-12-22 nixFlakes = nixVersions.stable; # Added 2021-05-21 diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index dfaa75b3f089b..75ed2c967d64d 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -39268,7 +39268,6 @@ with pkgs; pynitrokey = callPackage ../tools/security/pynitrokey { }; nitrokey-app = libsForQt5.callPackage ../tools/security/nitrokey-app { }; - nitrokey-udev-rules = callPackage ../tools/security/nitrokey-app/udev-rules.nix { }; fpm2 = callPackage ../tools/security/fpm2 { }; From 5ad0e539169d07ddde4fae2409fe131889bfafd7 Mon Sep 17 00:00:00 2001 From: Nicolas Benes Date: Mon, 27 Mar 2023 14:00:00 +0200 Subject: [PATCH 3/5] cppcodec: init at 0.2 --- .../libraries/cppcodec/default.nix | 31 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 ++ 2 files changed, 33 insertions(+) create mode 100644 pkgs/development/libraries/cppcodec/default.nix diff --git a/pkgs/development/libraries/cppcodec/default.nix b/pkgs/development/libraries/cppcodec/default.nix new file mode 100644 index 0000000000000..d3ead22f6b134 --- /dev/null +++ b/pkgs/development/libraries/cppcodec/default.nix @@ -0,0 +1,31 @@ +{ lib +, stdenv +, fetchFromGitHub +, cmake +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "cppcodec"; + version = "0.2"; + + src = fetchFromGitHub { + owner = "tplgy"; + repo = finalAttrs.pname; + rev = "v${finalAttrs.version}"; + hash = "sha256-k4EACtDOSkTXezTeFtVdM1EVJjvGga/IQSrvDzhyaXw="; + }; + + nativeBuildInputs = [ cmake ]; + + meta = with lib; { + description = "Header-only C++11 library for encode/decode functions as in RFC 4648"; + longDescription = '' + Header-only C++11 library to encode/decode base64, base64url, base32, + base32hex and hex (a.k.a. base16) as specified in RFC 4648, plus + Crockford's base32. + ''; + homepage = "https://github.com/tplgy/cppcodec"; + license = licenses.mit; + maintainers = with maintainers; [ panicgh raitobezarius ]; + }; +}) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 75ed2c967d64d..d1677eb812439 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -19603,6 +19603,8 @@ with pkgs; cppcms = callPackage ../development/libraries/cppcms { }; + cppcodec = callPackage ../development/libraries/cppcodec { }; + cppunit = callPackage ../development/libraries/cppunit { }; cpputest = callPackage ../development/libraries/cpputest { }; From 2645079477a9412bd25716b2605cadad294ed02a Mon Sep 17 00:00:00 2001 From: Nicolas Benes Date: Sat, 25 Mar 2023 16:43:39 +0100 Subject: [PATCH 4/5] nitrokey-app: use system libnitrokey and cppcodec Do not use the git submodule in nitrokey-app. --- pkgs/tools/security/nitrokey-app/default.nix | 35 ++++++++++++-------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/pkgs/tools/security/nitrokey-app/default.nix b/pkgs/tools/security/nitrokey-app/default.nix index acc82636f32f0..502716d9e0268 100644 --- a/pkgs/tools/security/nitrokey-app/default.nix +++ b/pkgs/tools/security/nitrokey-app/default.nix @@ -1,5 +1,13 @@ -{ lib, stdenv, bash-completion, cmake, fetchFromGitHub, hidapi, libusb1, pkg-config -, qtbase, qttranslations, qtsvg, wrapQtAppsHook }: +{ lib +, stdenv +, cmake +, fetchFromGitHub +, pkg-config +, qttranslations +, wrapQtAppsHook +, libnitrokey +, cppcodec +}: stdenv.mkDerivation rec { pname = "nitrokey-app"; @@ -9,24 +17,25 @@ stdenv.mkDerivation rec { owner = "Nitrokey"; repo = "nitrokey-app"; rev = "v${version}"; - sha256 = "1k0w921hfrya4q2r7bqn7kgmwvwb7c15k9ymlbnksmfc9yyjyfcv"; - fetchSubmodules = true; + hash = "sha256-c6EC5uuMna07xVHDRFq0UDwuSeopZTmZGZ9ZD5zaq8Y="; }; - buildInputs = [ - bash-completion - hidapi - libusb1 - qtbase - qttranslations - qtsvg - ]; nativeBuildInputs = [ cmake pkg-config wrapQtAppsHook + qttranslations + ]; + + cmakeFlags = [ + "-DADD_GIT_INFO=OFF" + "-DBASH_COMPLETION_PATH=share/bash-completion/completions" + ]; + + buildInputs = [ + libnitrokey + cppcodec ]; - cmakeFlags = [ "-DCMAKE_BUILD_TYPE=Release" ]; meta = with lib; { description = "Provides extra functionality for the Nitrokey Pro and Storage"; From c42fe31f1e442bc426e33cbb5dccfb2b7b0ac029 Mon Sep 17 00:00:00 2001 From: Nicolas Benes Date: Mon, 27 Mar 2023 18:44:59 +0200 Subject: [PATCH 5/5] nitrokey-app: add panicgh to maintainers --- pkgs/tools/security/nitrokey-app/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/tools/security/nitrokey-app/default.nix b/pkgs/tools/security/nitrokey-app/default.nix index 502716d9e0268..8f8991801f7ce 100644 --- a/pkgs/tools/security/nitrokey-app/default.nix +++ b/pkgs/tools/security/nitrokey-app/default.nix @@ -46,6 +46,6 @@ stdenv.mkDerivation rec { ''; homepage = "https://github.com/Nitrokey/nitrokey-app"; license = licenses.gpl3; - maintainers = with maintainers; [ kaiha ]; + maintainers = with maintainers; [ kaiha panicgh ]; }; }