about summary refs log tree commit diff
path: root/home/modules/programs/nixpkgs/default.nix
blob: e20923fa4b8c7e627215ad8b3aabc6f48d689e9c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
{ config, lib, ... }:

let
  allowedUnf = config.nixpkgs.allowedUnfree;
  allowedIns = config.nixpkgs.allowedInsecure;
in

{
  options.nixpkgs.allowedUnfree = lib.mkOption {
    type = lib.types.listOf lib.types.string;
    default = [ ];
    description = ''
      Allows for unfree packages by their name.
    '';
  };

  options.nixpkgs.allowedInsecure = lib.mkOption {
    type = lib.types.listOf lib.types.string;
    default = [ ];
    description = ''
      Allows for insercure packages by their name.
    '';
  };


  config.nixpkgs.config.allowUnfreePredicate =
    if (allowedUnf == [ ])
    then (_: false)
    else (pkg: __elem (lib.getName pkg) allowedUnf);

  config.nixpkgs.config.allowInsecurePredicate =
    if (allowedIns == [ ])
    then (_: false)
    else (pkg: __elem (lib.getName pkg) allowedIns);
}