Add options for unfree software and assets
This commit is contained in:
parent
5d616f4b64
commit
131d0cc1a5
|
@ -15,6 +15,7 @@
|
|||
media-proxy.enable = true;
|
||||
restic.enable = true;
|
||||
ssd.enable = true;
|
||||
unfree.allowSoftware = true;
|
||||
wireguard.home = {
|
||||
enable = true;
|
||||
address = "10.80.0.4";
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
];
|
||||
};
|
||||
ssd.enable = true;
|
||||
unfree.allowSoftware = true;
|
||||
wireguard.home = {
|
||||
enable = true;
|
||||
address = "10.80.0.5";
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
./ssh.nix
|
||||
./tools.nix
|
||||
./udev.nix
|
||||
./unfree.nix
|
||||
./wireguard
|
||||
];
|
||||
|
||||
|
@ -97,15 +98,6 @@
|
|||
systemd.services.nix-daemon.serviceConfig.CPUSchedulingPolicy = "batch";
|
||||
|
||||
nixpkgs.config = {
|
||||
# Explicitly allow unfree packages (rule of thumb: assets ok, code not ok)
|
||||
allowUnfreePredicate = (
|
||||
pkg: builtins.elem (lib.getName pkg) [
|
||||
"corefonts"
|
||||
"vista-fonts"
|
||||
"wallpaper-unfree" # defined in users/simon/modules/sway.nix
|
||||
"p7zip" # exception: rar source code is not free, but available; p7zip with `enableUnfree` includes it
|
||||
]
|
||||
);
|
||||
# Add unstable channel
|
||||
packageOverrides = pkgs: {
|
||||
unstable = import (import ../nix/sources.nix).nixpkgs-unstable {
|
||||
|
|
33
modules/unfree.nix
Normal file
33
modules/unfree.nix
Normal file
|
@ -0,0 +1,33 @@
|
|||
{ 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
|
||||
]
|
||||
));
|
||||
};
|
||||
}
|
|
@ -24,12 +24,25 @@
|
|||
home-manager.useGlobalPkgs = true;
|
||||
|
||||
home-manager.users.simon = { lib, pkgs, ... }: {
|
||||
# FIXME: those options are duplicates from the system configuration
|
||||
options.sbruder = {
|
||||
gui.enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = config.sbruder.gui.enable;
|
||||
description = "Whether to enable gui";
|
||||
};
|
||||
unfree = {
|
||||
allowAssets = lib.mkOption {
|
||||
default = config.sbruder.unfree.allowAssets;
|
||||
type = lib.types.bool;
|
||||
description = "Allow restricted selection of unfree assets to be installed.";
|
||||
};
|
||||
allowSoftware = lib.mkOption {
|
||||
default = config.sbruder.unfree.allowSoftware;
|
||||
type = lib.types.bool;
|
||||
description = "Allow restricted selection of unfree software to be installed.";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
imports = [ ./modules ];
|
||||
|
|
Loading…
Reference in a new issue