ahbnr / nixos-06cb-009a-fingerprint-sensor

Nix flake for driving the 06cb:009a fingerprint sensor on NixOS
28 stars 13 forks source link

fprintd-enroll list_devices failed: #3

Closed Silverdev2482 closed 1 year ago

Silverdev2482 commented 1 year ago

I have followed the first part of the instructions up to step 3. However i get the error: list_devices failed: I am on a thinkpad t480. I see this similar issue: https://github.com/uunicorn/open-fprintd/issues/6 I have the inputs modules and services enabled for open-fprintd and python-validity. I don't have the services or packages for fprintd installed or enabled. Here are my config files, sorry for messed up formatting

flake.nix

    description = "A very basic flake";

    inputs = {
        nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
        hyprland.url = "github:hyprwm/Hyprland";
        stardustxr.url = "github:StardustXR/server";
        home-manager = {
            url = "github:nix-community/home-manager";
            inputs.nixpkgs.follows = "nixpkgs";
        };
        nixos-06cb-009a-fingerprint-sensor = {
            url = "github:ahbnr/nixos-06cb-009a-fingerprint-sensor";
            inputs.nixpkgs.follows = "nixpkgs";
        };
    };

    outputs = {
        self,
        nixpkgs,
        home-manager,
        hyprland,
        nixos-06cb-009a-fingerprint-sensor,
        ...
    }: let
        system = "x86_64-linux";
    in {
        nixosConfigurations = {
            silverdev2482 = nixpkgs.lib.nixosSystem {
                inherit system;
                modules = [
                    ./hardware-configuration.nix
                    ./configuration.nix
                    home-manager.nixosModules.home-manager
                    {
                        home-manager.useGlobalPkgs = true;
                        home-manager.useUserPackages = true;
                        home-manager.users.silverdev2482 = {
                            imports = [./home.nix];
                        };
                    }
                    hyprland.nixosModules.default
                    {programs =  {
                        hyprland.enable = true;
                        };
                    }
                    nixos-06cb-009a-fingerprint-sensor.nixosModules.open-fprintd
                    nixos-06cb-009a-fingerprint-sensor.nixosModules.python-validity
                ];
            };
        };
    };
}```

configuration.nix
```# Edit this configuration file to define what should be installed on
# your system.  Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).

{ config, pkgs, lib, ... }:

