Trying to install Stylix properly | NixOS, Home-Manager, Flakes

Hey guys!

When I tried to apply the Stylix module to Floorp, I hit this error:

error:
       … while calling the 'head' builtin
         at /nix/store/vsa2x9ddj2gw260mj0v2ww4iwfny17vf-source/lib/attrsets.nix:1571:13:
         1570|           if length values == 1 || pred here (elemAt values 1) (head values) then
         1571|             head values
             |             ^
         1572|           else

       … while evaluating the attribute 'value'
         at /nix/store/vsa2x9ddj2gw260mj0v2ww4iwfny17vf-source/lib/modules.nix:1083:7:
         1082|     // {
         1083|       value = addErrorContext "while evaluating the option `${showOption loc}':" value;
             |       ^
         1084|       inherit (res.defsFinal') highestPrio;

       … while evaluating the option `system.build.toplevel':

       … while evaluating definitions from `/nix/store/vsa2x9ddj2gw260mj0v2ww4iwfny17vf-source/nixos/modules/system/activation/top-level.nix':

       … while evaluating the option `assertions':

       … while evaluating definitions from `/nix/store/a4la088hi5id7sw77gy9zdvwn83dgczz-source/nixos/common.nix':

       (stack trace truncated; use '--show-trace' to show the full, detailed trace)

       error: The option `home-manager.users.justnekits.home-manager' does not exist. Definition values:
       - In `/nix/store/vsa2x9ddj2gw260mj0v2ww4iwfny17vf-source/flake.nix':
           {
             sharedModules = [
               {
                 stylix = {
                   targets = {
           ...

I have probably messed something up when setting up Stylix. From what I understood, stylix.nixosModules.stylix should handle both system-wide theming (via NixOS configuration.nix) and per-user theming (via Home Manager home.nix).

I kinda did find a solution to this problem but I’ll be honest - either I don’t understand English well enough, either I’m too brainmoshed to be able understand what that guy have said and what I should do (probably second).

Here’s my configs:

configuration.nix
   1   │ # Edit this configuration file to define what should be installed on
   2   │ # your system. Help is available in the configuration.nix(5) man page, on
   3   │ # https://search.nixos.org/options and in the NixOS manual (`nixos-help`).
   4   │ 
   5   │ { config, lib, pkgs, ... }:
   6   │ 
   7   │ {
   8   │   nixpkgs.config.allowUnfree = true;
   9   │ 
  10   │   imports =
  11   │     [ # Include the results of the hardware scan.
  12   │       ./hardware-configuration.nix
  13   │       ./modules/graphics.nix
  14   │       ./modules/gui.nix
  15   │       ./modules/syspkgs.nix
  16   │       ./modules/services.nix
  17   │       ./modules/users.nix
  18   │       ./modules/stylix.nix
  19   │     ];
  20   │     
  21   │   nix.settings.experimental-features = [ "nix-command" "flakes" ];
  22   │ 
  23   │   # Use the systemd-boot EFI boot loader.
  24   │   # boot.loader.systemd-boot.enable = true;
  25   │   boot.loader = {
  26   │     grub = {
  27   │       enable = true;
  28   │       devices = [ "nodev" ];
  29   │       efiSupport = true;
  30   │       useOSProber = true;
  31   │       efiInstallAsRemovable = false;
  32   │       gfxmodeEfi = "1920x1200";
  33   │     };
  34   │     efi = {
  35   │       canTouchEfiVariables = true;
  36   │       efiSysMountPoint = "/boot/efi";
  37   │     };
  38   │   };
  39   │ 
  40   │   networking.hostName = "JustNix"; 
  41   │   networking.networkmanager.enable = true;
  42   │ 
  43   │   # Time Zone ( later I'll need to configre it to sync with Windows 10 time)
  44   │   time.timeZone = "Europe/Moscow";
  45   │   time.hardwareClockInLocalTime = true;
  46   │   
  47   │   # Locale
  48   │   i18n = {
  49   │     defaultLocale = "ru_RU.UTF-8";
  50   │     supportedLocales = [ 
  51   │       "en_US.UTF-8/UTF-8"
  52   │       "ru_RU.UTF-8/UTF-8"
  53   │     ];
  54   │   # TTY font
  55   │   };
  56   │   console = {
  57   │     font = "${pkgs.terminus_font}/share/consolefonts/ter-p32b.psf.gz";
  58   │     packages = with pkgs; [
  59   │       terminus_font
  60   │       ];
  61   │     useXkbConfig = true;
  62   │   };
  63   │ 
  64   │   # Programs
  65   │   programs = {
  66   │     zsh.enable = true; };
  67   │ 
  68   │   xdg.portal = {
  69   │     enable = true;
  70   │     wlr.enable = true;
  71   │   };
  72   │ 
  73   │   # Copy the NixOS configuration file and link it from the resulting system
  74   │   # (/run/current-system/configuration.nix). This is useful in case you
  75   │   # accidentally delete configuration.nix.
  76   │   # system.copySystemConfiguration = true;
  77   │ 
  78   │   # This option defines the first version of NixOS you have installed on this particular machi
       │ ne,
  79   │   # and is used to maintain compatibility with application data (e.g. databases) created on ol
       │ der NixOS versions.
  80   │   #
  81   │   # Most users should NEVER change this value after the initial install, for any reason,
  82   │   # even if you've upgraded your system to a new NixOS release.
  83   │   #
  84   │   # This value does NOT affect the Nixpkgs version your packages and OS are pulled from,
  85   │   # so changing it will NOT upgrade your system - see https://nixos.org/manual/nixos/stable/#s
       │ ec-upgrading for how
  86   │   # to actually do that.
  87   │   #
  88   │   # This value being lower than the current NixOS release does NOT mean your system is
  89   │   # out of date, out of support, or vulnerable.
  90   │   #
  91   │   # Do NOT change this value unless you have manually inspected all the changes it would make 
       │ to your configuration,
  92   │   # and migrated your data accordingly.
  93   │   #
  94   │   # For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable
       │ /options#opt-system.stateVersion .
  95   │   system.stateVersion = "25.05"; # Did you read the comment?
  96   │ 
  97   │ }
  98   │ 
home.nix
   1   │ { config, pkgs, inputs, ... }:
   2   │ 
   3   │ {
   4   │   # Home and Directory
   5   │   home.username = "justnekits";
   6   │   home.homeDirectory = "/home/justnekits";
   7   │ 
   8   │   home.stateVersion = "25.05"; # Please read the comment before changing.
   9   │ 
  10   │   # Programs
  11   │   programs.home-manager.enable = true;
  12   │ 
  13   │   programs = {
  14   │ 
  15   │     # Shell & CLI
  16   │     zsh = {
  17   │       enable = true;
  18   │       enableCompletion = true;
  19   │       autosuggestion.enable = true;
  20   │       syntaxHighlighting.enable = true;
  21   │       autocd = true;
  22   │ 
  23   │       # ZSH Plugins
  24   │       plugins = [
  25   │     {
  26   │       name = "fzf-tab";
  27   │       src = "${pkgs.zsh-fzf-tab}/share/fzf-tab";
  28   │     }
  29   │     {
  30   │       name = "fzf-history-search";
  31   │       src = "${pkgs.zsh-fzf-history-search}/share/fzf-history-search";
  32   │     }
  33   │       ];
  34   │ 
  35   │       # History
  36   │       history = {
  37   │     size = 10000;
  38   │     ignoreAllDups = true;
  39   │     path = ".config/.zsh/zsh_history";
  40   │       };
  41   │ 
  42   │       # DotDir
  43   │       dotDir = ".config/.zsh";
  44   │ 
  45   │       # Aliases
  46   │       shellAliases = {
  47   │ 
  48   │     # --- NixOS ---
  49   │     nixos-config = "sudo nano /etc/nixos/configuration.nix";
  50   │     flake-config = "sudo nano /etc/nixos/flake.nix";
  51   │     home-config = "sudo nano /etc/nixos/home.nix";
  52   │     rebuild = "sudo nixos-rebuild switch --flake /etc/nixos#JustNix";
  53   │ 
  54   │     # --- System Navigation ---
  55   │     ls = "eza --icons --group-directories-first";
  56   │     la = "eza -a --icons --group-directories-first";
  57   │     ll = "eza -la --icons --group-directories-first";
  58   │     lt = "eza -T --icons";
  59   │ 
  60   │     # --- File Management ---
  61   │     cat = "bat";            # I am Vengence, I am the Night, I Am Batman!
  62   │     ff = "fastfetch";       # Hah, showoff
  63   │     df = "duf";         # Disk Usage
  64   │     du = "dust";            # Folder Size
  65   │     cd = "z";           # Zoxide - Better CD
  66   │ 
  67   │     # --- Archives ---
  68   │     extract = "atool --extract";    # Universal Extractor
  69   │ 
  70   │     };
  71   │ 
  72   │       completionInit = ''
  73   │     # --- Initialze completion ---
  74   │     autoload -Uz compinit
  75   │     compinit -u
  76   │       '';
  77   │ 
  78   │       initContent = ''
  79   │ 
  80   │     # --- fzf-tab theme Configuration ---
  81   │     zstyle ':fzf-tab:*' fzf-flags \
  82   │         --color=fg:#D8DEE9,bg:#2E3440,hl:#88C0D0 \
  83   │         --color=fg+:#ECEFF4,bg+:#434C5E,hl+:#8FBCBB \
  84   │     --color=prompt:#81A1C1,pointer:#BF616A,marker:#EBCB8B,spinner:#B48EAD \
  85   │     --height=20% --border
  86   │ 
  87   │     # --- fzf-tab ---
  88   │     setopt globdots
  89   │     zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
  90   │     zstyle ':completion:*' file-patterns '*(D)'
  91   │     zstyle ':fzf-tab:complete:cd:*' fzf-preview 'eza -a --icons --group-directories-first --co
       │ lor=always -1 $realpath'
  92   │ 
  93   │     # --- Starship theme switcher ---
  94   │     if [[ -n $DISPLAY || -n $WAYLAND_DISPLAY ]]; then
  95   │           export STARSHIP_CONFIG="${config.home.homeDirectory}/.config/.zsh/.starship/starship
       │ -gui.toml"
  96   │     else
  97   │           export STARSHIP_CONFIG="${config.home.homeDirectory}/.config/.zsh/.starship/starship
       │ -tty.toml"
  98   │     fi
  99   │     eval "$(starship init zsh)"
 100   │     '';
 101   │     };
 102   │ 
 103   │     zoxide = {
 104   │       enable = true;
 105   │       enableZshIntegration = true;
 106   │ 
 107   │     };
 108   │ 
 109   │     floorp = {
 110   │       enable = true;
 111   │       profiles = {
 112   │     JustNekits = { };
 113   │       };
 114   │     };
 115   │ 
 116   │   };
 117   │ 
 118   │   # Packages
 119   │   home.packages = with pkgs; [
 120   │     fastfetch eza zoxide bat fd ripgrep starship    # Shell & CLI
 121   │     duf mako xh cmatrix fzf cava dmidecode yazi         # Shell & CLI II: Age of Rust
 122   │     btop gping                                      # Monitoring
 123   │     udisks2 udiskie                 # Storage Tools: The Mount Awakens
 124   │     youtube-music brave                     # Desktop Apps: Into the Appverse
 125   │ 
 126   │   ];
 127   │ 
 128   │   # Home Manager is pretty good at managing dotfiles. The primary way to manage
 129   │   # plain files is through 'home.file'.
 130   │   home.file = {
 131   │     
 132   │   };
 133   │ 
 134   │   # Home Manager can also manage your environment variables through
 135   │   # 'home.sessionVariables'. These will be explicitly sourced when using a
 136   │   # shell provided by Home Manager. If you don't want to manage your shell
 137   │   # through Home Manager then you have to manually source 'hm-session-vars.sh'
 138   │   # located at either
 139   │   #
 140   │   #  ~/.nix-profile/etc/profile.d/hm-session-vars.sh
 141   │   #
 142   │   # or
 143   │   #
 144   │   #  ~/.local/state/nix/profiles/profile/etc/profile.d/hm-session-vars.sh
 145   │   #
 146   │   # or
 147   │   #
 148   │   #  /etc/profiles/per-user/justnekits/etc/profile.d/hm-session-vars.sh
 149   │   #
 150   │ 
 151   │ }
flake.nix
   1   │ {
   2   │   description = "JustNix system configuration";
   3   │ 
   4   │   inputs = {
   5   │     nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05";
   6   │     home-manager.url = "github:nix-community/home-manager/release-25.05";
   7   │     home-manager.inputs.nixpkgs.follows = "nixpkgs";
   8   │     stylix = {
   9   │       url = "github:nix-community/stylix/release-25.05";
  10   │       inputs.nixpkgs.follows = "nixpkgs";
  11   │     };
  12   │   };
  13   │ 
  14   │   outputs = { self, nixpkgs, home-manager, stylix,  ... }@inputs:
  15   │     let
  16   │       system = "x86_64-linux";
  17   │       pkgs = import nixpkgs { inherit system; config.allowUnfree = true; };
  18   │     in {
  19   │       nixosConfigurations.JustNix = nixpkgs.lib.nixosSystem {
  20   │         inherit system;
  21   │         specialArgs = { inherit inputs; };
  22   │         modules = [
  23   │           ./configuration.nix
  24   │ 
  25   │       stylix.nixosModules.stylix
  26   │ 
  27   │           # home-manager как модуль nixos
  28   │           home-manager.nixosModules.home-manager
  29   │           {
  30   │             home-manager.useGlobalPkgs = true;
  31   │             home-manager.useUserPackages = true;
  32   │         home-manager.backupFileExtension = "backup";
  33   │             home-manager.users.justnekits = import ./home.nix {
  34   │           inherit pkgs inputs;
  35   │           config = {
  36   │         home.homeDirectory = "/home/justnekits";
  37   │         home.username = "justnekits";
  38   │           };
  39   │         };
  40   │           }
  41   │         ];
  42   │       };
  43   │     };
  44   │ }
./modules/stylix.nix
   1   │ { config, pkgs, ... }:
   2   │ 
   3   │ {
   4   │   stylix = {
   5   │     enable = true;
   6   │     base16Scheme = "${pkgs.base16-schemes}/share/themes/nord.yaml";
   7   │     targets.floorp.profileNames = [ "JustNekits" ];
   8   │   };
   9   │ }

Could someone explain me what I did wrong? I’m new to Nix and NixOS and still learning them so I probably made a very stoopid configuration and I still can’t understand what I did wrong.

In case you are curious of more of my configs...
Every other configs I currently have (Advices are welcomed!)
───────┬───────────────────────────────────────────────────────────────────────────────────────────────
       │ File: /etc/nixos/modules/graphics.nix
───────┼───────────────────────────────────────────────────────────────────────────────────────────────
   1   │ { config, pkgs, lib, ... }:
   2   │ 
   3   │ {
   4   │   boot.blacklistedKernelModules = [ "nouveau" "ucsi_ccg" ]; # Blocking nouveau because I'm usi
       │ ng
   5   │                                 # NVIDIA drivers, also I need that for
   6   │                                 # good-working TTY
   7   │ 
   8   │   boot.initrd.availableKernelModules = [ "uvesafb" ];       # I need that for TTY I think
   9   │ 
  10   │   boot.kernelParams = lib.mkForce [     # I'll probably delete these once I get
  11   │     "nvidia-drm.modeset=1"          # hands on monitor-settings-inator
  12   │     "video=HDMI-A-1:2560x1440"
  13   │     "video=DP-1:d"
  14   │     "video=DP-2:d"
  15   │     ];
  16   │  
  17   │   # Graphics Drivers
  18   │   hardware.graphics = {
  19   │     enable = true;
  20   │     enable32Bit = true;
  21   │     extraPackages = with pkgs; [
  22   │       vulkan-loader vulkan-tools
  23   │       nvidia-vaapi-driver vaapiVdpau
  24   │       libvdpau egl-wayland
  25   │       ];
  26   │     };
  27   │ 
  28   │   hardware.nvidia = {
  29   │     open = true;
  30   │     modesetting.enable = true;
  31   │     nvidiaSettings = true;
  32   │   };
  33   │ 
  34   │   # Variables for work of Hyprland
  35   │   environment.variables = {
  36   │     GBM_BACKEND = "nvidia-drm";
  37   │     LIBVA_DRIVER_NAME = "nvidia";
  38   │     __GLX_VENDOR_LIBRARY_NAME = "nvidia";
  39   │     WLR_NO_HARDWARE_CURSORS = "1";
  40   │     NIXOS_OZONE_WL = "1";
  41   │   };
  42   │ 
  43   │   services.xserver.videoDrivers = [ "nvidia" ];
  44   │ 
  45   │ }
───────┴───────────────────────────────────────────────────────────────────────────────────────────────
───────┬───────────────────────────────────────────────────────────────────────────────────────────────
       │ File: /etc/nixos/modules/gui.nix
───────┼───────────────────────────────────────────────────────────────────────────────────────────────
   1   │ { config, pkgs, ... }:
   2   │ 
   3   │ {
   4   │   programs = {
   5   │ 
   6   │     # Graphics Environment
   7   │     hyprland = {
   8   │       enable = true;
   9   │       xwayland.enable = true;
  10   │       withUWSM = true;
  11   │       };
  12   │   };
  13   │ 
  14   │   environment.systemPackages = with pkgs; [
  15   │     waybar dunst rofi-wayland kitty wl-clipboard        # Graphic Tools
  16   │     grim slurp grimblast hyprlock                       # Graphic Tools II: Layers of Pixels
  17   │   ];
  18   │ }
───────┴───────────────────────────────────────────────────────────────────────────────────────────────
───────┬───────────────────────────────────────────────────────────────────────────────────────────────
       │ File: /etc/nixos/modules/services.nix
───────┼───────────────────────────────────────────────────────────────────────────────────────────────
   1   │ { config, pkgs, ... }:
   2   │ 
   3   │ {
   4   │   # Sound Drivers
   5   │   services.pipewire = {
   6   │     enable = true;
   7   │     pulse.enable = true;
   8   │     alsa.enable = true;
   9   │     alsa.support32Bit = true;
  10   │   };
  11   │ 
  12   │   # Enable the OpenSSH daemon.
  13   │   services.openssh = {
  14   │     enable = true;
  15   │     settings = {
  16   │       PermitRootLogin = "no";
  17   │       PasswordAuthentication = true;
  18   │     };
  19   │   };
  20   │ }
───────┴───────────────────────────────────────────────────────────────────────────────────────────────
───────┬───────────────────────────────────────────────────────────────────────────────────────────────
       │ File: /etc/nixos/modules/syspkgs.nix
───────┼───────────────────────────────────────────────────────────────────────────────────────────────
   1   │ { config, pkgs, ... }:
   2   │ 
   3   │ {
   4   │   # List packages installed in system profile.
   5   │   environment.systemPackages = with pkgs; [
   6   │     vim nano                                      # Text Editors
   7   │     wget git                                      # Download Tools
   8   │     unzip p7zip unrar                             # Archives
   9   │     usbutils pciutils                             # Diagnostics
  10   │     man-pages man-pages-posix tldr                # Better Man
  11   │     nftables                                      # Networking
  12   │     ntfs3g                                        # Formating
  13   │   ];
  14   │ }
───────┴───────────────────────────────────────────────────────────────────────────────────────────────
───────┬───────────────────────────────────────────────────────────────────────────────────────────────
       │ File: /etc/nixos/modules/users.nix
───────┼───────────────────────────────────────────────────────────────────────────────────────────────
   1   │ { config, pkgs, ... }:
   2   │ 
   3   │ {
   4   │   users.users.justnekits = {
   5   │     isNormalUser = true;
   6   │     shell = pkgs.zsh;
   7   │     extraGroups = [ "wheel" ];
   8   │     packages = with pkgs; [ tree ];
   9   │   };
  10   │ }
───────┴───────────────────────────────────────────────────────────────────────────────────────────────
───────┬───────────────────────────────────────────────────────────────────────────────────────────────
       │ File: /etc/nixos/hardware-configuration.nix
───────┼───────────────────────────────────────────────────────────────────────────────────────────────
   1   │ # Do not modify this file!  It was generated by ‘nixos-generate-config’
   2   │ # and may be overwritten by future invocations.  Please make changes
   3   │ # to /etc/nixos/configuration.nix instead.
   4   │ { config, lib, pkgs, modulesPath, ... }:
   5   │ 
   6   │ {
   7   │   imports =
   8   │     [ (modulesPath + "/installer/scan/not-detected.nix")
   9   │     ];
  10   │ 
  11   │   boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ];
  12   │   boot.initrd.kernelModules = [ ];
  13   │   boot.kernelModules = [ "kvm-amd" ];
  14   │   boot.extraModulePackages = [ ];
  15   │ 
  16   │   fileSystems."/" =
  17   │     { device = "/dev/disk/by-uuid/e3f7e19a-ebae-4c9f-9342-5004276cc4fd";
  18   │       fsType = "ext4";
  19   │     };
  20   │ 
  21   │   fileSystems."/boot" =
  22   │     { device = "/dev/disk/by-uuid/439bffee-f691-43ec-ba1b-dd2eef4589c1";
  23   │       fsType = "ext4";
  24   │     };
  25   │ 
  26   │   fileSystems."/boot/efi" =
  27   │     { device = "/dev/disk/by-uuid/1C26-DF97";
  28   │       fsType = "vfat";
  29   │       options = [ "fmask=0022" "dmask=0022" ];
  30   │     };
  31   │ 
  32   │   fileSystems."/home" =
  33   │     { device = "/dev/disk/by-uuid/07da0642-eb32-49a4-aca2-788e21814de7";
  34   │       fsType = "ext4";
  35   │     };
  36   │ 
  37   │   fileSystems."/srv/win-backup" = {
  38   │     device = "/dev/disk/by-uuid/2B72157F5B8DD046";
  39   │     fsType = "ntfs-3g";
  40   │     options = [ "rw" "uid=1000" "gid=100" "umask=0002" ];
  41   │     };
  42   │ 
  43   │   fileSystems."/srv/nix-backup" = {
  44   │     device = "/dev/disk/by-uuid/3c438c09-dfad-46b1-b7f8-ea870a4e1082";
  45   │     fsType = "ext4";
  46   │     options = [ "rw" ];
  47   │     };
  48   │ 
  49   │   swapDevices =
  50   │     [ { device = "/dev/disk/by-uuid/a5c7e1e2-d9cc-45b3-8af5-5f335210c487"; }
  51   │     ];
  52   │ 
  53   │   # Enables DHCP on each ethernet and wireless interface. In case of scripted networking
  54   │   # (the default) this is the recommended approach. When using systemd-networkd it's
  55   │   # still possible to use this option, but it's recommended to use it in conjunction
  56   │   # with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
  57   │   networking.useDHCP = lib.mkDefault true;
  58   │   # networking.interfaces.enp4s0.useDHCP = lib.mkDefault true;
  59   │ 
  60   │   nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
  61   │   hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmwa
       │ re;
  62   │ }
───────┴───────────────────────────────────────────────────────────────────────────────────────────────

Delete this line. You’re using an inline module to define your home-manager config, and inherit inputs tries to use your inputs attrset as an option. It’s as if you’d written in home.nix:

{ config, pkgs, inputs, ... }:

{
  inputs = {
    home-manager = { ... };
    # A bunch of other inputs
  };

  # The rest of your config
}

Obviously home-manager has no such option, so you get that error message.