Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

flk unfree

Nix refuses to evaluate packages with an unfree license by default, so adding something like vscode, slack, or terraform to a profile fails with “has an unfree license, refusing to evaluate”.

flk unfree keeps an allow-list of package names and turns it into nixpkgs.config.allowUnfreePredicate. Only the named packages are allowed; any other unfree package is still refused.

Scope

By default the list lives in the profile that needs it:

# .flk/profiles/rust.nix
{pkgs, ...}: {
  allowUnfree = ["terraform"];

  packages = [
    pkgs.terraform
  ];
}

Without -p it targets the current or default profile:

flk unfree add terraform            # -> default profile
flk unfree add terraform -p rust    # -> .flk/profiles/rust.nix

--all writes a list that applies to every profile, in .flk/config.nix:

flk unfree add vscode --all
# .flk/config.nix
{
  defaultProfile = "rust";
  maxCombinations = 3;
  allowUnfree = ["vscode"];
}

A profile shell allows the environment-wide list plus its own. A combination shell (rust-node) allows the union of its members’ lists.

Subcommands

flk unfree add

flk unfree add vscode
flk unfree add terraform --profile rust
flk unfree add slack --all

Options

  • -p, --profile <NAME>: target profile (default: current or default profile)
  • --all: the environment-wide list; can’t be combined with --profile

The list is kept sorted, and adding a name twice does nothing. It only allows the package; install it with flk add. Fails if the profile doesn’t exist.

flk unfree remove

flk unfree remove vscode
flk unfree remove slack --all

Fails if the name isn’t in the target list. It removes from that list only, so a name in both the environment-wide and a profile list has to be removed from each. The package itself stays installed; use flk remove for that.

flk unfree list

flk unfree list             # environment-wide + default profile
flk unfree list -p rust     # environment-wide + the rust profile
flk unfree list --all       # environment-wide only

Both lists are shown by default because the shell uses both.

Package names

Entries are package names as returned by lib.getName, not attribute paths or versioned store names:

Write thisNot this
vscodepkgs.vscode
google-chromegoogle-chrome-131.0.6778.85

Nix’s refusal message contains the name: in “Refusing to evaluate package ‘slack-4.49.89’” it is slack.

Global environment

flk global unfree add slack
flk global unfree add slack -p cli-tools
flk global unfree list

Applying the change

An open shell keeps the old list until you reload it:

refresh      # project
refresh -g   # global environment

Why a list instead of allowUnfree = true

allowUnfree = true allows every current and future dependency without anyone noticing. A list keeps each exception visible in the file and in review.

A hand-written allowUnfree = true; still works, but flk won’t edit it: flk unfree add asks you to switch to a list first. A true in either place wins for that profile.

Known limitation: pinned packages on the legacy layout

On the slim layout (the flk init default), the allow-list also covers version-pinned packages from .flk/pins.nix.

The legacy layout resolves pins through .flk/overlays.nix, which doesn’t get the allow-list, so unfree pinned packages still fail there. Unpinned packages work with both lists. flk migrate moves a project to the slim layout.