{
    virtualisation.libvirtd.enable = true;

    # Bootloader
    boot = {
        loader.systemd-boot.enable = true;
        loader.efi.canTouchEfiVariables = true;
        loader.efi.efiSysMountPoint = "/boot/efi";
        kernelPackages = pkgs.linuxPackages_latest;
        extraModulePackages = [ config.boot.kernelPackages.ddcci-driver ];
        initrd.kernelModules = [ "i915" ];
        kernelModules = [ "i2c-dev" "ddcci_backlight" ];
        kernel.sysctl = { "dev.i915.perf_stream_paranoid" = 0; };
    };

    networking = {
        hostName = "nixos"; # Define your hostname.
        networkmanager.enable = true; # Enable networking
    };

    # Define a user account. Don't forget to set a password with ‘passwd’.
    users.users.silverdev2482 = {
        isNormalUser = true;
        extraGroups = [ "video" "input" "networkmanager" "wheel" "plugdev" "libvirtd" ];
    };

    # Set your time zone.
    time.timeZone = "America/Chicago";

    nixpkgs = {
        overlays = [
            (self: super: { eww = super.eww.override {
                withWayland = true;
            };})
#           (self: super: { factorio = super.factorio.override {
#               username = "silverdev2482";
#               token = "censored";
#               versionsJson = "/home/silverdev2482/Configuration/configs/factorio/versions.json";
#           };})
            (self: super: { wine = super.wine.override {
                openglSupport = true;
                vulkanSupport = true;
                waylandSupport = true;
            };})
        ];
    };

    nix = {
        package = pkgs.nixFlakes;
        extraOptions = "experimental-features = nix-command flakes";
    };
    nixpkgs.config.allowUnfree = true;
    system.autoUpgrade = {
        enable = true;
    };

    # Enable sound with pipewire.
    sound.enable = true;
    hardware.pulseaudio.enable = false;
    security.rtkit.enable = true;
    services.pipewire = {
        enable = true;
        alsa.enable = true;
        alsa.support32Bit = true;
        pulse.enable = true;
        jack.enable = true;
    };

    xdg.portal = {
        enable = true;
        wlr.enable = true;
        # gtk portal needed to make gtk apps happy
        extraPortals = [ pkgs.xdg-desktop-portal-gtk ];
    };

    # Fonts
    fonts.fonts = with pkgs; [
        (nerdfonts.override { fonts = [ "ShareTechMono" ]; })
    ];

    hardware = {
        i2c.enable = true;
        rtl-sdr.enable = true;
        opengl.extraPackages = [ pkgs.mesa.drivers ];
        bluetooth.enable = true;
    };

    i18n.defaultLocale = "en_US.utf8";
    console.useXkbConfig = true;
    services.xserver = {
        layout = "us";
        xkbVariant = "workman";
        xkbOptions = "ctrl:swap_rwin_rctrl";
    };

    services = {
        throttled.enable = true;
        dbus.enable = true;
        openssh = {
            enable = true;
        };
        blueman.enable = true;
        logind.lidSwitch = "ignore";
        printing.enable = true;
        avahi = {
            enable = true;
            nssmdns = true;
        };
        fprintd.enable = false;
        open-fprintd.enable = true;
        python-validity.enable = true;
    };

    programs = {
        sway = {
            enable = true;
            wrapperFeatures.gtk = true;
        };
        steam.enable = true;
        dconf.enable = true;
        mosh.enable = true;
    };

    environment.systemPackages = with pkgs; [
        (pkgs.factorio.override {
            username = "silverdev2482";
            token = "censored";
            versionsJson = ./configs/factorio/versions.json;
        })
        mosh
        virtmanager
        bluez
        blueman
        pkgs.eww
        pkgs.mimalloc
        pkgs.libhugetlbfs
        pkgs.protontricks
        pkgs.steam
        pkgs.neovim
        pkgs.discord
        pkgs.element-desktop
        pkgs.libsForQt5.ark
        pkgs.waybar
        pkgs.zip
        pkgs.git
        pkgs.brightnessctl
        pkgs.firefox
        pkgs.file
        pkgs.unzip
        pkgs.lm_sensors
        pkgs.zathura
        pkgs.alacritty
        pkgs.mesa
        pkgs.rtl-sdr
        pkgs.rustup
        pkgs.libdrm
        pkgs.sway
        pkgs.wayland
        pkgs.grim # screenshot functionality
        pkgs.slurp # screenshot functionality
        pkgs.wl-clipboard # wl-copy and wl-paste for copy/paste from stdin / stdout
        pkgs.mako # notification system developed by swaywm maintainer
    ];

    # Some programs need SUID wrappers, can be configured further or are
    # started in user sessions.
    # programs.mtr.enable = true;
    # programs.gnupg.agent = {
    #   enable = true;
    #   enableSSHSupport = true;
    # };

    # List services that you want to enable:

    # Enable the OpenSSH daemon.
    # services.openssh.enable = true;

    # Open ports in the firewall.
    # networking.firewall.allowedTCPPorts = [ ... ];
    # networking.firewall.allowedUDPPorts = [ ... ];
    # Or disable the firewall altogether.
    # networking.firewall.enable = false;

    # This value determines the NixOS release from which the default
    # settings for stateful data, like file locations and database versions
    # on your system were taken. It‘s perfectly fine and recommended to leave
    # this value at the release version of the first install of this system.
    # Before changing this value read the documentation for this option
    # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
    system.stateVersion = "22.11"; # Did you read the comment?

}```

hardware-configuration.nix
```# Do not modify this file!  It was generated by ‘nixos-generate-config’
# and may be overwritten by future invocations.  Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:

