summaryrefslogtreecommitdiffstats
path: root/nixos
diff options
context:
space:
mode:
authorAlexander Bantyev <balsoft@balsoft.ru>2022-10-07 14:23:19 +0400
committerGitHub <noreply@github.com>2022-10-07 14:23:19 +0400
commit99cc02fe981ba70098dfb7833959dba6a954ccf9 (patch)
tree67a3ba27690cdfa715040737156b396aa3667b17 /nixos
parent1480b43ad1805f2f81ff7b80cc474788272302d3 (diff)
parente03e61f62e698b42cfbaed1b86acfd6ae3f0a7b0 (diff)
Merge pull request #193694 from cab404/fwupd-remote-list
nixos.fwupd: add remote list option
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/services/hardware/fwupd.nix37
1 files changed, 27 insertions, 10 deletions
diff --git a/nixos/modules/services/hardware/fwupd.nix b/nixos/modules/services/hardware/fwupd.nix
index 2249f866803a..1be2d49f9708 100644
--- a/nixos/modules/services/hardware/fwupd.nix
+++ b/nixos/modules/services/hardware/fwupd.nix
@@ -33,18 +33,26 @@ let
mkEtcFile = p: nameValuePair (mkName p) { source = p; };
in listToAttrs (map mkEtcFile cfg.extraTrustedKeys);
- # We cannot include the file in $out and rely on filesInstalledToEtc
- # to install it because it would create a cyclic dependency between
- # the outputs. We also need to enable the remote,
- # which should not be done by default.
- testRemote = if cfg.enableTestRemote then {
- "fwupd/remotes.d/fwupd-tests.conf" = {
- source = pkgs.runCommand "fwupd-tests-enabled.conf" {} ''
+ enableRemote = base: remote: {
+ "fwupd/remotes.d/${remote}.conf" = {
+ source = pkgs.runCommand "${remote}-enabled.conf" {} ''
sed "s,^Enabled=false,Enabled=true," \
- "${cfg.package.installedTests}/etc/fwupd/remotes.d/fwupd-tests.conf" > "$out"
+ "${base}/etc/fwupd/remotes.d/${remote}.conf" > "$out"
'';
};
- } else {};
+ };
+ remotes = (foldl'
+ (configFiles: remote: configFiles // (enableRemote cfg.package remote))
+ {}
+ cfg.extraRemotes
+ ) // (
+ # We cannot include the file in $out and rely on filesInstalledToEtc
+ # to install it because it would create a cyclic dependency between
+ # the outputs. We also need to enable the remote,
+ # which should not be done by default.
+ mkIf cfg.enableTestRemote (enableRemote cfg.package.installedTests "fwupd-tests")
+ );
+
in {
###### interface
@@ -86,6 +94,15 @@ in {
'';
};
+ extraRemotes = mkOption {
+ type = with types; listOf str;
+ default = [];
+ example = [ "lvfs-testing" ];
+ description = lib.mdDoc ''
+ Enables extra remotes in fwupd. See `/etc/fwupd/remotes.d`.
+ '';
+ };
+
enableTestRemote = mkOption {
type = types.bool;
default = false;
@@ -119,7 +136,7 @@ in {
environment.systemPackages = [ cfg.package ];
# customEtc overrides some files from the package
- environment.etc = originalEtc // customEtc // extraTrustedKeys // testRemote;
+ environment.etc = originalEtc // customEtc // extraTrustedKeys // remotes;
services.dbus.packages = [ cfg.package ];