Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libfprint: added a fork for Lenovo ThinkPad #61546

Merged
merged 2 commits into from May 20, 2019
Merged

libfprint: added a fork for Lenovo ThinkPad #61546

merged 2 commits into from May 20, 2019

Conversation

cizra
Copy link
Contributor

@cizra cizra commented May 15, 2019

Motivation for this change

Lenovo ThinkPads have a fingerprint sensor with special needs. There's a fork of libfprintd available that supports it.

Things done
  1. Added thinkpad option to pkgs/development/libraries/libfprint/default.nix
  2. Added thinkpad option to fprintd (package and service)

Usage:

  services.fprintd.package = pkgs.fprintd-thinkpad;
  services.fprintd.enable = true;
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nix-review --run "nix-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Assured whether relevant documentation is up to date
  • Fits CONTRIBUTING.md.

pkgs/development/libraries/libfprint/default.nix Outdated Show resolved Hide resolved
pkgs/development/libraries/libfprint/default.nix Outdated Show resolved Hide resolved
pkgs/development/libraries/libfprint/default.nix Outdated Show resolved Hide resolved
@cizra
Copy link
Contributor Author

cizra commented May 17, 2019

@Synthetica9 all your suggestions have been implemented, thanks for these. Are you still requesting other changes?

Copy link
Member

@Synthetica9 Synthetica9 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@cizra
Copy link
Contributor Author

cizra commented May 17, 2019

@abbradar it's all yours then!

@worldofpeace
Copy link
Contributor

Oh I'm sorry, it appears my suggestion breaks the urls.

This patch should fix that, also remove the if for the src.

patch
diff --git a/pkgs/development/libraries/libfprint/default.nix b/pkgs/development/libraries/libfprint/default.nix
index fa6282cec99..fc4a8c7c342 100644
--- a/pkgs/development/libraries/libfprint/default.nix
+++ b/pkgs/development/libraries/libfprint/default.nix
@@ -7,18 +7,19 @@ stdenv.mkDerivation rec {
   pname = "libfprint" + stdenv.lib.optionalString thinkpad "-thinkpad";
   version = "0.99.0";
 
-  src =
-    if thinkpad then
-      fetchFromGitHub {
-        owner = "3v1n0";
-        repo = pname;
-        rev = "2e2e3821717e9042e93a995bdbd3d00f2df0be9c";
-        sha256 = "1vps1wrp7hskf13f7jrv0dwry2fcid76x2w463wplngp63cj7b3b";
-      }
-    else fetchurl {
-      url = "https://gitlab.freedesktop.org/${pname}/${pname}/uploads/82ba3cef5bdf72997df711eacdb13c0f/${pname}-${version}.tar.xz";
+  src = {
+    libfprint-thinkpad = fetchFromGitHub {
+      owner = "3v1n0";
+      repo = "libfprint";
+      rev = "2e2e3821717e9042e93a995bdbd3d00f2df0be9c";
+      sha256 = "1vps1wrp7hskf13f7jrv0dwry2fcid76x2w463wplngp63cj7b3b";
+    };
+
+    libfprint = fetchurl {
+      url = "https://gitlab.freedesktop.org/libfprint/libfprint/uploads/82ba3cef5bdf72997df711eacdb13c0f/libfprint-${version}.tar.xz";
       sha256 = "16r4nl40y0jri57jiqmdz4s87byblx22lbhyvqpljd6mqm5rg187";
     };
+  }.${pname};
 
   buildInputs = [ libusb pixman glib nss gtk3 ]
     ++ stdenv.lib.optional thinkpad openssl;
@@ -28,7 +29,7 @@ stdenv.mkDerivation rec {
   mesonFlags = [ "-Dudev_rules_dir=lib/udev/rules.d" "-Dx11-examples=false" ];
 
   preConfigure = ''
-    substituteInPlace ${pname}/meson.build \
+    substituteInPlace libfprint/meson.build \
       --replace /bin/echo ${coreutils}/bin/echo
   '';
 
diff --git a/pkgs/tools/security/fprintd/default.nix b/pkgs/tools/security/fprintd/default.nix
index 2297b8cdca4..b43be1a6924 100644
--- a/pkgs/tools/security/fprintd/default.nix
+++ b/pkgs/tools/security/fprintd/default.nix
@@ -7,7 +7,7 @@ stdenv.mkDerivation rec {
   version = "0.8.1";
 
   src = fetchurl {
-    url = "https://gitlab.freedesktop.org/libfprint/${pname}/uploads/bdd9f91909f535368b7c21f72311704a/${pname}-${version}.tar.xz";
+    url = "https://gitlab.freedesktop.org/libfprint/fprintd/uploads/bdd9f91909f535368b7c21f72311704a/fprintd-${version}.tar.xz";
     sha256 = "124s0g9syvglgsmqnavp2a8c0zcq8cyaph8p8iyvbla11vfizs9l";
   };
 

@cizra
Copy link
Contributor Author

cizra commented May 20, 2019

@worldofpeace Are Nix expressions lazily evaluated? If not, you're fetching both sources instead of only the right one.

@Synthetica9
Copy link
Member

Are Nix expressions lazily evaluated?

They are :)

@cizra
Copy link
Contributor Author

cizra commented May 20, 2019

@worldofpeace should be better now.

@worldofpeace
Copy link
Contributor

@GrahamcOfBorg build libfprint fprintd libfprint-thinkpad fprintd-thinkpad

@worldofpeace worldofpeace merged commit 6543e79 into NixOS:master May 20, 2019
@worldofpeace
Copy link
Contributor

Congrats @cizra ✨ Thank you for contributing.
Also, smart to followup in irc for questions, most nixos devs hang around there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants