Nixos Flakes with Home-Manager

Hi,
I’m new with flakes and I’m trying to apply mdarocha/nix-qutebrowser-with-treetabs flake on qutebrowser managed by home-manager. My setup is:

{
  inputs = {
    home-manager = {
      url = "github:nix-community/home-manager/release-21.11";
      inputs.nixpkgs.follows = "nixpkgs";
    };
    nixpkgs.url = "nixpkgs/nixos-21.11";
    nixpkgs-unstable.url = "nixpkgs/nixos-unstable";
    sops-nix.url = "github:Mic92/sops-nix";
    treetabs = {
      url = "github:mdarocha/nix-qutebrowser-with-treetabs";
      inputs.nixpkgs.follows = "nixpkgs";
    };
  };

  outputs = inputs@{self, nixpkgs, nixpkgs-unstable, home-manager, sops-nix, ...}:
  let
    lib = nixpkgs.lib;
    system = "x86_64-linux";
    overlay-unstable = final: prev: {
      unstable = nixpkgs-unstable.legacyPackages.${prev.system};
      # use this variant if unfree packages are needed:
      # unstable = import nixpkgs-unstable {
      #   inherit system;
      #   config.allowUnfree = true;
      # };

    };
    overlays = [
      inputs.treetabs.overlay
      overlay-unstable
    ];
  in {
    nixosConfigurations.alexlaptop = lib.nixosSystem {
      inherit system;
      specialArgs = { inherit inputs; };

      modules = [
        ./configuration.nix
        { nixpkgs.overlays = overlays ; }
        home-manager.nixosModules.home-manager {
          home-manager.extraSpecialArgs = { inherit inputs; };
        }
        sops-nix.nixosModules.sops
      ];
    };
  };
}

The configruation.nix contains all of host manager settings:

{ config, pkgs, home-manager, sops,  ... }:
{
 ...
  home-manager.users.abraverm = { pkgs, config, ... }: {
  program.qutebrowser.enable = true;
  ...
};

The problem is that it doesn’t seem like the flake is being applied eventhough the sudo nixos-rebuild switch pass without any errors. I can find the flake content in nix store, but I can’t find the patched version of qutebrowser.

I tried all sort of things, including: Accessing flakes from inside home-manager modules · Issue #1698 · nix-community/home-manager · GitHub

What am I missing?

Thanks,
Alex

program.qutebrowser.enable = true; make Home Manager install the qutebrowser package from nixpkgs however you want to install the qutebrowser-with-treetabs from nixpkgs. Most of Home Manager modules have a package option to let you choose the installed package by programs.<program>.enable. Thus, you can install the patched package with:

{ config, pkgs, ... }:

{
  # ...
  programs.qutebrowser = {
    enable = true;
    package = pkgs.qutebrowser-with-treetabs;
  };
  # ...
}

@loicreynier Thank you very much, it partially worked. The overlay is now being applied but fails due to mismatch of qutebrowser version and the patch. In the repository README it uses the unstable nixpkgs nixpkgs.url = "nixpkgs/nixos-unstable";, however I would like to maintain my current setup:

    nixpkgs.url = "nixpkgs/nixos-21.11";
    nixpkgs-unstable.url = "nixpkgs/nixos-unstable";

Is it possible to apply the overlay on the nixpkgs-unstable instead and then install it like this:
package = pkgs.unstable.qutebrowser-with-treetabs;?

It must be possible but it is for the moment outside my field of competence.

The answer to my question is:

    overlay-unstable = final: prev: {
      unstable = import nixpkgs-unstable {
        inherit system;
        overlays = [ inputs.treetabs.overlay ];
      };

    };
1 Like