{
  imports =
    [ (modulesPath + "/installer/scan/not-detected.nix")
    ];

  boot.initrd.availableKernelModules = [ "xhci_pci" "nvme" "usb_storage" "sd_mod" ];
  boot.initrd.kernelModules = [ ];
  boot.kernelModules = [ "kvm-intel" ];
  boot.extraModulePackages = [ ];

# 39042494-1028-4e9b-b320-98fcf6e01d78
  fileSystems."/" =
    { device = "/dev/disk/by-label/NIXOS";
      fsType = "ext4";
    };

# F63E-68C0
  fileSystems."/boot/efi" =
    { device = "/dev/disk/by-label/BOOT";
      fsType = "vfat";
    };

  swapDevices = [ ];

  # Enables DHCP on each ethernet and wireless interface. In case of scripted networking
  # (the default) this is the recommended approach. When using systemd-networkd it's
  # still possible to use this option, but it's recommended to use it in conjunction
  # with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
  networking.useDHCP = lib.mkDefault true;
  # networking.interfaces.enp0s31f6.useDHCP = lib.mkDefault true;
  # networking.interfaces.wlp3s0.useDHCP = lib.mkDefault true;

  powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
  hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}```

home.nix
```{ config, pkgs, ... }:

let
    factorio = pkgs.symlinkJoin {
        name = "factorio";
        paths = [pkgs.factorio];
        buildInputs = [pkgs.makeWrapper];
        postInstall = ''
            wrapProgram $out/bin/factorio \
            --set LD_PRELOAD=${pkgs.mimalloc}/lib/libmimalloc.so \
            --set MIMALLOC_DECOMMIT_DELAY=10000 \
            --set MIMALLOC_RESERVE_HUGE_OS_PAGES=8 \
            --set MIMALLOC_SHOW_STATS=1 \
            --set MIMALLOC_SHOW_ERRORS=1 \
            --set HUGETLB_MORECORE=thp 
            '';
        };
    in

{

    # Home Manager needs a bit of information about you and the
    # paths it should manage.
    home.username = "silverdev2482";
    home.homeDirectory = "/home/silverdev2482";

    # This value determines the Home Manager release that your
    # configuration is compatible with. This helps avoid breakage
    # when a new Home Manager release introduces backwards
    # incompatible changes.
    #
    # You can update Home Manager without changing this value. See
    # the Home Manager release notes for a list of state version
    # changes in each release.
    home.stateVersion = "22.11";

    home.file = {
        ".config/sway/config".source = ./configs/sway;
        ".config/nvim/init.vim".source = ./configs/init.vim;
        ".config/discord/settings.json".source = ./configs/discord.json;
        ".config/hypr/hyprland.conf".source = ./configs/hyprland.conf;
    };

    home.packages = with pkgs; [
        jq
        pulseaudio
        superTux
        superTuxKart
        prismlauncher
        blender
        pkgs.texlive.combined.scheme-full
        pkgs.glow
        pkgs.mdbook
        pkgs.kitty
        pkgs.phoronix-test-suite
        pkgs.sane-frontends
        pkgs.xsane
        pkgs.sane-backends
        pkgs.sane-airscan
        pkgs.tofi
        pkgs.winetricks
        pkgs.lxqt.pavucontrol-qt
        pkgs.wineWowPackages.waylandFull
        pkgs.protonup-ng
        pkgs.pciutils
        pkgs.mimalloc
        pkgs.libhugetlbfs
        pkgs.btop
        pkgs.patchelf
        pkgs.sshfs
        pkgs.nvd
        pkgs.nix-index
        pkgs.autotiling
        pkgs.freecad
        pkgs.neofetch
        pkgs.ddcutil
        pkgs.acpi
        pkgs.gnumake
        pkgs.tor-browser-bundle-bin
        pkgs.gcc
        pkgs.lutris
        pkgs.sysbench
        pkgs.sdrpp
        pkgs.rtl_433
        pkgs.ipfs
        pkgs.obs-studio
        pkgs.obs-studio-plugins.obs-pipewire-audio-capture
        pkgs.glibc
        pkgs.mpv
        pkgs.youtube-dl
        pkgs.flatpak
        pkgs.gimp
        pkgs.qpwgraph
        pkgs.easyeffects
        pkgs.libqalculate
        pkgs.glxinfo
        pkgs.qalculate-gtk
        pkgs.gnuradio
    ];

    # Let Home Manager install and manage itself.
    programs.home-manager.enable = true;
}
ahbnr commented 1 year ago

