Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

treewide/nixos: remove with lib; part 3 #335623

Merged
merged 130 commits into from
Nov 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
130 commits
Select commit Hold shift + click to select a range
17c0115
nixos/i18n.inputMethod.hime: remove `with lib;`
Stunkymonkey Aug 29, 2024
3eb92bc
nixos/i18n.inputMethod.ibus: remove `with lib;`
Stunkymonkey Aug 29, 2024
d5a377e
nixos/i18n.inputMethod.nabi: remove `with lib;`
Stunkymonkey Aug 29, 2024
387be4f
nixos/i18n.inputMethod.uim: remove `with lib;`
Stunkymonkey Aug 29, 2024
650b769
nixos/assertions: remove `with lib;`
Stunkymonkey Aug 29, 2024
4feff6c
nixos/crashdump: remove `with lib;`
Stunkymonkey Aug 29, 2024
0334b1b
nixos/label: remove `with lib;`
Stunkymonkey Aug 29, 2024
9a8512f
nixos/meta: remove `with lib;`
Stunkymonkey Aug 29, 2024
b1a2522
nixos/fcast-receiver: remove `with lib;`
Stunkymonkey Aug 29, 2024
236ed78
nixos/security.apparmor: remove `with lib;`
Stunkymonkey Aug 29, 2024
a62e663
nixos/security.audit: remove `with lib;`
Stunkymonkey Aug 29, 2024
3c80b14
nixos/security.please: remove `with lib;`
Stunkymonkey Aug 29, 2024
503fd30
nixos/services.oxidized: remove `with lib;`
Stunkymonkey Aug 29, 2024
5a670b3
nixos/services.salt.minion: remove `with lib;`
Stunkymonkey Aug 29, 2024
82146f6
nixos/services.activemq: remove `with lib;`
Stunkymonkey Aug 29, 2024
c62a55f
nixos/services.botamusique: remove `with lib;`
Stunkymonkey Aug 29, 2024
cab8ab3
nixos/services.gmediarender: remove `with lib;`
Stunkymonkey Aug 29, 2024
496d117
nixos/services.gonic: remove `with lib;`
Stunkymonkey Aug 29, 2024
dfd031a
nixos/services.goxlr-utility: remove `with lib;`
Stunkymonkey Aug 29, 2024
1d19c39
nixos/services.hqplayerd: remove `with lib;`
Stunkymonkey Aug 29, 2024
e8fa5a9
nixos/services.icecast: remove `with lib;`
Stunkymonkey Aug 29, 2024
291d92e
nixos/services.jack: remove `with lib;`
Stunkymonkey Aug 29, 2024
f645147
nixos/services.jmusicbot: remove `with lib;`
Stunkymonkey Aug 29, 2024
de5c62d
nixos/services.liquidsoap: remove `with lib;`
Stunkymonkey Aug 29, 2024
b477479
nixos/services.mpdscribble: remove `with lib;`
Stunkymonkey Aug 29, 2024
bde5fcc
nixos/services.networkaudiod: remove `with lib;`
Stunkymonkey Aug 29, 2024
794d395
nixos/services.roon-bridge: remove `with lib;`
Stunkymonkey Aug 29, 2024
ecb168c
nixos/services.roon-server: remove `with lib;`
Stunkymonkey Aug 29, 2024
f6a10df
nixos/services.slimserver: remove `with lib;`
Stunkymonkey Aug 29, 2024
9d80afc
nixos/services.spotifyd: remove `with lib;`
Stunkymonkey Aug 29, 2024
f600d6a
nixos/services.ympd: remove `with lib;`
Stunkymonkey Aug 29, 2024
ef50268
nixos/services.borgmatic: remove `with lib;`
Stunkymonkey Aug 29, 2024
699a0f8
nixos/services.duplicati: remove `with lib;`
Stunkymonkey Aug 29, 2024
0121820
nixos/services.duplicity: remove `with lib;`
Stunkymonkey Aug 29, 2024
9540ed8
nixos/services.paperless: remove `with lib;`
Stunkymonkey Aug 29, 2024
59061eb
nixos/services.parsoid: remove `with lib;`
Stunkymonkey Aug 29, 2024
bb74224
nixos/services.pinnwand: remove `with lib;`
Stunkymonkey Aug 29, 2024
8553d97
nixos/services.plex: remove `with lib;`
Stunkymonkey Aug 29, 2024
66fecab
nixos/services.plikd: remove `with lib;`
Stunkymonkey Aug 29, 2024
257f608
nixos/services.polaris: remove `with lib;`
Stunkymonkey Aug 29, 2024
6a73a0a
nixos/services.preload: remove `with lib;`
Stunkymonkey Aug 29, 2024
247134a
nixos/services.prowlarr: remove `with lib;`
Stunkymonkey Aug 29, 2024
f5c2c7b
nixos/services.pykms: remove `with lib;`
Stunkymonkey Aug 29, 2024
39d9937
nixos/services.radarr: remove `with lib;`
Stunkymonkey Aug 29, 2024
ba6e7e1
nixos/services.readarr: remove `with lib;`
Stunkymonkey Aug 29, 2024
0280cad
nixos/services.rippleDataApi: remove `with lib;`
Stunkymonkey Aug 29, 2024
724f15d
nixos/services.rkvm: remove `with lib;`
Stunkymonkey Aug 29, 2024
e3f2e1c
nixos/services.rmfakecloud: remove `with lib;`
Stunkymonkey Aug 29, 2024
1d3ea1d
nixos/services.safeeyes: remove `with lib;`
Stunkymonkey Aug 29, 2024
1bf69e6
nixos/services.sdrplayApi: remove `with lib;`
Stunkymonkey Aug 29, 2024
1b4c241
nixos/services.serviio: remove `with lib;`
Stunkymonkey Aug 29, 2024
e593a4c
nixos/services.sickbeard: remove `with lib;`
Stunkymonkey Aug 29, 2024
2a8d189
nixos/services.signald: remove `with lib;`
Stunkymonkey Aug 29, 2024
288a627
nixos/services.siproxd: remove `with lib;`
Stunkymonkey Aug 29, 2024
b84a9d0
nixos/services.soft-serve: remove `with lib;`
Stunkymonkey Aug 29, 2024
7abfa88
nixos/services.sonarr: remove `with lib;`
Stunkymonkey Aug 29, 2024
e4c0bdd
nixos/services.spice-vdagentd: remove `with lib;`
Stunkymonkey Aug 29, 2024
4a435c1
nixos/services.spice-webdavd: remove `with lib;`
Stunkymonkey Aug 29, 2024
269e240
nixos/services.sssd: remove `with lib;`
Stunkymonkey Aug 29, 2024
5adb350
nixos/services.subsonic: remove `with lib;`
Stunkymonkey Aug 29, 2024
07819ff
nixos/services.sundtek: remove `with lib;`
Stunkymonkey Aug 29, 2024
165ad25
nixos/services.svnserve: remove `with lib;`
Stunkymonkey Aug 29, 2024
334d6eb
nixos/services.synergy: remove `with lib;`
Stunkymonkey Aug 29, 2024
cc25de0
nixos/services.tandoor-recipes: remove `with lib;`
Stunkymonkey Aug 29, 2024
2ecc659
nixos/services.tautulli: remove `with lib;`
Stunkymonkey Aug 29, 2024
d279b64
nixos/services.tiddlywiki: remove `with lib;`
Stunkymonkey Aug 29, 2024
11904bb
nixos/services.tp-auto-kbbl: remove `with lib;`
Stunkymonkey Aug 29, 2024
f89578e
nixos/programs.tuxclocker: remove `with lib;`
Stunkymonkey Aug 29, 2024
b04e012
nixos/services.tzupdate: remove `with lib;`
Stunkymonkey Aug 29, 2024
43e7094
nixos/services.uhub: remove `with lib;`
Stunkymonkey Aug 29, 2024
fe175fe
nixos/services.weechat: remove `with lib;`
Stunkymonkey Aug 29, 2024
f8b0d3a
nixos/services.xmrig: remove `with lib;`
Stunkymonkey Aug 29, 2024
59a4e83
nixos/services.zookeeper: remove `with lib;`
Stunkymonkey Aug 29, 2024
44990e9
nixos/services.alerta: remove `with lib;`
Stunkymonkey Aug 29, 2024
03ba605
nixos/services.alloy: remove `with lib;`
Stunkymonkey Aug 29, 2024
3fa1cc4
nixos/services.apcupsd: remove `with lib;`
Stunkymonkey Aug 29, 2024
7123ef8
nixos/services.arbtt: remove `with lib;`
Stunkymonkey Aug 29, 2024
66ea353
nixos/services.below: remove `with lib;`
Stunkymonkey Aug 29, 2024
278fc75
nixos/services.bosun: remove `with lib;`
Stunkymonkey Aug 29, 2024
5ced735
nixos/services.cadvisor: remove `with lib;`
Stunkymonkey Aug 29, 2024
c39797b
nixos/services.collectd: remove `with lib;`
Stunkymonkey Aug 29, 2024
357422f
nixos/services.das_watchdog: remove `with lib;`
Stunkymonkey Aug 29, 2024
4bfa9c3
nixos/services.datadog-agent: remove `with lib;`
Stunkymonkey Aug 29, 2024
699ee51
nixos/services.do-agent: remove `with lib;`
Stunkymonkey Aug 29, 2024
69dd091
nixos/services.fusionInventory: remove `with lib;`
Stunkymonkey Aug 29, 2024
e86917a
nixos/services.grafana-agent: remove `with lib;`
Stunkymonkey Aug 29, 2024
f1019c7
nixos/services.grafana-image-renderer: remove `with lib;`
Stunkymonkey Aug 29, 2024
8f93364
nixos/services.grafana_reporter: remove `with lib;`
Stunkymonkey Aug 29, 2024
95e5f25
nixos/services.hdapsd: remove `with lib;`
Stunkymonkey Aug 29, 2024
baece5f
nixos/services.heapster: remove `with lib;`
Stunkymonkey Aug 29, 2024
5b48323
nixos/services.incron: remove `with lib;`
Stunkymonkey Aug 29, 2024
588c1c9
nixos/services.kapacitor: remove `with lib;`
Stunkymonkey Aug 29, 2024
1e44f5e
nixos/services.karma: remove `with lib;`
Stunkymonkey Aug 29, 2024
9353cb1
nixos/services.kthxbye: remove `with lib;`
Stunkymonkey Aug 29, 2024
56bd2c2
nixos/services.longview: remove `with lib;`
Stunkymonkey Aug 29, 2024
5419e37
nixos/services.mackerel-agent: remove `with lib;`
Stunkymonkey Aug 29, 2024
faf7fde
nixos/services.monit: remove `with lib;`
Stunkymonkey Aug 29, 2024
34970fd
nixos/services.munin-[cron,node]: remove `with lib;`
Stunkymonkey Aug 29, 2024
c93d8f8
nixos/services.nagios: remove `with lib;`
Stunkymonkey Aug 29, 2024
f88528a
nixos/services.netdata: remove `with lib;`
Stunkymonkey Aug 29, 2024
500c84c
nixos/services.osquery: remove `with lib;`
Stunkymonkey Aug 29, 2024
c617a4c
nixos/services.prometheus.alertmanagerIrcRelay: remove `with lib;`
Stunkymonkey Aug 29, 2024
951787f
nixos/services.prometheus.alertmanagerWebhookLogger: remove `with lib;`
Stunkymonkey Aug 29, 2024
ea4bd53
nixos/services.prometheus.alertmanager: remove `with lib;`
Stunkymonkey Aug 29, 2024
3b6ddc5
nixos/services.prometheus.pushgateway: remove `with lib;`
Stunkymonkey Aug 29, 2024
f9825ae
nixos/services.prometheus.sachet: remove `with lib;`
Stunkymonkey Aug 29, 2024
4f47314
nixos/services.prometheus.xmpp-alerts: remove `with lib;`
Stunkymonkey Aug 29, 2024
9f025e3
nixos/services.riemann-dash: remove `with lib;`
Stunkymonkey Aug 29, 2024
36b176c
nixos/services.riemann-tools: remove `with lib;`
Stunkymonkey Aug 29, 2024
a7f9173
nixos/services.riemann: remove `with lib;`
Stunkymonkey Aug 29, 2024
b3796ed
nixos/services.scollector: remove `with lib;`
Stunkymonkey Aug 29, 2024
084011a
nixos/services.smartd: remove `with lib;`
Stunkymonkey Aug 29, 2024
8b8b523
nixos/services.statsd: remove `with lib;`
Stunkymonkey Aug 29, 2024
8eb355e
nixos/services.sysstat: remove `with lib;`
Stunkymonkey Aug 29, 2024
851d233
nixos/services.telegraf: remove `with lib;`
Stunkymonkey Aug 29, 2024
307f280
nixos/services.tremor-rs: remove `with lib;`
Stunkymonkey Aug 29, 2024
6974870
nixos/services.tuptime: remove `with lib;`
Stunkymonkey Aug 29, 2024
cc88c36
nixos/services.uptime-kuma: remove `with lib;`
Stunkymonkey Aug 29, 2024
e8e5c6c
nixos/services.vnstat: remove `with lib;`
Stunkymonkey Aug 29, 2024
5f44bea
nixos/services.watchdogd: remove `with lib;`
Stunkymonkey Aug 29, 2024
a9748cc
nixos/services.cachefilesd: remove `with lib;`
Stunkymonkey Aug 29, 2024
4498566
nixos/services.diod: remove `with lib;`
Stunkymonkey Aug 29, 2024
4dbf3a7
nixos/services.drbd: remove `with lib;`
Stunkymonkey Aug 29, 2024
e4ffb75
nixos/services.glusterfs: remove `with lib;`
Stunkymonkey Aug 29, 2024
e14d1dc
nixos/services.ncdns: remove `with lib;`
Stunkymonkey Aug 29, 2024
83cc2cd
nixos/services.nebula: remove `with lib;`
Stunkymonkey Aug 29, 2024
2bf4393
nixos/networking.nftables: remove `with lib;`
Stunkymonkey Aug 29, 2024
2d4a4c1
nixos/services.nylon: remove `with lib;`
Stunkymonkey Aug 29, 2024
93d6b81
nixos/services.oink: remove `with lib;`
Stunkymonkey Aug 29, 2024
07894f4
nixos/services.stunnel: remove `with lib;`
Stunkymonkey Aug 29, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions nixos/modules/i18n/input-method/hime.nix
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
{ config, pkgs, lib, ... }:

