Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30252 from jtojnar/fwupd
fwupd: 0.9.6 → 1.0.1
- Loading branch information
Showing
4 changed files
with
228 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
# fwupd daemon. | ||
|
||
{ config, lib, pkgs, ... }: | ||
|
||
with lib; | ||
|
||
let | ||
cfg = config.services.fwupd; | ||
originalEtc = | ||
let | ||
isRegular = v: v == "regular"; | ||
listFiles = d: builtins.attrNames (filterAttrs (const isRegular) (builtins.readDir d)); | ||
copiedDirs = [ "fwupd/remotes.d" "pki/fwupd" "pki/fwupd-metadata" ]; | ||
originalFiles = concatMap (d: map (f: "${d}/${f}") (listFiles "${pkgs.fwupd}/etc/${d}")) copiedDirs; | ||
mkEtcFile = n: nameValuePair n { source = "${pkgs.fwupd}/etc/${n}"; }; | ||
in listToAttrs (map mkEtcFile originalFiles); | ||
extraTrustedKeys = | ||
let | ||
mkName = p: "pki/fwupd/${baseNameOf (toString p)}"; | ||
mkEtcFile = p: nameValuePair (mkName p) { source = p; }; | ||
in listToAttrs (map mkEtcFile cfg.extraTrustedKeys); | ||
in { | ||
|
||
###### interface | ||
options = { | ||
services.fwupd = { | ||
enable = mkOption { | ||
type = types.bool; | ||
default = true; | ||
description = '' | ||
Whether to enable fwupd, a DBus service that allows | ||
applications to update firmware. | ||
''; | ||
}; | ||
|
||
blacklistDevices = mkOption { | ||
type = types.listOf types.string; | ||
default = []; | ||
example = [ "2082b5e0-7a64-478a-b1b2-e3404fab6dad" ]; | ||
description = '' | ||
Allow blacklisting specific devices by their GUID | ||
''; | ||
}; | ||
|
||
blacklistPlugins = mkOption { | ||
type = types.listOf types.string; | ||
default = []; | ||
example = [ "udev" ]; | ||
description = '' | ||
Allow blacklisting specific plugins | ||
''; | ||
}; | ||
|
||
extraTrustedKeys = mkOption { | ||
type = types.listOf types.path; | ||
default = []; | ||
example = literalExample "[ /etc/nixos/fwupd/myfirmware.pem ]"; | ||
description = '' | ||
Installing a public key allows firmware signed with a matching private key to be recognized as trusted, which may require less authentication to install than for untrusted files. By default trusted firmware can be upgraded (but not downgraded) without the user or administrator password. Only very few keys are installed by default. | ||
''; | ||
}; | ||
}; | ||
}; | ||
|
||
|
||
###### implementation | ||
config = mkIf cfg.enable { | ||
environment.systemPackages = [ pkgs.fwupd ]; | ||
|
||
environment.etc = { | ||
"fwupd/daemon.conf" = { | ||
source = pkgs.writeText "daemon.conf" '' | ||
[fwupd] | ||
BlacklistDevices=${lib.concatStringsSep ";" cfg.blacklistDevices} | ||
BlacklistPlugins=${lib.concatStringsSep ";" cfg.blacklistPlugins} | ||
''; | ||
}; | ||
} // originalEtc // extraTrustedKeys; | ||
|
||
services.dbus.packages = [ pkgs.fwupd ]; | ||
|
||
services.udev.packages = [ pkgs.fwupd ]; | ||
|
||
systemd.packages = [ pkgs.fwupd ]; | ||
|
||
systemd.tmpfiles.rules = [ | ||
"d /var/lib/fwupd 0755 root root -" | ||
]; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,56 @@ | ||
{ stdenv, fetchurl, gtk_doc, pkgconfig, gobjectIntrospection, intltool | ||
, libgudev, polkit, appstream-glib, gusb, sqlite, libarchive | ||
, libsoup, docbook2x, gpgme, libxslt, libelf, libsmbios, efivar | ||
, fwupdate, libyaml, valgrind, meson, libuuid, pygobject3 | ||
, pillow, ninja, gcab | ||
, libgudev, polkit, appstream-glib, gusb, sqlite, libarchive, glib_networking | ||
, libsoup, docbook2x, gpgme, libxslt, libelf, libsmbios, efivar, glibcLocales | ||
, fwupdate, libyaml, valgrind, meson, libuuid, pygobject3, colord | ||
, pillow, ninja, gcab, gnutls, python3Packages, wrapGAppsHook | ||
}: | ||
let version = "0.9.6"; | ||
in | ||
stdenv.mkDerivation | ||
{ name = "fwupd-${version}"; | ||
src = fetchurl | ||
{ url = "https://people.freedesktop.org/~hughsient/releases/fwupd-${version}.tar.xz"; | ||
sha256 = "0h3y4ygckvkjdx7yxwbm273iv84yk37ivlcf4xvq95g64vs8gfhf"; | ||
}; | ||
buildInputs = | ||
[ gtk_doc pkgconfig gobjectIntrospection intltool libgudev | ||
polkit appstream-glib gusb sqlite libarchive libsoup | ||
docbook2x libxslt libelf libsmbios fwupdate libyaml valgrind | ||
meson gpgme libuuid pygobject3 pillow ninja gcab | ||
]; | ||
patches = [ ./fix-missing-deps.patch ]; | ||
preConfigure = '' | ||
export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I${efivar}/include/efivar" | ||
''; | ||
mesonFlags = [ "-Denable-colorhug=false" "-Denable-man=false" "-Denable-tests=false" "--localstatedir=/var" "-Denable-doc=false" "-Dwith-bootdir=/boot" ]; | ||
enableParallelBuilding = true; | ||
meta = | ||
{ license = [ stdenv.lib.licenses.gpl2 ]; | ||
platforms = stdenv.lib.platforms.linux; | ||
}; | ||
} | ||
let | ||
version = "1.0.1"; | ||
in stdenv.mkDerivation { | ||
name = "fwupd-${version}"; | ||
src = fetchurl { | ||
url = "https://people.freedesktop.org/~hughsient/releases/fwupd-${version}.tar.xz"; | ||
sha256 = "1k627rja7df51dkzqvkzgbwrrj4049k6408d01m34n66zwr2fp59"; | ||
}; | ||
|
||
nativeBuildInputs = [ | ||
meson ninja gtk_doc pkgconfig gobjectIntrospection intltool glibcLocales | ||
valgrind gcab docbook2x libxslt pygobject3 python3Packages.pycairo wrapGAppsHook | ||
]; | ||
buildInputs = [ | ||
polkit appstream-glib gusb sqlite libarchive libsoup libelf libsmbios fwupdate libyaml | ||
libgudev colord gpgme libuuid pillow gnutls glib_networking | ||
]; | ||
|
||
LC_ALL = "en_US.UTF-8"; # For po/make-images | ||
|
||
NIX_CFLAGS_COMPILE = [ | ||
"-I${efivar}/include/efivar" | ||
# warning: "__LIBELF_INTERNAL__" is not defined | ||
"-Wno-error=undef" | ||
]; | ||
|
||
patches = [ | ||
./fix-missing-deps.patch | ||
]; | ||
postPatch = '' | ||
patchShebangs . | ||
''; | ||
|
||
mesonFlags = [ | ||
"-Denable-man=false" | ||
"-Denable-tests=false" | ||
"-Denable-doc=false" | ||
"-Dwith-bootdir=/boot" | ||
"-Dwith-udevdir=lib/udev" | ||
"-Dwith-systemdunitdir=lib/systemd/system" | ||
"--localstatedir=/var" | ||
]; | ||
|
||
enableParallelBuilding = true; | ||
meta = { | ||
homepage = https://fwupd.org/; | ||
license = [ stdenv.lib.licenses.gpl2 ]; | ||
platforms = stdenv.lib.platforms.linux; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters