Home Manager does not allowUnfree

I have a few apps that are unfree. I can install them at the system level (environment.systemPackages =) but not in home manager (home.packages =). The error being refusing to evaluate.

I have tried to find the answer on the HM github, official doc, wiki and this forum without a working answer.

My current attempt is:

nixpkgs.config = {
allowUnfree = true;
allowUnfreePredicate = (_: true); # And some forgotten variations on this!
The allowUnfreePredicate being suggestions I have read as a solution (I think gleaned from others configs).

I have not tried the error message option:

     { nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [

because it seems very clunky doing each app (and also this seems a system approach, not HM). Also it seems equivalent to my current code.

For more background, HM is installed as a module. I then went from a standard config to a flake. I haven’t configured HM much at all. Primarily at the moment I use it to install user-specific (as opposed to system-wide) apps.

Can anyone point me to documentation or the answer?

Can you share more of your configuration? Are you using home-manager.useGlobalPkgs?

The allowUnfreePredicate fix is only relevant for standalone flake installs. When hm is used as a module it shouldn’t be necessary.

Sure. Thanks for taking the time to look
Firstly flake.nix

inputs = {
nixpkgs.url = “nixpkgs/nixos-22.11”;

home-manager = {
  url = "github:nix-community/home-manager";
  inputs.nixpkgs.follows = "nixpkgs";


outputs = { self, nixpkgs, home-manager }@inputs: {
pkgs = import nixpkgs { config = { allowUnfree = true; }; };

# replace nixosConfigurations.Damage with nixosConfigurations.hostname

nixosConfigurations.Damage = nixpkgs.lib.nixosSystem {
  system = "x86_64-linux";
  specialArgs = {inherit inputs;};
  modules = [



{ inputs, lib, config, pkgs, … }:

imports =
[ # Include the results of the hardware scan and other config files.



environment.defaultPackages = [ pkgs.nano ]; #Clean slate on installed packages

nix = {
settings = {
auto-optimise-store = true;
experimental-features = [ “nix-command” “flakes” ];
gc = {
automatic = true;
dates = “weekly”;
options = “–delete-older-than 45d”;

system.autoUpgrade = {
enable = true;
channel = nixos-22.11 release nixos-22.11.2680.a3d745e701c

nixpkgs.config = {
allowUnfree = true;
allowUnfreePredicate = (_: true);

virtualisation = {
waydroid.enable = true;
lxd.enable = true;

Set your time zone.

time.timeZone = “America/New_York”;

the version of this flake used to build the system

nix.registry.activeconfig.flake = self;

environment.etc.“nix/path/activeconfig”.source = self;

Copy the NixOS configuration file and link it from the resulting system

(/run/current-system/configuration.nix). This is useful in case you

accidentally delete configuration.nix.

system.copySystemConfiguration = true;

system.stateVersion = “22.11”; # Did you read the comment?

And users.nix - where user-specific HM config lies

{ config, pkgs, … }:

users.users.john = {
isNormalUser = true;
description = “Dr John”;
home = “/home/john”;
extraGroups = [ “wheel” “networkmanager” “video” ]; # Enable ‘sudo’ and Networking.

home-manager.users.john = { pkgs, … }: {
programs = {
fish.enable = true;

home = {
  stateVersion = "22.11";
  homeDirectory = "/home/john";

  packages = with pkgs; [
    ace-of-penguins ' And lots of other apps


All other config files don’t address HM aspects (I believe)

And apologies for the formatting weirdness - didn’t see that before posting!

Ok, one unrelated note: You need to match your home-manager branch to your nixpkgs branch. If you use nixpkgs’ nixos-unstable, you can use home-manager’s master, but if you use nixpkgs’ nixos-22.11 you need to use home-manager’s release-22.11. You can add the branch as a third component in github urls, like github:nix-community/home-manager/release-22.11. This isn’t the cause of your problem, however.

No worries about the formatting, but for future reference, it’s probably a better idea to blockquote each file in full.

I don’t see you setting the home-manager.useGlobalPkgs option, so home-manager is instantiating its own version of nixpkgs, with its own configuration. You can configure it with identical options to the ones nixos uses, but placed inside the user’s home-manager config area, or you can set useGlobalPkgs in your nixos configuration, which will cause home-manager to use the pkgs from your nixos setup, along with the unfree settings and overlays and such that go with it.


Also, this line in your flake.nix definitely shouldn’t be there… it surely isn’t doing what you think it’s doing.

Thanks @tejing !
I have migrated from noob to numpty…I had useGlobalPkgs originally, and somehow managed to drop it when converting to flakes. I have been trying to solve the wrong issue all this time :blush:

I have fixed the HM branch (I’m sticking to 22.11 rather than unstable to minimise variables while I learn more about Nixos) and removed pkgs = import nixpkgs { config = { allowUnfree = true; }; };