-
Notifications
You must be signed in to change notification settings - Fork 44
/
firmware.nix
64 lines (57 loc) · 1.53 KB
/
firmware.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# BIOS/Firmware updates
{ config, lib, pkgs, ... }:
let
inherit (lib)
mkIf
mkMerge
mkOption
types
;
cfg = config.jovian.devices.steamdeck;
in
{
options = {
jovian.devices.steamdeck = {
autoUpdate = mkOption {
type = types.bool;
default = false;
description = ''
Whether to automatically update the BIOS and controller firmware.
'';
};
enableFwupdBiosUpdates = mkOption {
type = types.bool;
default = cfg.enable;
defaultText = lib.literalExpression "config.jovian.devices.steamdeck.enable";
description = ''
Whether to use fwupd to update the BIOS.
'';
};
};
};
config = mkMerge [
(mkIf (cfg.enable) {
hardware.firmware = [
(lib.hiPrio pkgs.linux-firmware-jupiter)
(lib.hiPrio pkgs.steamdeck-dsp)
];
})
(mkIf (cfg.autoUpdate) {
systemd.packages = [pkgs.steamdeck-firmware];
systemd.services.jupiter-biosupdate.wantedBy = ["multi-user.target"];
systemd.services.jupiter-controller-update.wantedBy = ["multi-user.target"];
})
(mkIf (cfg.enableFwupdBiosUpdates) {
services.fwupd.enable = true;
environment.etc."fwupd/remotes.d/steamdeck-bios.conf".text = ''
# Enabled by jovian.devices.steamdeck.enableFwupdBiosUpdates
[fwupd Remote]
Enabled=true
Title=Steam Deck BIOS
Keyring=none
MetadataURI=file://${pkgs.steamdeck-bios-fwupd}
ApprovalRequired=false
'';
})
];
}