nix-git/modules/unfree.nix

23 lines
682 B
Nix
Raw Normal View History

2024-08-13 14:46:55 +02:00
{ config, lib, ... }:
# See also: ./nur-and-unstable.nix to allow unfree packages from "unstable".
# See also: ./base.nix for unfree firmware.
# This file adds the ability to whitelist unfree packages in different .nix config files.
# Example: Instead of
# nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
# "obsidian"
# ];
# add the following
# allowUnfree = [ "obsidian" ];
let
inherit (builtins) elem;
inherit (lib) getName mkOption;
inherit (lib.types) listOf str;
in
{
options.allowUnfree = mkOption { type = listOf str; default = [ ]; };
config.nixpkgs.config.allowUnfreePredicate = p: elem (getName p) config.allowUnfree;
}