Hi, thanks for submitting this issue and for providing your system configuration!

I might have run into this issue before when switching from fprintd to open-fprintd. In that case, I think running systemctl restart open-fprintd and systemctl restart python-validity after nixos-rebuild resolved it, for some reason.

If you have not been running fprintd before switching to this configuration, its probably something else.

I am a bit busy at the moment, but I'll take a look at this within the next week.

ahbnr commented 1 year ago

Also, please remove inputs.nixpkgs.follows = "nixpkgs"; from the nixos-06cb-009a-fingerprint-sensor flake.

I only tested this flake for NixOS stable / NixOS 22.11 and as I just found out through this issue, this flake unfortunately is currently not compatible with NixOS unstable.

If you remove the inputs.nixpkgs.follows = "nixpkgs"; line, the flake should automatically use the nixpkgs from NixOS 22.11 for its dependencies.

I'll update the ReadMe regarding this shortly.

Silverdev2482 commented 1 year ago

That did not fix my issue however I did find something that could be of use:

[silverdev2482@nixos:~/Configuration]$ sudo systemctl status open-fprintd | wl-copy
● open-fprintd.service - Open FPrint Daemon
     Loaded: loaded (/etc/systemd/system/open-fprintd.service; linked; preset: enabled)
     Active: active (running) since Sat 2023-04-22 11:39:00 CDT; 2min 15s ago
   Main PID: 13825 (.open-fprintd-w)
         IP: 0B in, 0B out
         IO: 0B read, 0B written
      Tasks: 1 (limit: 18867)
     Memory: 10.3M
        CPU: 100ms
     CGroup: /system.slice/open-fprintd.service
             └─13825 /nix/store/rpri9nb8xpwwqakyrqbg8zdslkjs2hd3-python3-3.10.11/bin/python3.10 /nix/store/d04y7c5v1m1i51xla096448562sqgc3g-python3.10-open-fprintd-0.6/bin/.open-fprintd-wrapped --debug

Apr 22 11:39:00 nixos systemd[1]: Starting Open FPrint Daemon...
Apr 22 11:39:00 nixos systemd[1]: Started Open FPrint Daemon.
Apr 22 11:39:00 nixos open-fprintd[13825]: /nix/store/d04y7c5v1m1i51xla096448562sqgc3g-python3.10-open-fprintd-0.6/bin/.open-fprintd-wrapped:26: PyGIDeprecationWarning: GObject.MainLoop is deprecated; use GLib.MainLoop instead
Apr 22 11:39:00 nixos open-fprintd[13825]:   GObject.MainLoop().run()
Apr 22 11:39:12 nixos open-fprintd[13825]: DEBUG:root:GetDefaultDevice
[silverdev2482@nixos:~/Configuration]$ sudo systemctl status python3-validity.service | wl-copy
× python3-validity.service - python-validity driver dbus service
     Loaded: loaded (/etc/systemd/system/python3-validity.service; enabled; preset: enabled)
    Drop-In: /nix/store/r45v0lyv7k7yg1insa1xf6jyy06y9ndy-system-units/python3-validity.service.d
             └─overrides.conf
     Active: failed (Result: exit-code) since Sat 2023-04-22 11:39:08 CDT; 1min 12s ago
   Duration: 694ms
    Process: 13844 ExecStart=/nix/store/izphf8rk8r8gdpcc2c3pj44j68k9i6pn-python3.10-python-validity-0.14/bin/python-validity-dbus-service --debug (code=exited, status=1/FAILURE)
   Main PID: 13844 (code=exited, status=1/FAILURE)
         IP: 0B in, 0B out
        CPU: 252ms

