nixos-config/modules/unfree.nix

34 lines
951 B
Nix
Raw Normal View History

{ config, lib, ... }:
let
cfg = config.sbruder.unfree;
in
{
# Options that affect multiple modules
options.sbruder = {
unfree = {
allowAssets = lib.mkOption {
default = true;
type = lib.types.bool;
description = "Allow restricted selection of unfree assets to be installed.";
};
allowSoftware = lib.mkOption {
default = false;
type = lib.types.bool;
description = "Allow restricted selection of unfree software to be installed.";
};
};
};
config = {
nixpkgs.config.allowUnfreePredicate = (pkg: builtins.elem (lib.getName pkg) (
lib.optionals cfg.allowAssets [
"corefonts"
"vista-fonts"
"wallpaper-unfree" # defined in users/simon/modules/sway.nix
] ++ lib.optionals cfg.allowSoftware [
"p7zip" # exception: rar source code is not free, but available; p7zip with `enableUnfree` includes it
]
));
};
}