Commit graph

274 commits

Author SHA1 Message Date
Daniel Nagy 095269c862
treewide: use types.port in nixos modules 2022-11-10 09:30:00 +01:00
oxalica 50eb816d29 nixos/btrbk: fix ordering of subsections and refactor 2022-10-24 08:52:25 +08:00
Thiago Kenji Okada b87716afc9
Merge pull request #188881 from shadaj/patch-4
nixos/restic: make it possible to use the existing backup cache for prune/check
2022-10-12 21:26:00 +01:00
Shadaj Laddad dd34f474ed nixos/restic: make it possible to use the existing backup cache for prune/check
Configures the `--cache-dir` parameter for the prune and check commands run after backing up. For `check`, also adds a `checkOpts` flag to enable using the cache, since that is disabled by default.
2022-10-12 09:09:27 -07:00
Artturin 6910a4eea0 treewide: makeWrapper to nativeBuildInputs
this should be all of them other than the failed splices
found with nixpkgs-lint
2022-09-26 17:53:26 +03:00
pennae 1d41cff3dc nixos/*: convert straggler options to MD 2022-08-31 17:27:38 +02:00
pennae f2ea09ecbe nixos/*: convert options with listings
minor rendering changes.
2022-08-31 17:27:36 +02:00
pennae 722b99bc0e nixos/*: convert options with admonitions to MD
rendering changes only slightly, most changes are in spacing.
2022-08-31 16:36:16 +02:00
pennae 515c4727fa nixos/*: md-"convert" empty descriptions
for some reason these are not picked up properly by nix-doc-munge, so
we'll do this instead.
2022-08-31 16:32:54 +02: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 1013069f52 nixos/*: convert more partially-md option descriptions
this mostly means marking options that use markdown already
appropriately and making a few adjustments so they still render
correctly. notable for nftables we have to transform the md links
because the manpage would not render them correctly otherwise.
2022-08-31 16:32:14 +02:00
Julien Moutinho 9a94509089 nixos/sanoid: fix aliased options
Fixes https://github.com/NixOS/nixpkgs/issues/181561
2022-08-22 18:56:47 +02:00
Jörg Thalheim 2c3f6055fb syncoid: handle syncing dataset without a parent 2022-08-16 06:18:54 +02:00
Sebastián Mancilla 10a745eac8
Merge pull request #179896 from erikarvstedt/fix-bash-exit-handler
treewide: fix bash exit handlers
2022-08-14 21:42:41 -04:00
pennae 50f9b3107a
Merge pull request #185474 from pennae/option-docs-md
nixos/*: more options md conversion
2022-08-12 23:23:26 +02:00
Thiago Kenji Okada 35348fcc07
Merge pull request #182831 from otavio/topic/use-postStop-for-restic
nixos/restic: use postStop for `backupCleanupCommand`
2022-08-09 18:39:42 +01:00
pennae 087472b1e5 nixos/*: automatically convert option docs 2022-08-06 20:39:12 +02:00
pennae 423545fe48 nixos/*: normalize manpage references to single-line form
now nix-doc-munge will not introduce whitespace changes when it replaces
manpage references with the MD equivalent.

no change to the manpage, changes to the HTML manual are whitespace only.
2022-08-05 18:34:50 +02:00
pennae 61e93df189 nixos/*: automatically convert option docs to MD
once again using nix-doc-munge (69d080323a)
2022-08-03 22:46:41 +02:00
pennae 3aebb4a2be nixos/*: normalize link format
make (almost) all links appear on only a single line, with no
unnecessary whitespace, using double quotes for attributes. this lets us
automatically convert them to markdown easily.

the few remaining links are extremely long link in a gnome module, we'll
come back to those at a later date.
2022-08-03 21:57:46 +02:00
pennae 9c8531c8a5 nixos/*: replace <replaceable>s with «thing»
we can't embed syntactic annotations of this kind in markdown code
blocks without yet another extension. replaceable is rare enough to make
this not much worth it, so we'll go with «thing» instead. the module
system already uses this format for its placeholder names in attrsOf
paths.
2022-08-03 21:08:58 +02:00
pennae 6b13dd0e9e
Merge pull request #183491 from pennae/automatic-md-conversions
treewide: automatically md-convert option descriptions
2022-08-02 02:15:30 +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
Alan Strohm 81cd3e229c
nixos/restic: add 'backups.package' option to override the restic package (#183028) 2022-07-27 13:47:41 -04:00
Otavio Salvador 7e8e00d656 nixos/restic: use postStop for backupCleanupCommand
That way the `backupCleanupCommand` can also run when the backup service
failed for some reason.

Fixes: #182089.
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
2022-07-25 11:53:01 -03:00
Sandro Jäckel af66b47b3a nixos/postgresql-backup: allow setting compression level 2022-07-11 21:28:22 +02:00
Shawn8901 98ac43a1cf
zrepl: add package option to module (#179189)
Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
2022-07-10 20:32:27 +02:00
Erik Arvstedt 3f54dfa475
treewide: fix bash exit handlers
Transform exit handlers of the form
trap cleanup EXIT [INT] [TERM] [QUIT] [HUP] [ERR]
  (where cleanup is idempotent)
to
trap cleanup EXIT

This fixes a common bash antipattern.

Each of the above signals causes the script to exit. For each signal,
bash first handles the signal by running `cleanup` and then runs
`cleanup` again when handling EXIT.
(Exception:  `vscode/*` prevents the second run of `cleanup` by removing
the trap in cleanup`).

Simplify the cleanup logic by just trapping exit, which is always run
when the script exits due to any of the above signals.

Note: In case of borgbackup, the exit handler is not idempotent, but just
trapping EXIT guarantees that it's only run once.
2022-07-02 16:13:12 +02:00
Otavio Salvador d9e3b1fafe nixos/restic: add backup{Prepare,Cleanup}Command options
The backupPrepareCommand and backupCleanupCommand options offer a way to
run a script to prepare for backup and then cleanup it once finish.

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
2022-06-03 11:22:22 -03:00
Otavio Salvador deae887c5a nixos/restic: add new repositoryFile option
Allow providing the repository as a file, useful when we don't want it
being stored in the Git repository as plain text.

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
2022-06-03 11:21:37 -03:00
Otavio Salvador 082a4184ec nixos/restic: reformat
Apply nixpkgs-fmt on file prior doing changes.

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
2022-06-02 16:48:43 -03:00
Guillaume Girol 4f709ea817
Merge pull request #164883 from oxalica/feat/btrbk-no-timer
nixos/btrbk: allow instances without timers and simplify
2022-05-21 20:04:54 +00:00
Daniel Poelzleithner 64878e3a67 automysqlbackp: fix missing permissions for mysqldump
automysqldump passes the --events flag, but without the EVENTS permission a error occures:
> mysqldump: Couldn't execute 'show events': Access denied for user 'automysqlbackup'@'localhost' to database 'mysql' (1044)
2022-05-12 13:17:14 +02:00
oxalica 085a5256c1
nixos/btrbk: inherit lib functions to simplify use-sites 2022-05-12 05:55:39 +08:00
oxalica 60e13131b6
nixos/btrbk: allow instances without timers
This allows btrbk instances without a triggering timer by setting
`onCalendar` to `null`.
This is useful for manual-starting only btrbk backup settings.
2022-05-12 05:55:17 +08:00
Robert Schütz 2ddfd7e81b nixos/borgmatic: use pkgs.formats.yaml 2022-05-08 01:08:28 -07:00
Matt Layher bb22a2debc nixos/zrepl: note about systemd unit, add snapshot test
Signed-off-by: Matt Layher <mdlayher@gmail.com>
2022-03-30 08:55:15 -07:00
Vlastimil Holer 09a6ce91d8
nixos/mysqlBackup: set service Type
fixes #158802

Sets the mysql backup systemd service type to "oneshot" to ensure the
service is marked as started after the backup script fully proceeds. This
allows to reliably depend on completing of this service by other services.
2022-02-18 18:35:55 +01:00
Naïm Favier 6565458f9d
nixos/borgbackup: remove literalDocBook in description 2022-01-20 20:10:26 +01:00
Sandro 5c4fa6964f
Merge pull request #138386 from Yarny0/tsm-client 2022-01-18 20:50:28 +01:00
Felix Buehler 7caa6f4de4 nixos/borgbackup: move systemd.timers logic into single block 2022-01-18 12:53:36 +01:00
Felix Buehler 91dfaa5453 nixos/borgbackup: start remote backup only if network is available 2022-01-17 15:42:39 +01:00
blargg 697198834c nixos/borgbackup: Add a persistentTimer option.
Persistent starts the backup service on power on if it was missed while
the system was powered down, for example.
2022-01-17 15:42:37 +01:00
Yarny0 c2192ed77a nixos/tsm-{client,backup}: use new type nonEmptyStr
The module option type `nonEmptyStr` was introduced in commit

a3c5f0cba8

The tsm modules previously simply used
`strMatching ".+"` to prevent empty option strings,
but the new type is more thorough as
it also catches space-only strings.
2022-01-17 12:09:27 +01:00
Yarny0 c5effcaaea nixos/tsm-backup: enable most systemd sandboxing options
This enables some systemd sandboxing
options for the `tsm-backup.service`.
Those settings have been determined by expermentation.
This commit tries hard to protect the filesystem from
write access, but not to hide anything from read access,
so users can backup all files they choose to backup.
An exception are API filesystems (`/dev`, `/proc`, `/sys`):
As their "files" are not stored on persistent storage,
they are sandboxed away as much as possible.

Note that the service still has to run with root
privileges to reach files with limited access permissions.
The obvious alternative to use a dedicated user account and
the `CAP_DAC_READ_SEARCH` capability to permit system-wide
read access while blocking write access does not work.
Experiments have shown that `dsmc` verifies access permissions
for each file before attempting to open it for reading.
Hence `dsmc` refuses to copy files where the file permission
mode blocks read access -- even if process capabilities
would allow it to proceed irrespective of permissions.
2022-01-17 12:09:27 +01:00
Yarny0 3f6d1f5f60 nixos/tsm-{client,backup}: update links in module comments
IBM has changed the URL structures of their support web pages.
The commit at hand updates URLs in two comments
so they follow the new structure.
2022-01-17 12:09:27 +01:00
Winter 2104608642 nixos/borgbackup: allow empty archive base name 2022-01-16 10:41:04 -05:00
Robert Hensing 70d27303da
Merge pull request #149532 from pennae/split-docs-build
nixos/*: split docs build
2022-01-04 22:33:23 +01:00
Aneesh Agrawal 8729e8e261 nixos/restic-rest-server: Autocreate empty .htpasswd if needed for service boot
When `privateRepos = true`, the service will not start if the `.htpasswd` does not exist.
Use `systemd-tmpfiles` to autocreate an (empty) file to ensure the service can boot
before actual `htpasswd` contents are registered.

This is safe as restic-rest-server will deny all entry if the file is empty.
2022-01-02 21:13:07 -05:00
pennae fc614c37c6 nixos/documentation: split options doc build
most modules can be evaluated for their documentation in a very
restricted environment that doesn't include all of nixpkgs. this
evaluation can then be cached and reused for subsequent builds, merging
only documentation that has changed into the cached set. since nixos
ships with a large number of modules of which only a few are used in any
given config this can save evaluation a huge percentage of nixos
options available in any given config.

in tests of this caching, despite having to copy most of nixos/, saves
about 80% of the time needed to build the system manual, or about two
second on the machine used for testing. build time for a full system
config shrank from 9.4s to 7.4s, while turning documentation off
entirely shortened the build to 7.1s.
2022-01-02 19:46:13 +01:00