Apr 22 11:39:08 nixos python-validity-dbus-service[13844]:     init.open()
Apr 22 11:39:08 nixos python-validity-dbus-service[13844]:   File "/nix/store/izphf8rk8r8gdpcc2c3pj44j68k9i6pn-python3.10-python-validity-0.14/lib/python3.10/site-packages/validitysensor/init.py", line 48, in open
Apr 22 11:39:08 nixos python-validity-dbus-service[13844]:     open_common()
Apr 22 11:39:08 nixos python-validity-dbus-service[13844]:   File "/nix/store/izphf8rk8r8gdpcc2c3pj44j68k9i6pn-python3.10-python-validity-0.14/lib/python3.10/site-packages/validitysensor/init.py", line 33, in open_common
Apr 22 11:39:08 nixos python-validity-dbus-service[13844]:     upload_fwext()
Apr 22 11:39:08 nixos python-validity-dbus-service[13844]:   File "/nix/store/izphf8rk8r8gdpcc2c3pj44j68k9i6pn-python3.10-python-validity-0.14/lib/python3.10/site-packages/validitysensor/upload_fwext.py", line 48, in upload_fwext
Apr 22 11:39:08 nixos python-validity-dbus-service[13844]:     with open(fw_path, 'rb') as f:
Apr 22 11:39:08 nixos python-validity-dbus-service[13844]: FileNotFoundError: [Errno 2] No such file or directory: '/nix/store/izphf8rk8r8gdpcc2c3pj44j68k9i6pn-python3.10-python-validity-0.14/share/python-validity/6_07f_lenovo_mis_qm.xpfwext'
Apr 22 11:39:08 nixos systemd[1]: python3-validity.service: Main process exited, code=exited, status=1/FAILURE
Apr 22 11:39:08 nixos systemd[1]: python3-validity.service: Failed with result 'exit-code'.
Silverdev2482 commented 1 year ago

Oh yeah just to confirm I did remove the line and I'm pretty sure it at least backdated the packages to the correct versions, restarting the services seemingly has no affect.

Silverdev2482 commented 1 year ago

/nix/store/izphf8rk8r8gdpcc2c3pj44j68k9i6pn-python3.10-python-validity-0.14/share/python-validity/6_07f_lenovo_mis_qm.xpfwext so this file not existing appears to be a problem, the directory is there just up to the file which isn't there.

I have discovered by trying to execute random script these errors come from a python script called validity-sensor-firmware.

Now I realize that I get this same output from the python-validity-dbus-service script.

I'm not sure if this is useful, you probably already know this but my findings could be useful

Silverdev2482 commented 1 year ago

Any ideas for what is wrong?

ahbnr commented 1 year ago

I did take a rough look again at the python-validity source code, and it looks like the download_and_extract_fw() in bin/validity-sensors-firmware method might not have executed properly for some reason. I suspect this part of the code is responsible for loading the 6_07f_lenovo_mis_qm.xpfwext file that is missing in the error log you shared.

As to when it is executed, and why it might have failed, I need to check. Sorry for not replying earlier this week, I've been very busy unfortunately. I will try to take a look later today into why download_and_extract_fw() might fail.

EDIT

I have discovered by trying to execute random script these errors come from a python script called validity-sensor-firmware.

Ah I see you have also found it

ahbnr commented 1 year ago

Ok, I think I now understand what is happening, and why I never ran into this issue.

The firmware downloaded by download_and_extract_fw() is only ever needed, if it has not yet been flashed to the sensor device. The method upload_fwext(), which is always called as part of python-validity's startup procedure checks whether the necessary firmware has already been flashed in lines 24 and 25. If it has already been flashed, the failing code requiring the firmware at line 48 is never executed.

Now, the firmware has already been flashed on my fp sensor, probably before I even started work on this repository, likely when I was still using python-validity on Arch Linux before the switch to Nix. So I never ran into this problem during testing.

The next part of this problem is that the firmware is not downloaded as part of the installation process, i.e. bin/validity-sensors-firmware is not properly executed.

