Is there a NixOS way of setting the following in configuration.nix:
DisableCapsuleUpdateOnDisk=true
in /etc/fwupd/uefi_capsule.conf
Is there a NixOS way of setting the following in configuration.nix:
DisableCapsuleUpdateOnDisk=true
in /etc/fwupd/uefi_capsule.conf
Use environment.etc
, this is what the NixOS modules use under the hood to place configuration files, too.
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
.
We might want to do something like nixos/fwupd: Make daemon.conf structured by zhaofengli Β· Pull Request #195341 Β· NixOS/nixpkgs Β· GitHub for uefi_capsule.conf
as well. Though until then, doing as suggested by Peter is your only option:
environment.etc."fwupd/uefi_capsule.conf".text = lib.mkForce ''
[uefi_capsule]
OverrideESPMountPoint=${config.boot.loader.efi.efiSysMountPoint}
whatever settings you need
'';
@zeorin Editing the package with overrideAttrs
will not help, as ${pkgs.fwupd}/etc/fwupd/ uefi_capsule.conf
is not really used.
Thank you very much for this. I decided to give this a try, but got an error:
error: undefined variable 'lib'
at /nix/store/x5sds18hn8b7aia1y0bvzp4qh0s60fgs-source/system/configuration.nix:169:52:
168|
169| environment.etc."fwupd/uefi_capsule.conf".text = lib.mkForce ''
| ^
170| [uefi_capsule]
Iβm proud to say that I figured out the solution:
environment.etc."fwupd/uefi_capsule.conf".text = pkgs.lib.mkForce ''
[uefi_capsule]
OverrideESPMountPoint=${config.boot.loader.efi.efiSysMountPoint}
whatever settings you need
'';
Once again, thank you!
Right. Or alternately, you can add lib
as the argument to your configuration.