How to set .conf file in /etc

Is there a NixOS way of setting the following in configuration.nix:

DisableCapsuleUpdateOnDisk=true

in /etc/fwupd/uefi_capsule.conf

1 Like

Use environment.etc, this is what the NixOS modules use under the hood to place configuration files, too.

1 Like

Use environment.etc, this is what the NixOS modules use under the hood to place configuration files, too.

Unfortunately, it’s not that easy in this specific case.

The fwupd module links the /etc/fwupd/uefi_capsule.conf' into place from /nix/store/hashashhashhash-fwupd/etc/uefi_capsule.conf’. The module should be fixed to allow overriding all the files in there.

You might be able to do this (untested - I’m not sure mkForce works in this case):
β”Œβ”€β”€β”€β”€
β”‚ {
β”‚ environment.etc.β€œfwupd/uefi_capsule.conf”.text = lib.mkForce β€˜β€™
β”‚ [uefi_capsule]
β”‚ whatever settings you need
β”‚ β€˜β€™;
β”‚ }
└────

Hmm. Looking more closely at https://github.com/NixOS/nixpkgs/blob/e43cf1748462c81202a32b26294e9f8eefcc3462/nixos/modules/services/hardware/fwupd.nix and https://github.com/NixOS/nixpkgs/blob/e43cf1748462c81202a32b26294e9f8eefcc3462/pkgs/os-specific/linux/firmware/fwupd/default.nix, I think you’d have to edit uefi_capsule.conf by using overrideAttrs and adding/editing a step in the build (I’d probably choose to amend postPatch), then feeding that overridden fwupd derivation to services.fwupd.package.

Hosted by Flying Circus.