So as the next step, I either need to adapt the build process to download the firmware, or patch upload_fwext so that it is done on the fly when required. I will do so soon-ish, not sure if I can today. Sorry for the delays.

ahbnr commented 1 year ago

I think I might have a fix ready now. This should be perfectly safe, since the fix just involves calling existing firmware download and installation scripts in python-validity, but let me reiterate that I do not take any responsibility for any issues caused by the use of this flake.

If you want, you can try out the fix like this: Please switch to the branch fix-missing-firmware, i.e. change the flake url like this:

url = "github:ahbnr/nixos-06cb-009a-fingerprint-sensor/fix-missing-firmware";

Then do a nix flake update, commit the changes and try a nixos-rebuild.

After that try downloading the firmware like this (run as root):

systemctl stop python3-validity
validity-sensors-firmware
systemctl start python3-validity

Then you can continue in the Readme where you last stopped.


Some background info on what I changed:

python-validity contains functionality to recognize the available fp sensor hardware, download the correct firmware, and upload it to the sensor.

Hardware recognition and download is implemented by the bin/validity-sensors-firmware script and it is actually meant to be executed during package installation on distributions like debian.

However, the hardware recognition does not seem to work in a Nix build environment (likely due to unavailable permissions/capabilities). Furthermore, it is probably not good to introduce these sort of side-effects when building a package.

There are two ways to resolve this:

  1. The package needs to accept the fp sensor id as a parameter and downloads the firmware during the build process. The hardware detection of python-validity is not executed.

  2. The firmware download is not part of the package build process. Instead, the user has to run bin/validity-sensors-firmware manually, the first time they use the software.

I opted for the second option, since the first option is prone to user error. Also, it makes the flake harder to maintain because if the firmware recognition and download code changes in python-validity, we have to update the package input options, too.

Having to call validiy-sensors-firmware manually is a bit tedious. Maybe I can further improve the flake by patching the python-validity service so that it auto-downloads the firmware.

Silverdev2482 commented 1 year ago

fprintd-enroll did work so I think its working. You should add validity-sensors-firmware too the path though if you choose to do the second option. also add that to the readme.

ahbnr commented 1 year ago

fprintd-enroll did work so I think its working.

Good to hear! Once you have enrolled your fingerprints I would also recommend to you to switch to the second driver option mentioned in the Readme, i.e. the libfprint-tod-vfs0090 driver fork by bingch. It works much more reliably for me than open-fprintd+python-validity. Also, open-fprintd is lacking authentication mechanisms for fingerprint enrolling, which is a bit concerning regarding security.

You should add validity-sensors-firmware too the path though

Hmm.. I actually did adapt the module so that validity-sensors-firmware automatically is on the path when you set

services.python-validity.enable = true;

It seems to work on my system, does it not automatically appear on your path?

add that to the readme

Of course. If everything is working for you now, I'll add some information about calling validity-sensors-firmware to the Readme and then close the issue after that.

Silverdev2482 commented 1 year ago

fprintd-enroll and fprintd-verify do work but I can't get authentication done now. When I try to do step 4 I get this error:

[silverdev2482@nixos:~/Configuration]$ ./update.sh
error: undefined variable 'nixos-06cb-009a-fingerprint-sensor'

       at /nix/store/knkwq0qbmk0l5ch897v1piskcpyg1898-source/configuration.nix:116:21:

          115|   auth sufficient pam_unix.so   likeauth try_first_pass nullok
          116|   auth sufficient ${nixos-06cb-009a-fingerprint-sensor.localPackages.fprintd-clients}/lib/security/pam_fprintd.so
             |                     ^
          117|   auth required pam_deny.so
(use '--show-trace' to show detailed location information)

when I go to the bingch driver i get this error:

