about summary refs log tree commit diff
path: root/nixos/lib/utils.nix
AgeCommit message (Collapse)AuthorFilesLines
2022-12-15lib.replaceChars: warn about being a deprecated aliasArtturin1-3/+3
replaceStrings has been in nix since 2015(nix 1.10) so it is safe to remove the fallback https://github.com/nixos/nix/commit/d6d5885c1567454754a0d260521bafa0bd5e7fdb
2022-12-03Revert "nixos/lib: add /home to pathsNeededForBoot"Artturi1-1/+1
2022-12-01nixos/lib: add /home to pathsNeededForBootLin Jian1-1/+1
Before this patch, if we: 1. add a new user in the config, 2. mount /home seperately, 3. not set neededForBoot for /home, 4. and run `nixos-rebuild boot`, the newly added user's home will not be created after a reboot. This is because when nixos/modules/config/update-users-groups.pl is running in stage 2 to setup users, /home is not mounted. This patch fixes this issue.
2022-10-20nixos/lib.escapeSystemdPath: Implement the correct algorithm for escaping ↵Daniel Olsen1-5/+13
names in systemd units Co-authored-by: ajs124 <git@ajs124.de>
2022-10-09genJqSecretsReplacementSnippet: Allow dots in attribute names...talyz1-5/+9
...and escape quotation marks and backslashes.
2022-04-28nixos: Fix up systemd shutdown ramfsWill Fancher1-1/+1
2022-04-11nixos/utils: move removePackagesByName to here from gnomeSandro Jäckel1-0/+16
2022-03-21nixos: systemd: Split unit types into separate moduleWill Fancher1-0/+1
2022-03-13Merge pull request #154113 from pennae/systemd-escapingpennae1-0/+20
nixos: add functions and documentation for escaping systemd Exec* directives
2022-03-12nixos: add functions and documentation for escaping systemd Exec* directivespennae1-0/+20
it's really easy to accidentally write the wrong systemd Exec* directive, ones that works most of the time but fails when users include systemd metacharacters in arguments that are interpolated into an Exec* directive. add a few functions analogous to escapeShellArg{,s} and some documentation on how and when to use them.
2022-02-23genJqSecretsReplacementSnippet: Fix error handlingtalyz1-2/+3
With the previous change that enabled error propagation through `inherit_errexit`, the script would fail if `errexit` was set, but `inherit_errexit` was not. This is due to `shopt -p` exiting with an error if the option is disabled. To work around this, use the exit code instead of the text value returned by `shopt -p`. Fixes #160869.
2022-01-31genJqSecretsReplacementSnippet: Propagate secret file read errorstalyz1-1/+8
If an error occurs while trying to read a secret file, we want that error to propagate to the main shell context. That means we have to set the `inherit_errexit` option, which allows errors from subshells to propagate to the outer shell. Also, the subshell cannot run as part of another command, such as `export`, since that will simply ignore the subshell exit status and only respect `export`s exit status; first assigning the value to a variable and then exporting it solves issue.
2021-11-20Move systemd-lib.nix and systemd-unit-options.nix into utilsWill Fancher1-1/+6
2021-11-15nixos/lib: add /usr to pathsNeededForBootArtturin1-1/+1
if /usr is split from root then it has to be mounted at boot See https://github.com/NixOS/nixpkgs/issues/146115
2021-10-07Merge pull request #112823 from deviant/nixos-boot-pathsKim Lindberger1-1/+1
nixos/boot: add /var/lib/nixos to pathsNeededForBoot
2021-08-15treewide: runCommandNoCC -> runCommandRobert Hensing1-1/+1
This has been synonymous for ~5y.
2021-06-18nixos/lib: Handle null `device` correctlyjakobrs1-1/+1
2021-06-08nixos/lib, nixos/filesystems: Make fsBefore more stable, and add `depends` ↵jakobrs1-2/+24
option
2021-02-11nixos/boot: add /var/lib/nixos to pathsNeededForBootV1-1/+1
/var/lib/nixos is used by update-users-groups.pl in the activation script for storing uid/gid mappings. If this has its own mountpoint (as is the case in some setups with fine-grained bind mounts pointing into persistent storage), the mappings are written to /var/lib, /var, or /. These may be backed by a tmpfs or (otherwise ephemeral storage), resulting in the mappings not persisting between reboots.
2020-09-24nixos/{containers,cri-o,podman}: move copyFile to nixos/lib/utilszowoq1-0/+5
2020-07-29nixos/boot: some documentation improvementsKeshav Kini1-3/+5
- Give a more accurate description of how fileSystems.<name/>.neededForBoot works - Give a more detailed description of how fileSystems.<name/>.encrypted.keyFile works
2020-03-14nixos/lib: use removePrefix in escapeSystemdPathflorianjacob1-1/+1
2019-09-08nixos/lib/utils: Make the set recursive again, unbreak evalSarah Brofeldt1-1/+1
2019-09-07Merge pull request #66274 from talyz/gitlabFlorian Klink1-0/+112
nixos/gitlab: Add support for secure secrets and more
2019-09-06nixos/utils: Handle arbitrary secrets in JSON output filestalyz1-0/+112
Introduce new functions which allows modules to define options where, if the input is an attrset and the output is JSON, the user can define arbitrary secrets.
2019-08-28treewide: remove redundant recvolth1-1/+1
2018-12-24fix infinite recursion caused by the unnecessary inspection of options + fix ↵msteen1-3/+2
is parent of mount point check (#51541)
2016-08-23nixos: generalize copy-paste from stage-1 and zfs to utilsJan Malakhovski1-0/+4
2016-08-23nixos: apply toposort to fileSystems to support bind and move mountsJan Malakhovski1-0/+5
And use new `config.system.build.fileSystems` property everywhere.
2016-07-04nixos: throw an error on invalid shell packagezimbatm1-0/+2
All shell packages must export the shellPath passthru
2016-06-12Use shell packages to select the user's shellzimbatm1-0/+6
The string type is still available for backward-compatiblity.
2014-09-03nixos/utils: Don't remove first character if not a /William A. Kennington III1-1/+2
2013-10-10Move all of NixOS to nixos/ in preparation of the repository mergeEelco Dolstra1-0/+10