Commit Graph

348 Commits

Author SHA1 Message Date
r-vdp
3d3e3dbfc4 nixos/userborn: import legacy /var/lib/nixos state on first run
ids that were allocated and later freed only live in
/var/lib/nixos/{uid,gid}-map. userborn allocates from /etc/passwd
alone, so without this a new user could get a previously-used uid and
inherit file ownership.

Service has a ConditionPathExists on the uid-map and a sentinel under
/var/lib/userborn, so it runs at most once and is a no-op on fresh
installs.
2026-08-13 12:16:35 +02:00
Philip Taron
2ef12801d0 nixos/nix: Support local-only store (#536721) 2026-08-05 17:05:53 +00:00
Artemis Tosini
dfca7cafbb nixos/nix-daemon: Set HOME for unprivileged daemon
Fixes issues with fetching from substituter while running with an
unprivileged daemon.

Using the StateDirectory instead of CacheDirectory here since it is
unclear what Nix will store there in the future.
2026-08-04 10:47:17 -04:00
Peter Bynum
80958945e2 nixos/nix-daemon: Add daemon.enable option and assertions 2026-07-28 09:55:32 -04:00
Peter Bynum
94e1aa6387 nixos/nix-daemon: flatten unnecessary mkMerge 2026-07-28 09:55:31 -04:00
Peter Bynum
058289cc6a nixos/nix: Move systemPackages, tmpfiles, and build users to settings module 2026-07-28 09:55:31 -04:00
Peter Bynum
3a84c13b45 nixos/nix: Move nix.enable and nix.package to settings module 2026-07-28 09:23:32 -04:00
Asa Paparo
be5fbdd94f nixos/userborn: fix cross compilation with userborn.static.enable
`services.userborn.static = true` causes userborn to build
a `static-userborn` derivation, which directly referenced
`${cfg.package}`, which broke on cross compilation. This commit passes
`cfg.package` as a `nativeBuildInput` so it uses the proper spliced
pkgs, fixes #545478.
2026-07-24 23:12:46 -05:00
Kenji Berthold
effc841c80 nixos/userborn: fix typo 2026-07-17 17:08:24 +02:00
Michael Daniels
2e87c2f8f4 nixos/*: remove unused let bindings
Generated using deadnix (with some manual work); split from #514611.
2026-05-01 20:39:14 -04:00
Arian van Putten
d2c949d725 nixos/dbus: switch default implementation to dbus-broker
dbus-broker provides higher performance and reliability compared to the
classic dbus-daemon. The prerequisite PR #477800 has been merged, making
this switch safe.

Note that services.dbus.implementation is a switch inhibitor: changing
the D-Bus implementation between generations requires a reboot rather
than nixos-rebuild switch, since restarting D-Bus mid-session is unsafe.

Fixes #299476
2026-04-21 12:58:13 +02:00
nikstur
b29e9123ac nixos/tmpfiles: fix layer inversion (#507873) 2026-04-11 19:09:03 +00:00
Robert Hensing
b6f7d1c851 nixos/tmpfiles: fix layer inversion
The nix module uses tmpfiles, not the other way around.
Move definitions so that tmpfiles does not depend on the nix module.
This makes the tmpfiles module usable without loading a nix module.
2026-04-08 14:14:01 +02:00
Will Fancher
0d7de04c0c nixos/systemd-stage-1: Enable dbus by default
Also fix the scary dbus warning when using systemctl
2026-04-07 20:32:12 -04:00
Jörg Thalheim
64c1786286 nixos/zram-generator: do not restart on switch
Restarting systemd-zram-setup@ does swapoff -> reset -> reconfigure ->
swapon. This is undesirable:

- swapoff can push a loaded system into OOM.
- The reset races with udev still holding /dev/zramN open after swapoff;
  the kernel rejects it with EBUSY (disk_openers > 0), leaving the
  device initialized so ExecStart then fails to write
  comp_algorithm/disksize (systemd/zram-generator#226).

The unit only "changes" because store paths in the drop-in churn, so
just keep the device across switches. Actual config changes can be
applied with a reboot or manual restart.
2026-03-28 08:11:29 +01:00
Artemis Tosini
3e7afcb9c3 nixos/nix-daemon: Fix unprivileged tmpfiles rules 2026-02-23 14:19:53 -05:00
Artemis Tosini
bd49e43206 nixos/nix-daemon: Support running as non-root user 2026-02-19 16:02:48 -05:00
tarzst
2b72677636 bpftune: 0-unstable-2025-03-20 → 0.4-2 2026-02-11 23:02:08 +05:30
WilliButz
fea4f53135 userborn: 0.4.0 -> 0.5.0 (#483684) 2026-02-03 16:25:59 +00:00
Sandro
af1a49be0f nixos/automatic-timezoned: Fix boot delays and systemd unit ordering (#470359) 2026-02-02 18:07:49 +00:00
nikstur
2b71179e9f nixos/userborn: properly implement mutable users
For this to work properly we need a new Userborn version in Nixpkgs.
2026-01-26 00:05:47 +01:00
Arian van Putten
ef696c6a60 nixos/switchable-system: improve switch inhibitors (#477800) 2026-01-18 20:46:53 +00:00
nikstur
84f771f192 nixos/userborn: introduce config.services.userborn.static mode (#465906) 2026-01-18 13:57:36 +00:00
NAHO
a2ed7e8d88 nixos: remove optional builtins prefixes from prelude functions
Remove optional builtins prefixes from prelude functions by running:

    builtins=(
      abort
      baseNameOf
      break
      derivation
      derivationStrict
      dirOf
      false
      fetchGit
      fetchMercurial
      fetchTarball
      fetchTree
      fromTOML
      import
      isNull
      map
      null
      placeholder
      removeAttrs
      scopedImport
      throw
      toString
      true
    )

    fd \
      --exclude doc/manual/release-notes \
      --type file \
      . \
      nixos \
      --exec-batch sed --in-place --regexp-extended "
        s/\<builtins\.($(
          printf '%s\n' "${builtins[@]}" |
            paste --delimiter '|' --serial -
        ))\>/\1/g
      "

    nix fmt
2026-01-15 16:07:55 +01:00
Val Packett
133f4cd7da nixos/userborn: introduce config.services.userborn.static mode
For embedded appliance-style applications, we would like to avoid the
~100ms boot time hit that comes from running userborn or sysusers by
pre-baking the final password files directly into the system closure.

Turns out, userborn is trivial to run at build time instead of boot time,
so let's introduce a new "baked" static mode that directly places the files
into an immutable /etc.
2026-01-13 01:56:09 -03:00
Wolfgang Walther
16c2a2499e teams/cachix: drop 2026-01-11 17:12:23 +01:00
r-vdp
17c832a574 nixos/dbus: add switch inhibitor to prevent changing the dbus implementation 2026-01-09 11:59:41 +02:00
r-vdp
aff9387dd4 nixos/switchable-system: don't add switch inhibitors by default 2026-01-04 13:06:50 +02:00
nixpkgs-ci[bot]
42860d60a3 Merge master into staging-nixos 2025-12-29 18:07:15 +00:00
Dev380
12c0a7fc52 nixos/nohang: init module
nixosTests.nohang: init

These tests are modified from earlyoom's tests. It tries to OOM the test
VM and then check that nohang's output is as expected. Unlike the
earlyoom test, we use the default config, so we test for whether the
signal nohang set was SIGKILL or SIGTERM and adjust the output checking accordingly

nohang: add linked test for the nixos module

nixos/doc/rl-2511: init nohang

nixos/nohang: change option name to configPath

nixos/nohang: use lib.getExe instead of interpolation

Co-authored-by: Leah Amelia Chen <github@acc.pluie.me>

nixos/nohang: use lib.getExe "tail" instead

Co-authored-by: Leah Amelia Chen <github@acc.pluie.me>

nixosTests.nohang: switch to runTest

nixos/nohang: use multiline string for CapabilityBoundingSet in service config

Co-authored-by: Sandro <sandro.jaeckel@gmail.com>

nohang: fix whitespace formatting
2025-12-29 13:04:07 +02:00
r-vdp
93cda47a1f nixos/switchable-system: introduce a standard pre-switch check to prevent switching under certain conditions
This commit introduces "switch inhibitors" which are derivations that
prevent a switch of a system to a new configuration if those derivations
don't have the same hash in both configurations.
This means that we can for instance add the systemd and dbus derivations
such that users will be instructed to reboot their system when those
derivations have changed instead of switching.

This feature should be used sparingly, but it can make NixOS more robust
by avoiding users switching to a configuration that can make their
system unstable (like major updates of systemd, or new versions of dbus
since the dbus and dbus-broker daemons cannot be restarted).

The user can still force the switch by setting an env var.
2025-12-25 12:02:34 +02:00
Alois Wohlschlager
a6c7a5b4b5 nixos/lix: init
Over time, it is expected that the setups for Lix and Nix will diverge in some
ways. To prevent cluttering the modules too much, we will introduce a separate
Lix module. It begins its existence as a fork of the nix-daemon module, right
now without major changes, although this will change soon. It is also slightly
weird due to not having any option definitions on its own and instead
dispatching on the pname of `nix.package`, which is done for backwards
compatibility (particularly on 25.11), and will also change soon by the gradual
introduction of a separate `programs.lix` option subtree.
2025-12-14 15:53:41 +01:00
Alois Wohlschlager
8165c8d96a nixos/nix-daemon: remove obsolete compatibility code
* util-linux was used for ionice, replaced by systemd directives in 2012 [1].
* gzip was used for compressing stuff sent over ssh, replaced by the `-C`
  option in Nix 1.8 [2].
* Conditionals for versions less than 2.8 (or 2.3) can be removed, as they are
  not supported any more [3].
* Some systemd directives are already in the upstream service file of all
  supported Nix and Lix versions, and are removed. For cgroup delegation, this
  is only strictly true for Lix ≥2.94; Lix 2.93 does not support it at all yet,
  and Nix doesn't use the supervisor group at all (I haven't investigated
  whether it creates one itself or is just broken entirely, but in any case the
  creation of the empty cgroup in the module will not help).

[1] 88f94d76bc
[2] 7f7d4ab686
[3] fa0cba1c39
2025-12-14 15:53:41 +01:00
Tristan Daniël Maat
718167630e nixos/automatic-timezoned: Fix boot delays and systemd unit ordering
Since the service sets `WantedBy=default.target`, `graphical.target`
ends up waiting for it to complete. Since `geoclue.service`, which
*this* service depends on, in turn depends on `network-online.target`,
this ends up making full boot wait for network availability.

This is obviously unintended; The unit should have always had an
`After=default.target`.

Furthermore, the systemd docs recommend depending on specifically
`multi-user.target` *or* `graphical.target`, rather than
`default.target`. In practice, on a default NixOS system, using
`default.target` delays starting this service until a graphical
session starts - this is obviously not ideal, since it makes sense to
update the timezone on a non-graphical system as well, so we fix that
while we're at it.
2025-12-13 13:55:04 +08:00
Jörg Thalheim
693ab78155 nixos/nix-daemon-firewall: Add a module to firewall FODs (#464613) 2025-12-10 22:52:15 +00:00
Janne Heß
7ea17890e5 nixos/nix-daemon-firewall: Fix firewall checking 2025-12-10 18:52:01 +01:00
Janne Heß
04bfb2ccf5 nixos/nix-daemon-firewall: Add a module to firewall FODs 2025-11-29 21:26:56 +01:00
Kylie McClain
708b85acca services.self-deploy: fix nix-build argument format
nix-build doesn't accept `--attr=<attribute>` as a valid way to
build a specific attribute; it needs to be passed without the
equal sign, as two separate arguments.
2025-11-18 02:13:55 -05:00
Lukas Wurzinger
1f4c50ab81 lib/cli: deprecate toGNUCommandLine 2025-10-21 21:01:38 +02:00
Sandro Jäckel
1f60b27cd1 userborn: do not use mkForce to disable activationScripts 2025-10-16 23:24:26 +02:00
Wolfgang Walther
c283f32d29 treewide: remove unused with
Auto-fixed by nixf-diagnose.
2025-10-05 10:50:41 +02:00
Masum Reza
1d84eb3dff nixos/nvme-rs: init (#410730) 2025-09-27 10:57:22 +00:00
liberodark
74a08886b1 nixos/nvme-rs: init 2025-09-27 08:44:52 +02:00
h7x4
2b075e121e nixos/cachix-watch-store: use more accurate int types 2025-09-22 18:45:48 +02:00
Sander
1ba28dc2f4 teams/cachix: inherit packages and modules 2025-09-09 16:55:12 +02:00
dish
970dcca69c treewide: Fix links in module documentation 2025-08-25 12:55:11 -04:00
Katalin Rebhan
b3af89dd38 nixos/kerberos_server: add extraKDCArgs option 2025-08-12 00:15:38 +02:00
Wolfgang Walther
5a0711127c treewide: run nixfmt 1.0.0 2025-07-24 13:55:40 +02:00
Wolfgang Walther
62fe016519 treewide: run treefmt with mdcr/nixfmt 2025-07-24 13:52:31 +02:00
Wolfgang Walther
6c47e7d5da treewide: fix syntax errors in nix code blocks
Fixes all code blocks with "nix" language in markdown files for syntax
errors to be able to run nixfmt in the next step.
2025-07-24 13:52:29 +02:00