with lib;

let
imcfg = config.i18n.inputMethod;
in
{
config = mkIf (imcfg.enable && imcfg.type == "hime") {
config = lib.mkIf (imcfg.enable && imcfg.type == "hime") {
i18n.inputMethod.package = pkgs.hime;
environment.variables = {
GTK_IM_MODULE = "hime";
Expand Down
31 changes: 14 additions & 17 deletions nixos/modules/i18n/input-method/ibus.nix
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
{ config, pkgs, lib, ... }:

with lib;

let
imcfg = config.i18n.inputMethod;
cfg = imcfg.ibus;
ibusPackage = pkgs.ibus-with-plugins.override { plugins = cfg.engines; };
ibusEngine = lib.types.mkOptionType {
name = "ibus-engine";
inherit (lib.types.package) descriptionClass merge;
check = x: (lib.types.package.check x) && (attrByPath ["meta" "isIbusEngine"] false x);
check = x: (lib.types.package.check x) && (lib.attrByPath ["meta" "isIbusEngine"] false x);
};

impanel = optionalString (cfg.panel != null) "--panel=${cfg.panel}";
impanel = lib.optionalString (cfg.panel != null) "--panel=${cfg.panel}";

ibusAutostart = pkgs.writeTextFile {
name = "autostart-ibus-daemon";
Expand All @@ -29,32 +26,32 @@ let
in
{
imports = [
(mkRenamedOptionModule [ "programs" "ibus" "plugins" ] [ "i18n" "inputMethod" "ibus" "engines" ])
(lib.mkRenamedOptionModule [ "programs" "ibus" "plugins" ] [ "i18n" "inputMethod" "ibus" "engines" ])
];

options = {
i18n.inputMethod.ibus = {
engines = mkOption {
type = with types; listOf ibusEngine;
engines = lib.mkOption {
type = with lib.types; listOf ibusEngine;
default = [];
example = literalExpression "with pkgs.ibus-engines; [ mozc hangul ]";
example = lib.literalExpression "with pkgs.ibus-engines; [ mozc hangul ]";
description =
let
enginesDrv = filterAttrs (const isDerivation) pkgs.ibus-engines;
engines = concatStringsSep ", "
(map (name: "`${name}`") (attrNames enginesDrv));
enginesDrv = lib.filterAttrs (lib.const lib.isDerivation) pkgs.ibus-engines;
engines = lib.concatStringsSep ", "
(map (name: "`${name}`") (lib.attrNames enginesDrv));
in "Enabled IBus engines. Available engines are: ${engines}.";
};
panel = mkOption {
type = with types; nullOr path;
panel = lib.mkOption {
type = with lib.types; nullOr path;
default = null;
example = literalExpression ''"''${pkgs.plasma5Packages.plasma-desktop}/libexec/kimpanel-ibus-panel"'';
example = lib.literalExpression ''"''${pkgs.plasma5Packages.plasma-desktop}/libexec/kimpanel-ibus-panel"'';
description = "Replace the IBus panel with another panel.";
};
};
};

config = mkIf (imcfg.enable && imcfg.type == "ibus") {
config = lib.mkIf (imcfg.enable && imcfg.type == "ibus") {
i18n.inputMethod.package = ibusPackage;

environment.systemPackages = [
Expand All @@ -76,7 +73,7 @@ in
XMODIFIERS = "@im=ibus";
};

xdg.portal.extraPortals = mkIf config.xdg.portal.enable [
xdg.portal.extraPortals = lib.mkIf config.xdg.portal.enable [
ibusPackage
];
};
Expand Down
4 changes: 1 addition & 3 deletions nixos/modules/i18n/input-method/nabi.nix
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
{ config, pkgs, lib, ... }:

with lib;
let
imcfg = config.i18n.inputMethod;
in
{
config = mkIf (imcfg.enable && imcfg.type == "nabi") {
config = lib.mkIf (imcfg.enable && imcfg.type == "nabi") {
i18n.inputMethod.package = pkgs.nabi;

environment.variables = {
Expand Down
9 changes: 3 additions & 6 deletions nixos/modules/i18n/input-method/uim.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
{ config, pkgs, lib, ... }:

with lib;

let
imcfg = config.i18n.inputMethod;
cfg = imcfg.uim;
Expand All @@ -10,8 +7,8 @@ in
options = {

i18n.inputMethod.uim = {
toolbar = mkOption {
type = types.enum [ "gtk" "gtk3" "gtk-systray" "gtk3-systray" "qt5" ];
toolbar = lib.mkOption {
type = lib.types.enum [ "gtk" "gtk3" "gtk-systray" "gtk3-systray" "qt5" ];
default = "gtk";
example = "gtk-systray";
description = ''
Expand All @@ -22,7 +19,7 @@ in

};

config = mkIf (imcfg.enable && imcfg.type == "uim") {
config = lib.mkIf (imcfg.enable && imcfg.type == "uim") {
i18n.inputMethod.package = pkgs.uim;

environment.variables = {
Expand Down
11 changes: 4 additions & 7 deletions nixos/modules/misc/assertions.nix
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
{ lib, ... }:

with lib;

{

options = {

assertions = mkOption {
type = types.listOf types.unspecified;
assertions = lib.mkOption {
type = lib.types.listOf lib.types.unspecified;
internal = true;
default = [];
example = [ { assertion = false; message = "you can't enable this for that reason"; } ];
Expand All @@ -18,10 +15,10 @@ with lib;
'';
};

warnings = mkOption {
warnings = lib.mkOption {
internal = true;
default = [];
type = types.listOf types.str;
type = lib.types.listOf lib.types.str;
example = [ "The `foo' service is deprecated and will go away soon!" ];
description = ''
This option allows modules to show warnings to users during
Expand Down
19 changes: 8 additions & 11 deletions nixos/modules/misc/crashdump.nix
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
{ config, lib, pkgs, ... }:

with lib;

let
crashdump = config.boot.crashDump;

kernelParams = concatStringsSep " " crashdump.kernelParams;
kernelParams = lib.concatStringsSep " " crashdump.kernelParams;

in
###### interface
{
options = {
boot = {
crashDump = {
enable = mkOption {
type = types.bool;
enable = lib.mkOption {
type = lib.types.bool;
default = false;
description = ''
If enabled, NixOS will set up a kernel that will
Expand All @@ -24,17 +21,17 @@ in
It also activates the NMI watchdog.
'';
};
reservedMemory = mkOption {
reservedMemory = lib.mkOption {
default = "128M";
type = types.str;
type = lib.types.str;
description = ''
The amount of memory reserved for the crashdump kernel.
If you choose a too high value, dmesg will mention
"crashkernel reservation failed".
'';
};
kernelParams = mkOption {
type = types.listOf types.str;
kernelParams = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [ "1" "boot.shell_on_fail" ];
description = ''
Parameters that will be passed to the kernel kexec-ed on crash.
Expand All @@ -46,7 +43,7 @@ in

###### implementation

config = mkIf crashdump.enable {
config = lib.mkIf crashdump.enable {
boot = {
postBootCommands = ''
echo "loading crashdump kernel...";
Expand Down
17 changes: 7 additions & 10 deletions nixos/modules/misc/label.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
{ config, lib, ... }:

with lib;

let
cfg = config.system.nixos;
in
Expand All @@ -10,8 +7,8 @@ in

options.system = {

nixos.label = mkOption {
type = types.strMatching "[a-zA-Z0-9:_\\.-]*";
nixos.label = lib.mkOption {
type = lib.types.strMatching "[a-zA-Z0-9:_\\.-]*";
description = ''
NixOS version name to be used in the names of generated
outputs and boot labels.
Expand Down Expand Up @@ -43,8 +40,8 @@ in
'';
};

nixos.tags = mkOption {
type = types.listOf types.str;
nixos.tags = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [];
example = [ "with-xen" ];
description = ''
Expand All @@ -68,9 +65,9 @@ in
config = {
# This is set here rather than up there so that changing it would
# not rebuild the manual
system.nixos.label = mkDefault (maybeEnv "NIXOS_LABEL"
(concatStringsSep "-" ((sort (x: y: x < y) cfg.tags)
++ [ (maybeEnv "NIXOS_LABEL_VERSION" cfg.version) ])));
system.nixos.label = lib.mkDefault (lib.maybeEnv "NIXOS_LABEL"
(lib.concatStringsSep "-" ((lib.sort (x: y: x < y) cfg.tags)
++ [ (lib.maybeEnv "NIXOS_LABEL_VERSION" cfg.version) ])));
};

}
29 changes: 13 additions & 16 deletions nixos/modules/misc/meta.nix
Original file line number Diff line number Diff line change
@@ -1,28 +1,25 @@
{ lib, ... }:

with lib;

let
maintainer = mkOptionType {
maintainer = lib.mkOptionType {
name = "maintainer";
check = email: elem email (attrValues lib.maintainers);
merge = loc: defs: listToAttrs (singleton (nameValuePair (last defs).file (last defs).value));
check = email: lib.elem email (lib.attrValues lib.maintainers);
merge = loc: defs: lib.listToAttrs (lib.singleton (lib.nameValuePair (lib.last defs).file (lib.last defs).value));
};

listOfMaintainers = types.listOf maintainer // {
listOfMaintainers = lib.types.listOf maintainer // {
# Returns list of
# { "module-file" = [
# "maintainer1 <first@nixos.org>"
# "maintainer2 <second@nixos.org>" ];
# }
merge = loc: defs:
zipAttrs
(flatten (imap1 (n: def: imap1 (m: def':
lib.zipAttrs
(lib.flatten (lib.imap1 (n: def: lib.imap1 (m: def':
maintainer.merge (loc ++ ["[${toString n}-${toString m}]"])
[{ inherit (def) file; value = def'; }]) def.value) defs));
};

docFile = types.path // {
docFile = lib.types.path // {
# Returns tuples of
# { file = "module location"; value = <path/to/doc.xml>; }
merge = loc: defs: defs;
Expand All @@ -33,18 +30,18 @@ in
options = {
meta = {

maintainers = mkOption {
maintainers = lib.mkOption {
type = listOfMaintainers;
internal = true;
default = [];
example = literalExpression ''[ lib.maintainers.all ]'';
example = lib.literalExpression ''[ lib.maintainers.all ]'';
description = ''
List of maintainers of each module. This option should be defined at
most once per module.
'';
};

doc = mkOption {
doc = lib.mkOption {
type = docFile;
internal = true;
example = "./meta.chapter.md";
Expand All @@ -54,8 +51,8 @@ in
'';
};

buildDocsInSandbox = mkOption {
type = types.bool // {
buildDocsInSandbox = lib.mkOption {
type = lib.types.bool // {
merge = loc: defs: defs;
};
internal = true;
Expand All @@ -72,5 +69,5 @@ in
};
};

meta.maintainers = singleton lib.maintainers.pierron;
meta.maintainers = lib.singleton lib.maintainers.pierron;
}
15 changes: 6 additions & 9 deletions nixos/modules/programs/fcast-receiver.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
{ config, lib, pkgs, ... }:

with lib;

let
cfg = config.programs.fcast-receiver;
in
Expand All @@ -11,20 +8,20 @@ in
};

options.programs.fcast-receiver = {
enable = mkEnableOption "FCast Receiver";
openFirewall = mkOption {
type = types.bool;
enable = lib.mkEnableOption "FCast Receiver";
openFirewall = lib.mkOption {
type = lib.types.bool;
default = false;
description = ''
Open ports needed for the functionality of the program.
'';
};
package = mkPackageOption pkgs "fcast-receiver" { };
package = lib.mkPackageOption pkgs "fcast-receiver" { };
};

config = mkIf cfg.enable {
config = lib.mkIf cfg.enable {
environment.systemPackages = [ cfg.package ];
networking.firewall = mkIf cfg.openFirewall {
networking.firewall = lib.mkIf cfg.openFirewall {
allowedTCPPorts = [ 46899 ];
};
};
Expand Down
Loading