Commit Graph

31 Commits

Author SHA1 Message Date
Nikita Rudenko
2dca23ab8a nixos/wireless: allow PKCS11 token access in the hardened service 2026-08-27 19:16:30 +03:00
Nikita Rudenko
d8b1dee56d nixos/tpm2: register pkcs11 module with p11-kit 2026-08-09 02:11:42 +03:00
JuergenReppSIT
a324f9a521 nixos/tpm2: fix access rights keystore
Add write permissions for tss group for tpm2-tss keystore
to enable provisioning for users in tss group.

Signed-off-by: JuergenReppSIT <juergen_repp@web.de>
2026-02-24 20:26:45 +01:00
Scott Stephens
c43291044e nixos/tpm2: create tss user and group if either is required
We only want to create users and groups in the module if they are the module defaults; if a user is specifying something else, we can presume that they are creating that themselves and don't want to conflict.

The previous implementation caused problems when the module was configured to use the /dev/tpmrm0 kernel resource manager. In this configuration, /dev/tpmrm0 would be owned by root, but in the group tss, which caused there to be no tss user created. This in turn caused the tss group to be a "normal" group, not a system group, and udev does not assign devices to normal groups. Unfortunately, there is no isSystemGroup option corresponding to the isSystemUser option. To avoid messing with the user system, we add the tss user if we need the group.

resolves #489756
2026-02-13 22:25:10 -05:00
Dyego Aurélio
28096cc5e3 treewide: apply nixfmt 1.2.0 2026-01-22 18:37:56 -03:00
Aliaksandr
80f12557f5 treewide: replace "yes" else "no" usages to lib.boolToYesNo 2025-10-21 16:04:34 +03:00
Scott Stephens
6367bb616b nixos/tpm2: add scottstephens as maintainer 2025-10-14 12:47:57 -04:00
Berk D. Demir
37874d4106 nixos/tpm2: Fix FAPI directory permission setting
Use `tssUser` option value for FAPI log directory user in
systemd-tmpfiles rules, instead of hardcoding `tss`.

If `security.tpm2.abrmd.enable = false` (default), `tssUser` is root.

Fixes systemd-tmpfiles-resetup error:
  /etc/tmpfiles.d/00-nixos.conf:<ln>: Failed to resolve user 'tss': No such process
2025-10-12 18:43:53 -07:00
nixpkgs-ci[bot]
f08a85f704 Merge master into staging-next 2025-09-22 12:07:05 +00:00
h7x4
4ba3f60b8a various: use mkPackageOption 2025-09-22 02:46:54 +02:00
Scott Stephens
0509fb6f97 nixos/tpm2: use better method for udev trigger 2025-09-18 16:34:32 -04:00
Scott Stephens
95d8873397 nixos/tpm2: add comment describing purpose of script 2025-09-15 17:25:29 -04:00
Scott Stephens
db83ec4e2a nixos/tpm2: add manual entry 2025-09-15 17:25:29 -04:00
Scott Stephens
2b8e3c647e nixos/tpm2: improve module options documentation 2025-09-15 17:25:29 -04:00
Scott Stephens
94976dee91 nixos/tpm2: use redirection instead of cat
Co-authored-by: Philip Taron <philip.taron@gmail.com>
2025-09-15 17:25:29 -04:00
Scott Stephens
ddd27d1a4b nixos/tpm2: create directories for FAPI 2025-09-15 14:55:20 -04:00
Scott Stephens
058f41488e nixos/tpm2: start tpm2-abrmd after dev-tpm0.device
tpm2-abrmd can't start up until /dev/tpm0 has been created and its
udev rules applied. This prevents a failure on startup by waiting
for that to happen.
2025-09-15 14:55:20 -04:00
Scott Stephens
b293d9917a nixos/tpm2: trigger udev change on tpm devices
The package changes udev rules. A device change must be triggered
in order for these changes to be picked up, otherwise services
which depend on the configuration will fail.
2025-09-15 14:55:20 -04:00
Scott Stephens
1d1e46f478 nixos/tpm2: add fapi options section
This allows a user to generate a fapi-config.json file and links
/etc/tpm2-tss/fapi-config.json to it.
2025-09-15 14:55:20 -04:00
Scott Stephens
ee7bb85503 nixos/tpm2: add systemd tag to udev rules
Updating the udev rules to match what is in recent versions of the
suggested rules from the tpm2-tss package. The old rules were based
on an old version of the suggested rules and never updated when
they were updated in subsequent version upgrades.
2025-09-15 14:55:20 -04:00
Morgan Jones
9c1564e395 nixos/tpm2: default pkcs#11 module based on abrmd config
Since there are now variants of tpm2-pkcs11 with and without ABRMD
support (for the kernel resource manager), ensure we pick the correct
default.

