about summary refs log tree commit diff
path: root/home/modules/programs/nixpkgs/default.nix
blob: 3220844b1c6093eed4770a6340bc49f946e7a7ed (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.str;
    default = [ ];
    description = ''
      Allows for unfree packages by their name.
    '';
  };

  options.nixpkgs.allowedInsecure = lib.mkOption {
    type = lib.types.listOf lib.types.str;
    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);
}