Touchpad unresponsive in NixOs + Hyprland

Hi!

Just to preface this, I’m a complete NixOS noob so this might very well just be a skill issue.

I have installed and enjoyed NixOS for a couple days, but I recently made a change to my configuration.nix that ended up causing my PC to not finish its boot (or at least that’s my best guess, it just waited indefinitely just before the login screen).
“No worries,” i thought, “I’ll just force it to shut down, roll back to the previous iteration and be on my merry way!”
Which is exactly what I did, except the laptop’s touchpad has been unresponsive ever since. Plugging in a USB mouse works fine, and everything else works perfectly, but even rolling back to earlier iterations hasn’t been able to fix this.

This might just be something that got messed up during the failed boot, and I think reinstalling NixOS will probably fix it (source: It worked when I first installed it, and a similar problem I got when using Arch got fixed this way), but I hoped I could fix it without resorting to such a radical solution.

Additional information:

  • As mentionned in the title, I mainly use hyprland, however the problem persists on the default GNOME DE.
  • The laptop I’m using seems to use fairly annoying parts as far as harware support goes (for instance, my WiFi adapter has no linux drivers anywhere so I’m forced to use a USB antenna), but I don’t think that’s the core issue here.

Hope y’all can help me!

I highly doubt a reinstall will fix anything. It rarely does with NixOS because of how little configuration state it keeps.

I’d recommend you to simply update nixpkgs and if that still results in a non-booting generation, debug why that is.

Could you post your config?

sure thing! thanks for the reply.

{ config, pkgs, ... }:

{
  imports =
    [ # Include the results of the hardware scan.
      ./hardware-configuration.nix
    ];

  boot.loader = {
    grub = {
      device = "nodev";
      enable = true;
      useOSProber = true;
      efiSupport = true;
    };
    efi.canTouchEfiVariables = true;
  };

  networking.hostName = "nixos"; # Define your hostname.

  # Enable networking
  networking.networkmanager.enable = true;

  # Set your time zone.
  time.timeZone = "Europe/London";

  # Select internationalisation properties.
  i18n.defaultLocale = "en_US.UTF-8";

  i18n.extraLocaleSettings = {
    LC_ADDRESS = "fr_FR.UTF-8";
    LC_IDENTIFICATION = "fr_FR.UTF-8";
    LC_MEASUREMENT = "fr_FR.UTF-8";
    LC_MONETARY = "fr_FR.UTF-8";
    LC_NAME = "fr_FR.UTF-8";
    LC_NUMERIC = "fr_FR.UTF-8";
    LC_PAPER = "fr_FR.UTF-8";
    LC_TELEPHONE = "fr_FR.UTF-8";
    LC_TIME = "fr_FR.UTF-8";
  };

  # Enable the X11 windowing system.
  services.xserver.enable = true;

  # Enable the GNOME Desktop Environment.
  services.xserver.displayManager.gdm.enable = true;
  services.xserver.desktopManager.gnome.enable = true;

  # Configure keymap in X11
  services.xserver.xkb = {
    layout = "fr";
    variant = "azerty";
  };

  # Configure console keymap
  console.keyMap = "fr";

  # Enable CUPS to print documents.
  services.printing.enable = true;

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

  # Define a user account. Don't forget to set a password with ‘passwd’.
  users.users.blackstar = {
    isNormalUser = true;
    description = "EineNachtImMai";
    extraGroups = [ "networkmanager" "wheel" ];
    packages = with pkgs; [
    #  thunderbird
    ];
  };

# tried enabling greetd but I'm leaving this commented for now
  # services.greetd = {
  #   enable = true;
  #   settings = rec {
  #     initial_session = {
  #       command = "${pkgs.hyprland}/bin/Hyprland";
  #       user = "blackstar";
  #     };
  #     default_session = initial_session;
  #   };
  # };

  # Install firefox.
  programs.firefox.enable = true;

  # Enable hyprland
  programs.hyprland.enable = true;

  # make zsh default
  programs.zsh.enable = true;                                                                                                    
  users.defaultUserShell = pkgs.zsh;

  # # Enable Oh-my-zsh
  programs.zsh.ohMyZsh = {
    enable = true;
     plugins = [ "git"];
  };
  programs.zsh.promptInit = "source ${pkgs.zsh-powerlevel10k}/share/zsh-powerlevel10k/powerlevel10k.zsh-theme";
  programs.zsh.autosuggestions.enable = true;
  programs.zsh.syntaxHighlighting.enable = true;

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

  # Enable thunar as file manager
  programs.thunar.enable = true;


  # Allow unfree packages
  nixpkgs.config.allowUnfree = true;


  environment.systemPackages = with pkgs; [
   lunarvim
   kitty
   wofi
   zsh
   git
   waybar
   brightnessctl
   pamixer
   hyprpaper
   hyprlock
   wlogout
   neovim
   slurp
   grim
   wl-clipboard
   nerdfetch
  ];

  system.stateVersion = "24.05";

That looks good to me. Did you modify the hardware config in any way?

Does it work again if you update Nixpkgs and rebuild?

If not, please take a look at the journal of a failed boot using journalctl -b <boot number> and share if you can’t make sense of it.

Also since you forced shutdown, try sudo nix-store --repair --verify --check-contents to ensure there’s no store corruption (it may take a few minutes, or much longer, depending on the size of your store).

I didn’t change anything in the hardware config.

By updating Nixpkgs, do you mean nix-channel --update ? If that’s the case, it didn’t do anything.

It actually was pretty quick, but unfortunately didn’t help. Thanks for the suggestion !

Yes that’s what I meant. Note that in a typical nix-channel setup, you need to update the channels as root. (Each user has their own set of channels, root user’s channels are used for NixOS by default.)

Unfortunately that didn’t do it either, but it’s still great to know.

Please proceed as previously instructed then:

I don’t know the exact boot number, so I’ll try re-running a boot with the failed config and see if that provides useful information.

I didn’t see any notable errors other than a mount error on a USB hub. During the failed boot, the process reacher
[ OK ] reached Graphical Interface

But it then stalls indefinitely until I press the power button to shut it off (because I forgot to call A GUI in the config)

This indicates an error related to the GPU. Please take a look at the actual journal, not the systemd output during boot. You need to figure out what happened after this message was printed.

Make sure it’s actually stalled. Try switching to another virtual terminal for instance.

From what I can tell, you have a GUI configured in your config.

So I haven’t had the time to do anything related to the logs, but I did try at the time switching to another virtual terminal, which didn’t work.

I do have a GUI configured now, but I didn’t at the time (I think i forgot to specify a path, or used an invalid one).

I also tried booting through a live USB into other OSs (namely NixOS live and Debian), and the mouse problem still persists, so this might just be a harware problem. I’ll try reinstalling a clean system, including the boot partition, but it seems the root cause isn’t a faulty NixOS system.

Hi! I’m back for an update.

So, I reinstalled NixOS from scratch (which, might I add, made me appreciate the declarative config even more), making sure to create a new /boot partition. As suspected, I must have messed something up during that faulty boot, because once reinstalled everything worked again!

Thanks for your help, I learned a lot on NixOS through this experience. Will update if I experience the problem again, but I think it really was just a messed up /boot partition.