[silverdev2482@nixos:~/Configuration]$ ./update.sh
[sudo] password for silverdev2482:
error: undefined variable 'nixos-06cb-009a-fingerprint-sensor'

       at /nix/store/nvqx3i0asaxvxf7w9qwy3qjdcjkm4di1-source/configuration.nix:129:14:

          128|              enable = true;
          129|              driver = nixos-06cb-009a-fingerprint-sensor.lib.libfprint-2-tod1-vfs0090-bingch {
             |              ^
          130|                  calib-data-file = ./calib-data.bin;
(use '--show-trace' to show detailed location information)

Is there a problem with my flake?

{
    description = "A very basic flake";

    inputs = {
        nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
        hyprland.url = "github:hyprwm/Hyprland";
        stardustxr.url = "github:StardustXR/server";
        home-manager = {
            url = "github:nix-community/home-manager";
            inputs.nixpkgs.follows = "nixpkgs";
        };
        nixos-06cb-009a-fingerprint-sensor.url = "github:ahbnr/nixos-06cb-009a-fingerprint-sensor";
    };

    outputs = {
        self,
        nixpkgs,
        home-manager,
        hyprland,
        nixos-06cb-009a-fingerprint-sensor,
        ...
    }: let
        system = "x86_64-linux";
    in {
        nixosConfigurations = {
            silverdev2482 = nixpkgs.lib.nixosSystem {
                inherit system;
                modules = [
                    ./hardware-configuration.nix
                    ./configuration.nix
                    home-manager.nixosModules.home-manager
                    {
                        home-manager.useGlobalPkgs = true;
                        home-manager.useUserPackages = true;
                        home-manager.users.silverdev2482 = {
                            imports = [./home.nix];
                        };
                    }
                    hyprland.nixosModules.default
                    {programs =  {
                        hyprland.enable = true;
                        };
                    }
#                   nixos-06cb-009a-fingerprint-sensor.nixosModules.open-fprintd
#                   nixos-06cb-009a-fingerprint-sensor.nixosModules.python-validity
                ];
            };
        };
    };
}
ahbnr commented 1 year ago

Can you try out the following changes:

  1. Pass on the flake inputs to your external configuration via specialArgs. I.e. change the following lines

       outputs = {
          self,
          nixpkgs,
          home-manager,
          hyprland,
          nixos-06cb-009a-fingerprint-sensor,
          ...
        }

    to

       outputs = {
          self,
          nixpkgs,
          home-manager,
          hyprland,
          nixos-06cb-009a-fingerprint-sensor,
          ...
        }@attrs

    that is, capture the inputs in a attrs variable.

    Then add specialArgs = attrs; to your nixosSystem call. I.e. it should look like this:

    silverdev2482 = nixpkgs.lib.nixosSystem {
      inherit system;
      specialArgs = attrs;
      modules = [
         ...
      ];
    };
  2. Declare nixos-06cb-009a-fingerprint-sensor as an argument of your configuration file, that is, in your configuration.nix change the line

    { config, pkgs, lib, ... }:

    to

    { config, pkgs, lib, nixos-06cb-009a-fingerprint-sensor, ... }:

Then the variable nixos-06cb-009a-fingerprint-sensor should become available in your configuration. This is also probably something that I should make clear in the README.

Silverdev2482 commented 1 year ago

Your advice works, I have the bingch driver working now. For some reason it wasn't immediately working after reboot. however messing with restarting systemd stuff seemed to fix it. I'm not sure why this happened but it working now. Maybe I just made a false observation. If you don't mind I actually feel like hunting down t480 owners with NixOS.

ahbnr commented 1 year ago

If you don't mind I actually feel like hunting down t480 owners with NixOS.

I'm not sure if I understand, you mean you want to find more T480 users for testing the sensor on NixOS?

Silverdev2482 commented 1 year ago

Yeah, just by searching t480 on NixOS forms.

ahbnr commented 1 year ago

Sounds like a good idea. Through this single issue you already helped me uncovered multiple problems with the flake / readme. Having more people test the flake might be helpful.

Btw. do you consider this issue completed? Then I would close it

Silverdev2482 commented 1 year ago

Yes

ahbnr commented 1 year ago

Ah, btw. I already merged the fix-missing-firmware branch with main. So if you want, you can adjust your flake.nix and switch back to the main branch.