I’ve been trying to get my firefox configuration working in home manager (standalone) using a flake. I’ve gotten pretty far but am extremely new to this. I’ve been learning as much as possible and taking bits and pieces from folks posted configs but have hit my head on a wall trying to install the 1password addon. “home-manager switch --flake .” ends with the following error:
error: Package ‘onepassword-password-manager-2.21.0’ in /nix/store/y4l3vc51x7v7kwhqy7g4knkky5a05vh0-source/pkgs/firefox-addons/generated-firefox-addons.nix:7129 has an unfree license (‘1pwd’), refusing to evaluate.
a) To temporarily allow unfree packages, you can use an environment variable
for a single invocation of the nix tools.
$ export NIXPKGS_ALLOW_UNFREE=1
Note: When using `nix shell`, `nix build`, `nix develop`, etc with a flake,
then pass `--impure` in order to allow use of environment variables.
b) For `nixos-rebuild` you can set
{ nixpkgs.config.allowUnfree = true; }
in configuration.nix to override this.
Alternatively you can configure a predicate to allow specific packages:
{ nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
"onepassword-password-manager"
];
}
c) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add
{ allowUnfree = true; }
to ~/.config/nixpkgs/config.nix.
Here’s the hopefully relevant part of my home.nix:
{ inputs, outputs, config, pkgs, lib, ... }:
{
# https://github.com/Misterio77/nix-starter-configs/blob/972935c1b35d8b92476e26b0e63a044d191d49c3/minimal/home-manager/home.nix
nixpkgs = {
# You can add overlays here
overlays = [
# If you want to use overlays exported from other flakes:
# neovim-nightly-overlay.overlays.default
# Or define it inline, for example:
# (final: prev: {
# hi = final.hello.overrideAttrs (oldAttrs: {
# patches = [ ./change-hello-to-hi.patch ];
# });
# })
];
# Configure your nixpkgs instance
config = {
# Disable if you don't want unfree packages
allowUnfree = true;
# Workaround for https://github.com/nix-community/home-manager/issues/2942
allowUnfreePredicate = _: true;
};
};
imports = [
./user/sh.nix
./user/kitty.nix
./user/emacs.nix
./user/firefox.nix
];
...(continues with other stuff)...
And here is the hopefully relevant part of the firefox.nix module referenced in home.nix:
{ config, pkgs, inputs, ... }:
{
programs.firefox = {
enable = true;
profiles.david = {
bookmarks = { };
extensions = with inputs.firefox-addons.packages."x86_64-linux"; [
ublock-origin
sidebery
multi-account-containers
facebook-container
onepassword-password-manager
];
...(continues with other working stuff)...
Finally here is my flake.nix:
{
description = "My First Flake";
inputs = {
# nixpkgs
nixpkgs.url = "nixpkgs/nixos-23.11";
# Home Manager
home-manager.url = "github:nix-community/home-manager/release-23.11";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
# Nix User Repository
firefox-addons = {
url = "gitlab:rycee/nur-expressions?dir=pkgs/firefox-addons";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = {
self,
nixpkgs,
home-manager,
...
} @ inputs : let
inherit (self) outputs;
in {
nixosConfigurations = {
snowdrop = nixpkgs.lib.nixosSystem {
specialArgs = {inherit inputs outputs;};
modules = [ ./configuration.nix ];
};
};
homeConfigurations = {
"david@snowdrop" = home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.x86_64-linux;
extraSpecialArgs = { inherit inputs outputs;};
modules = [ ./home.nix ];
};
};
};
}
I’ve been learning using vimjoyer and librephoenix from youtube as well as patterning these files from Misterio77’s minimal set on github. Would appreciate any help at all!