summary refs log tree commit diff
path: root/nixos/modules/system
Commit message (Collapse)AuthorAge
* Revert "nixos/modprobe: add boot.initrd.extraModprobeConfig option"Luflosi2022-03-17
| | | | This reverts commit 1c58cdbeed880e99d816c234a954d4cdfc073b6c, since this change was made redundant by 3dc6fab5c9362db2cf079ffa15f2b62b05001747 and in https://github.com/NixOS/nixpkgs/pull/145013 we decided to revert this commit.
* Merge pull request #162271 from Infinisil/warn-no-typeRobert Hensing2022-03-16
|\ | | | | Throw an error for options without a type
| * nixos/treewide: Add last missing option typesSilvan Mosberger2022-02-28
| | | | | | | | Co-Authored-By: Janne Heß <janne@hess.ooo>
* | nixos: systemd: split off helper functions into systemd-libBob van der Linden2022-03-15
| |
* | nixos/switch-to-configuration: fix installBootLoader escapingNaïm Favier2022-03-14
| | | | | | | | | | | | Use a quoted heredoc to inject installBootLoader safely into the script, and restore the previous invocation of `system` with a single argument so that shell commands keep working.
* | Merge pull request #163069 from helsinki-systems/feat/minor-stc-improvementsJanne Heß2022-03-13
|\ \ | | | | | | nixos/switch-to-configuration: Few minor/medium improvements
| * | nixos/switch-to-configuration: Use parenthesis on all callsJanne Heß2022-03-11
| | |
| * | nixos/switch-to-configuration: Fix reloading of stopped servicesJanne Heß2022-03-11
| | |
| * | nixos/switch-to-configuration: Fix restarting by activation scriptJanne Heß2022-03-11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This bug is so obscure and unlikely that I was honestly not able to properly write a test for it. What happens is that we are calling handleModifiedUnit() with $unitsToStart=\%unitsToRestart. We do this to make sure that the unit is stopped before it's started again which is not possible by regular means because the stop phase is already done when calling the activation script. recordUnit() still gets $startListFile, however which is the wrong file. The bug would be triggered if an activation script requests a service restart for a service that has `stopIfChanged = true` and switch-to-configuration is killed before the restart phase was run. If the script is run again, but the activation script is not requesting more restarts, the unit would be started instead of restarted.
| * | nixos/switch-to-configuration: Ignore some unit keysJanne Heß2022-03-11
| | | | | | | | | | | | | | | Some unit keys don't need to restart the service to make them effective. Reduce the amount of service restarts by ignoring these keys
* | | Merge pull request #162252 from sternenseemann/systemd-boot-builder-fix-errorsLuke Granger-Brown2022-03-13
|\ \ \ | |/ / |/| | sdboot-builder: fix crash in exception handling
| * | sdboot-builder: fix crash in exception handlingMaëlys Bras de fer2022-03-13
| |/
* | nixos/activation: allowed quoted values in /etc/os-releasePeter Hoeg2022-03-09
| |
* | nixos/switch-to-configuration: Document and test socket-activated servicesJanne Heß2022-03-03
|/
* logrotate/systemd: add 'minsize = 1M' to wtmp/btmp rotationDominique Martinet2022-02-27
| | | | | | align with upstream logrotate which added the minsize rule at some point. This avoids needlessly rotating the files too often as brought up in https://github.com/NixOS/nixpkgs/pull/159187#issuecomment-1052426774
* Merge pull request #159187 from martinetd/logrotateJanne Heß2022-02-23
|\ | | | | logrotate service enhancements
| * logrotate: move wtmp/btmp rules to systemdDominique Martinet2022-02-11
| | | | | | | | | | | | | | | | | | | | | | wtmp and btmp are created by systemd, so the rules are more appropriate there. They can be disabled explicitly with something like services.ogrotate.paths = { "/var/log/btmp".enable = false; "/var/log/wtmp".enable = false; }; if required.
* | modprobe: install systemd's modprobe optionsMartin Weinelt2022-02-22
| | | | | | | | | | Shipped by systemd to combat kmod default options that interfere with the netdev setup, when those drivers are initially loaded.
* | nixos: Switch to default systemd-nspawn behaviourChristian Kögler2022-02-19
| |
* | Merge pull request #160458 from helsinki-systems/fix/stc-backslashesJanne Heß2022-02-17
|\ \ | | | | | | nixos/switch-to-configuration: Fix backslashes in unit names
| * | nixos/switch-to-configuration: Fix backslashes in unit namesJanne Heß2022-02-17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | systemd needs this so special characters (like the ones in wireguard units that appear because they are part of base64) can be escaped using the \x syntax. Root of the issue is that `glob()` handles the backslash internally which is obviously not what we want here. Also add a test case and fix some perlcritic issues in the subroutine.
* | | Merge #157512: nixos/tmp: Fix format of /tmp mount optionsVladimír Čunát2022-02-17
|\ \ \ | |/ / |/| |
| * | nixos/tmp: Fix format of /tmp mount optionsRamses2022-01-31
| | | | | | | | | | | | | | | | | | | | | | | | The mount options need to be passed as a comma-separated list of options so that they end up one a single Options line in the resulting mount unit. The current code passed the options as a list, resulting in several Options lines in the mount unit, all but the first of these were ignored by systemd however. This behaviour is not clearly defined in the systemd man page.
* | | nixos/switch-to-configuration: avoid Array::Compare dependencyStig Palmquist2022-02-15
| | | | | | | | | | | | | | | Replace Array::Compare with a simple function, since Array::Compare pulls down Module::Build which breaks cross compilation.
* | | nixos/switch-to-configuration: Don't stop swaps in dry-activateJanne Heß2022-02-09
| | |
* | | nixos/systemd: Add reloadTriggers to servicesJanne Heß2022-02-09
| | |
* | | nixos/switch-to-configuration: Implement reload supportJanne Heß2022-02-09
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is accomplished by comparing the hashes that the unit files contain. By filtering for a special key `X-Reload-Triggers` in the `[Unit]` section, we can differentiate between reloads and restarts. Since activation scripts can request reloads of units as well, more checking of this behaviour is implemented. If a unit is to be restarted, it's never reloaded as well which would make no sense. Also removes a useless subroutine and perl dependencies that are nowadays handled by the propagated build inputs feature of `perl.withPackages`.
* | | nixos/switch-to-configuration: Allow passing parsed unit contentsJanne Heß2022-02-09
| | |
* | | nixos/switch-to-configuration: Skip [Install] sectionJanne Heß2022-02-09
| |/ |/|
* | Merge pull request #157839 from abbradar/stage-1-modprobeJörg Thalheim2022-02-08
|\ \ | | | | | | Modprobe options in stage-1
| * | nixos/stage-1: add nixos modprobe optionsNikolay Amiantov2022-02-02
| | |
* | | Merge pull request #155892 from hercules-ci/nixos-etc-unit-testRobert Hensing2022-02-06
|\ \ \ | |/ / |/| | nixos: Refactor to allow `etc` unit test
| * | nixos/etc.nix: Make independentRobert Hensing2022-01-30
| | | | | | | | | | | | (cherry picked from commit 56c283e5c8dfd4d8d5daa15dfa3896beef2ac012)
* | | Merge pull request #141122 from Luflosi/add-apfs-nixos-moduleMaciej Krüger2022-02-01
|\ \ \ | |_|/ |/| |
| * | nixos/apfs: initLuflosi2022-01-27
| | | | | | | | | | | | Add the final missing pieces for full APFS support.
* | | Merge pull request #157053 from lheckemann/systemd-optional-cryptsetupGuillaume Girol2022-01-30
|\ \ \ | |_|/ |/| | nixos/systemd: only use cryptsetup units if systemd was built with it
| * | nixos/systemd: only use cryptsetup units if systemd was built with itLinus Heckemann2022-01-30
| | |
* | | Merge pull request #154809 from ↵Bernardo Meurer2022-01-27
|\ \ \ | |_|/ |/| | | | | | | | helsinki-systems/feat/stc-proper-unit-file-parser nixos/switch-to-configuration: Proper unit file parser and clean/fix lower part of the script
| * | nixos/switch-to-configuration: Clean up lower part of the scriptJanne Heß2022-01-20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Fully get rid of `parseKeyValues` and use systemctl features for that - Add some regex modifiers recommended by perlcritic - Get rid of a postfix if - Sort units when showing their status - Clean the logic for showing what failed from `elif` to `next` - Switch from `state` to `substate` for `auto-restart` because that's actually where the value is stored - Show status of units with one single systemctl call and get rid of COLUMNS in favor of --full - Add a test for failing units
| * | nixos/switch-to-configuration: Proper unit file parserJanne Heß2022-01-20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This replaces the naive K=V unit parser with a proper INI parser from a library and adds proper support for override files. Also adds a bunch of comments about parsing, I hope this makes it easier to understand and maintain in the future. There are multiple reasons to do so, the first one is just general correctness with is nice imo. But to get to more serious reasons (I didn't put in all that effort for nothing) is that this is the first step torwards more clever restart/reload handling. By using a library like Data::Compare a future PR could replace the current way of fingerprinting units (which is to compare store paths) by comparing the hashes. This is more precise because units won't get restarted because the order of the options change, comments are added, some dependency of writeText changes, .... Also this allows us to add a feature like `X-Reload-Triggers` so the unit can either be reloaded when these change or restarted when everything else changes, giving module authors the ability to have their services reloaded without having to fear that updates are not applied because the service doesn't get restarted. Another reason why this feature is nice is that now that the unit files are parsed correctly (and values are just extracted from one section), potential future rewrites can just rely on some INI library without having to implement their own weird parser that is compatible with this script. This also comes with a new subroutine to handle systemd booleans because I thought the current way of handling it was just ugly. This also allows overriding values this script reads in an override file. Apart from making this script more compatible with the world around it, this also fixes two issues I saw bugging exactly 0 (zero) people. First is that this script now supports multiple override files, also ones that are not called override.conf and the second one is that `1` and `on` are treated as bools by systemd but were previously not parsed as such by switch-to-configuration.
* | | nixos/nix-daemon: use structural settingspolykernel2022-01-26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The `nix.*` options, apart from options for setting up the daemon itself, currently provide a lot of setting mappings for the Nix daemon configuration. The scope of the mapping yields convience, but the line where an option is considered essential is blurry. For instance, the `extra-sandbox-paths` mapping is provided without its primary consumer, and the corresponding `sandbox-paths` option is also not mapped. The current system increases the maintenance burden as maintainers have to closely follow upstream changes. In this case, there are two state versions of Nix which have to be maintained collectively, with different options avaliable. This commit aims to following the standard outlined in RFC 42[1] to implement a structural setting pattern. The Nix configuration is encoded at its core as key-value pairs which maps nicely to attribute sets, making it feasible to express in the Nix language itself. Some existing options are kept such as `buildMachines` and `registry` which present a simplified interface to managing the respective settings. The interface is exposed as `nix.settings`. Legacy configurations are mapped to their corresponding options under `nix.settings` for backwards compatibility. Various options settings in other nixos modules and relevant tests have been updated to use structural setting for consistency. The generation and validation of the configration file has been modified to use `writeTextFile` instead of `runCommand` for clarity. Note that validation is now mandatory as strict checking of options has been pushed down to the derivation level due to freeformType consuming unmatched options. Furthermore, validation can not occur when cross-compiling due to current limitations. A new option `publicHostKey` was added to the `buildMachines` submodule corresponding to the base64 encoded public host key settings exposed in the builder syntax. The build machine generation was subsequently rewritten to use `concatStringsSep` for better performance by grouping concatenations. [1] - https://github.com/NixOS/rfcs/blob/master/rfcs/0042-config-option.md
* | | Merge remote-tracking branch 'origin/master' into staging-nextMartin Weinelt2022-01-25
|\ \ \
| * \ \ Merge pull request #156503 from hercules-ci/nixos-add-system.build-optionsRobert Hensing2022-01-25
| |\ \ \ | | |_|/ | |/| | nixos: Add `system.build.`{`toplevel`,`installBootLoader`}, improve error message
| | * | nixos: Explain system.build.installBootLoader's odd defaultRobert Hensing2022-01-24
| | | | | | | | | | | | | | | | | | | | I don't really approve of this solution, but documenting its purpose was the least I could do for now.
| | * | nixos: Make system.build.installBootLoader a proper optionRobert Hensing2022-01-24
| | | | | | | | | | | | | | | | | | | | This improves the error message when the configuration contains more than one boot loader.
| | * | nixos: Document system.build.toplevelRobert Hensing2022-01-24
| | | |
| | * | nixos: Make system.build a submodule with freeformTypeRobert Hensing2022-01-24
| | | | | | | | | | | | | | | | | | | | This allows the values below it to be specified as options, while remaining compatible with existing code.
| | * | nixos/system/build: ExtractRobert Hensing2022-01-24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Modules that do not depend on e.g. toplevel should not have to include it just to set things in `system.build`. As a general rule, this keeps tests simple, usage flexible and evaluation fast. While one module is insignificant, consistency and good practices are.
* | | | Merge master into staging-nextgithub-actions[bot]2022-01-25
|\| | |
| * | | nixos/modprobe: add boot.initrd.extraModprobeConfig optionLuflosi2022-01-24
| |/ / | | | | | | | | | | | | | | | | | | This option behaves exactly like `boot.extraModprobeConfig`, except that it also includes the generated modprobe.d file in the initrd. Many years ago, someone tried to include the normal modprobe.d/nixos.conf file generated by `boot.extraModprobeConfig` in the initrd: 0aa2c1dc46779a3df6c4e02d3fae39b0de297be8. This file contains a reference to a directory with firmware files inside. Including firmware in the initrd made it too big, so the commit was reverted again in 4a4c051a95b6b8da3a13d7955087e915e6dd4bf7. The `boot.extraModprobeConfig` option not changing the initrd caused me much confusion because I tried to set the maximum cache size for ZFS and it didn't work. Closes https://github.com/NixOS/nixpkgs/issues/25456.