Error: The option `programs.niri' does not exist. Definition values

I don’t use nixOS. I’m using Archlinux. For example, there are no problems for Git, but there are problems for Niri and Nekoray. I didn’t find a similar issue because everyone uses nixOS. They are told that they need to override coniguration.nix, but I don’t have such a file (it’s clear why). But maybe someone can help me with this?

#home.nix
{ lib, pkgs, ... }:
{
  home = {
    packages = with pkgs; [
      jetbrains-mono # fonts
      ghostty
      librewolf
      helix
      git
      gnumake
      obsidian
      rofi
      vscodium

      nekoray
      niri

      # не разобрался как работает пока
      # zapret
      # nftables
      # obs-studio      
    ];

    username = "vch";
    homeDirectory = "/home/vch";

    stateVersion = "25.05";
  };

  # programs.xserver.enable = true;
  # services.xserver.windowManager.niri.enable = true;

#programs.nekoray = {
#  enable = true;
#  tunMode.enable = true; # Enable tunnel mode; adjust as needed
#};

  programs.git = {
    enable = true;
    userEmail = "slav.subocheff@yandex.ru";
    userName = "Vy4cheSlave";
  };

programs.niri.enable = true;
#programs.bash.enable = true;

  targets.genericLinux.enable = true; # ENABLE THIS ON NON NIXOS
  programs.home-manager.enable = true;
  manual.html.enable = true;
}
# flake.nix
{
  description = "Home Manager Configuration";

  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";

    home-manager = {
      url = "github:nix-community/home-manager";
      inputs.nixpkgs.follows = "nixpkgs";
    };
    # INFO NOT TESTED
    system-manager = {
      url = "github:numtide/system-manager";
      inputs.nixpkgs.follows = "nixpkgs";
    };
    nix-system-graphics = {
      url = "github:soupglasses/nix-system-graphics";
      inputs.nixpkgs.follows = "nixpkgs";
    };
  };

  outputs = { nixpkgs, ... }@inputs:
    let 
      username = "vch";
      lib = nixpkgs.lib;
      system = "x86_64-linux";
      pkgs = import nixpkgs { system = "x86_64-linux"; config.allowUnfree = true; };
    in {

      systemConfigs.default = inputs.system-manager.lib.makeSystemConfig {
        modules = [
          inputs.nix-system-graphics.systemModules.default
          ({
            config = {
              nixpkgs.hostPlatform = "${system}";
              system-manager.allowAnyDistro = true;
              system-graphics.enable = true;
            };
          })
        ];
      };

      devShells."${system}".default = pkgs.mkShellNoCC {
        packages = [
          inputs.system-manager.packages."${system}".default
        ];
      };

      homeConfigurations = {
        "${username}" = inputs.home-manager.lib.homeManagerConfiguration {
          inherit pkgs;
          modules = [ 
            ./home.nix 
            ({
              home.packages = [ inputs.system-manager.packages."${system}".default ];
            })
          ];
        };
      };
    };
}

Yes, per Home Manager - Option Search, there is no programs.niri defined in home-manager. You can try adding nixpkgs.niri into your home.packages to install the package; but configuration would be up to you then.

See nixpkgs/nixos/modules/programs/wayland/niri.nix at 5da4a26309e796daa7ffca72df93dbe53b8164c7 · NixOS/nixpkgs · GitHub for what programs.niri.enable is doing in NixOS. You can see it’s mostly setting up keyring/portal services and then importing general wayland session stuff as well.

1 Like

If you want to be able to set up Niri through home-manager you can try GitHub - sodiboo/niri-flake: Nix-native configuration for niri

I’m new to nix and couldn’t figure out how I should use it to make it work. Like this is a separate flake? or should it be included in the home manager? it also says that it automatically searches for NixOS, but is this suitable for my case? in general, I did not understand anything(

A perfectly acceptable way to do this is to install niri / greetd from arch, and just manage the niri config from home manager. It avoids a bunch of headaches around making sure that the graphics stack lines up. My general advice is to stick to cli tools / dotfiles /user services when working in on a “foreign” OS.

2 Likes

You can add it to your flake and import the module into home-manager, this would allow you to configure Niri through home-manager in the same way you were trying to originally.

Specifically, you could add these lines to your flake.nix

niri = {
  url = "github:sodiboo/niri-flake";
  inputs.nixpkgs.follows = "nixpkgs";
};

# You also need to make sure inputs is passed to your home-manager configuration
homeConfigurations = {
  "${username}" = inputs.home-manager.lib.homeManagerConfiguration {
    inherit pkgs;
    extraSpecialArgs = { inherit inputs; }; # Add this line
    modules = [
      ./home.nix
      ({
        home.packages = [ inputs.system-manager.packages."${system}".default ];
      })
    ];
  };
};

Add inputs to the args at the top of your home.nix: { lib, pkgs, inputs, ... }:
And then add one of these options to your home.nix

# This will let your configure Niri with home-manager, but will not install it.
# You can simply install it from the Arch repos.
imports = [ inputs.niri.homeModules.config ];
programs.niri.settings = {
    # Your settings here
    # https://github.com/sodiboo/niri-flake/blob/d704fb90b155dcd19311fc42e21b9d1739b17a09/docs.md
};

or

# This will both install and configure Niri
imports = [ inputs.niri.homeModules.config ];
programs.niri.enable = true;
programs.niri.settings = {
    # Your settings here
    # https://github.com/sodiboo/niri-flake/blob/d704fb90b155dcd19311fc42e21b9d1739b17a09/docs.md
};

The first option is probably easier for the reasons @bme mentioned above.

I will definitely try your method and come back with feedback. But maybe you know how to work with System-Manager, which logically should work like Darwin for macOS. what would allow you to use the great functionality of nixOS without serious limitations, but with declarative advantages? My goal is to make an almost completely declared system, but mutable. And also get the benefits of Archlinux, such as cache warm-up and minimal package base. And I would like to find a solution to the problems of such things that do not occur on Nixos.