Fixes an accidental backwards incompatibility with the module.
2025-05-21 01:07:34 -07:00
Silvan Mosberger
4f0dadbf38 treewide: format all inactive Nix files
After final improvements to the official formatter implementation,
this commit now performs the first treewide reformat of Nix files using it.
This is part of the implementation of RFC 166.

Only "inactive" files are reformatted, meaning only files that
aren't being touched by any PR with activity in the past 2 months.
This is to avoid conflicts for PRs that might soon be merged.
Later we can do a full treewide reformat to get the rest,
which should not cause as many conflicts.

A CI check has already been running for some time to ensure that new and
already-formatted files are formatted, so the files being reformatted here
should also stay formatted.

This commit was automatically created and can be verified using

    nix-build a08b3a4d19.tar.gz \
      --argstr baseRev b32a094368
    result/bin/apply-formatting $NIXPKGS_PATH
2024-12-10 20:26:33 +01:00
stuebinm
6afb255d97 nixos: remove all uses of lib.mdDoc
these changes were generated with nixq 0.0.2, by running

  nixq ">> lib.mdDoc[remove] Argument[keep]" --batchmode nixos/**.nix
  nixq ">> mdDoc[remove] Argument[keep]" --batchmode nixos/**.nix
  nixq ">> Inherit >> mdDoc[remove]" --batchmode nixos/**.nix

two mentions of the mdDoc function remain in nixos/, both of which
are inside of comments.

Since lib.mdDoc is already defined as just id, this commit is a no-op as
far as Nix (and the built manual) is concerned.
2024-04-13 10:07:35 -07:00
fetsorn
5e77899001 nixos/tpm2: fix typo
"acess" -> "access"
2023-05-09 18:02:17 +04:00
pennae
ef176dcf7e nixos/*: automatically convert option descriptions
conversions were done using https://github.com/pennae/nix-doc-munge
using (probably) rev f34e145 running

    nix-doc-munge nixos/**/*.nix
    nix-doc-munge --import nixos/**/*.nix

the tool ensures that only changes that could affect the generated
manual *but don't* are committed, other changes require manual review
and are discarded.
2022-08-31 16:32:53 +02:00
pennae
c915b915b5 nixos/*: md-convert options with unordered lists
mostly no rendering changes. some lists (like simplelist) don't have an
exact translation to markdown, so we use a comma-separated list of
literals instead.
2022-08-31 16:32:53 +02:00
pennae
2e751c0772 treewide: automatically md-convert option descriptions
the conversion procedure is simple:

 - find all things that look like options, ie calls to either `mkOption`
   or `lib.mkOption` that take an attrset. remember the attrset as the
   option
 - for all options, find a `description` attribute who's value is not a
   call to `mdDoc` or `lib.mdDoc`
 - textually convert the entire value of the attribute to MD with a few
   simple regexes (the set from mdize-module.sh)
 - if the change produced a change in the manual output, discard
 - if the change kept the manual unchanged, add some text to the
   description to make sure we've actually found an option. if the
   manual changes this time, keep the converted description

this procedure converts 80% of nixos options to markdown. around 2000
options remain to be inspected, but most of those fail the "does not
change the manual output check": currently the MD conversion process
does not faithfully convert docbook tags like <code> and <package>, so
any option using such tags will not be converted at all.
2022-07-30 15:16:34 +02:00
Naïm Favier
2ddc335e6f nixos/doc: clean up defaults and examples 2021-10-04 12:47:20 +02:00
Austin Butler
8b6fa3c821 nixos/tpm2: define group, fix after NixOS#133166 2021-09-19 12:40:54 -07:00
Florian Klink
962e15aebc nixos: remove StandardOutput=syslog, StandardError=syslog lines
Since systemd 243, docs were already steering users towards using
`journal`:

eedaf7f322

systemd 246 will go one step further, it shows warnings for these units
during bootup, and will [automatically convert these occurences to
`journal`](f3dc6af20f):

> [    6.955976] systemd[1]: /nix/store/hwyfgbwg804vmr92fxc1vkmqfq2k9s17-unit-display-manager.service/display-manager.service:27: Standard output type syslog is obsolete, automatically updating to journal. Please update│······················
 your unit file, and consider removing the setting altogether.

So there's no point of keeping `syslog` here, and it's probably a better
idea to just not set it, due to:

> This setting defaults to the value set with DefaultStandardOutput= in
> systemd-system.conf(5), which defaults to journal.
2020-08-13 18:49:15 +02:00
Leon Schuermann
156b879c2e nixos/tpm2: init
This commit adds udev rules, the userspace resource manager and
PKCS#11 module support.
2020-03-15 12:16:32 +01:00