Commit Graph

384 Commits

Author SHA1 Message Date
Domen Kožar
4e95cbe36e
Merge pull request #246081 from therealr5/bacula-fix
nixos/bacula: fix postgresql config and remove unneeded quotation marks
2023-10-23 21:42:11 +01:00
Bjørn Forsman
142074c2a8 nixos: fix bad mkEnableOption descriptions
Fix descriptions that don't account for (1) the "Whether to enable"
prefix or (2) the automatically added trailing dot.
2023-10-20 16:22:40 +01:00
imlonghao
4a519fa142
borgmatic: 1.7.15 -> 1.8.1 2023-10-10 21:48:13 +08:00
amesgen
bbf7f58b57
nixos/borgbackup: add package option
Co-authored-by: Lin Jian <me@linj.tech>
2023-10-07 16:27:57 +02:00
asymmetric
4a359e2106
Merge pull request #250810 from asonix/btrbk-fix-btrfs-path
nixos/btrbk: fix btrfs path for passwordless execution
2023-09-29 10:37:21 +02:00
asonix
a8c1811bf6 nixos/btrbk: fix btrfs path for passwordless execution 2023-09-28 14:51:19 -05:00
Janik
eda85eb31d
Merge pull request #251062 from ajs124/restic-wrapper-script 2023-09-09 19:11:33 +02:00
Weijia Wang
fdc0272b60
Merge pull request #249941 from FrancescoDeSimone/duplicati-service-fix
nixos/duplicati: add package option
2023-09-07 22:36:18 +02:00
ajs124
dbb69f82c6 nixos/restic: add wrapper scripts that set parameters for backup
and use in test
2023-08-28 15:17:37 +02:00
ajs124
4732cbf3f8 nixos/restic: use openssh as configured in programs.ssh 2023-08-28 15:03:12 +02:00
francescoDeSimone
42f0af4abe nixos/duplicati: add package option 2023-08-19 16:08:39 +02:00
Hugh O'Brien
a08d69ba63
nixos/restic: wait for network-online for timed backups 2023-08-18 20:02:16 -04:00
Robert Obryk
77bc27ccdb nixos/backups/restic: handle cases when both dynamicFileFrom and paths are set
Also, add a test to verify that it works.

This change also removes the part of custom package test that verifies
that the correct paths are provided. This is already tested by restore
tests.

Before this change, setting both paths and dynamicFileFrom would cause
paths to be silently ignored. Making that actually apply the obvious
interpretation seems to me to be strictly better than prohibiting the
two from being set at the same time.
2023-08-16 11:25:15 +02:00
Rouven Seifert
b12923631d
nixos/bacula: fix postgresql config and remove unneeded quotation marks
The module falsely disabled postgresql completely when the bacula-sd was not enabled.
Quotation marks are not necessary and only useful in `name` fields.
2023-07-29 19:28:27 +02:00
Sandro
9ca0bd9db3
Merge pull request #244467 from wamserma/tarsnap-add-package-option
tarsnap: add package option
2023-07-24 00:46:24 +02:00
Felix Bühler
0a2745684e
Merge pull request #239624 from Stunkymonkey/use-optionalString-then
treewide: use optionalString instead of 'then ""'
2023-07-22 13:02:47 +02:00
Markus S. Wamser
a936b9edec tarsnap: add package option 2023-07-21 11:37:15 +02:00
Felix Buehler
933a41a73f treewide: use optional instead of 'then []' 2023-06-25 09:11:40 -03:00
Felix Buehler
f3719756b5 treewide: use optionalString instead of 'then ""' 2023-06-24 20:19:19 +02:00
Janik H
95e1099d2a restic: add persistent default for timer unit 2023-05-15 15:16:58 +02:00
Sophie Tauchert
8af23590d3 nixos/borgbackup: fix extraCompactArgs
Fixes the extraCompactArgs introduced with #224072 as the variable
currently isn't added to the script's environment.
2023-05-14 16:51:24 +02:00
Aaron Andersen
55b3b7029d nixos/automysqlbackup: rename config option to settings 2023-05-10 20:00:09 -04:00
Aaron Andersen
a73e7383c0 nixos/automysqlbackup: add some missing permissions 2023-05-10 19:57:48 -04:00
Elias Probst
3bd1c64a5b
nixos/restic: use private tmp for service unit
To reduce the danger of accidentally exposing sensitive files processed
by a restic backup to other services/users, enable the `PrivateTmp=`
feature of restic service units, which provides a per service isolation
of `/tmp` and `/var/tmp`.

Co-authored-by: Daniel Nagy <danielnagy@posteo.de>
2023-04-30 10:39:29 +02:00
Artturi
b83db86a9e
Merge pull request #222080 from Stunkymonkey/nixos-optionalString 2023-04-20 16:07:30 +03:00
imlonghao
bc07f0ac31
borgmatic: fix timer wantedBy 2023-04-17 23:10:23 +08:00
ajs124
d37ee8222b nixos/borgbackup: run compact after prune 2023-04-11 19:48:16 +02:00
Felix Buehler
327b0cff7a treewide: use more lib.optionalString 2023-04-07 13:38:33 +02:00
Ilan Joselevich
003c2e3957
Merge pull request #221964 from randomnetcat/sanoid-service-package
sanoid/syncoid: Add package options
2023-03-30 23:33:53 +03:00
Janet Cobb
1033d0f6ac (nixos/sanoid, nixos/syncoid): Add package options
Allows changing the sanoid package to be used for these services.
2023-03-29 17:23:51 -04:00
Lassulus
3839340fdb
Merge pull request #220656 from oxzi/restic-cache-fix
nixos/restic: generalize cache configuration
2023-03-22 00:37:46 +07:00
Jonas Heinrich
161a1ca129
Merge pull request #191974 from tu-maurice/btrbk-doas
btrbk: Use sudo or doas based on configuration
2023-03-11 16:10:50 +01:00
Alvar Penning
adafbeff4a nixos/restic: generalize cache configuration
The restic repository cache location defaults to ~/.cache/restic when
not overwritten either by the --cache-dir command line parameter or the
universal RESTIC_CACHE_DIR environment variable.

Currently, the --cache-dir variable is set to only some restic commands,
but, e.g., not to the unit's preStart command for the module's
initialize option. This results in two distinct cache locations, one at
~/.cache/restic for the initialize commands and one at the configured
--cache-dir location for the restic backup command.

By explicitly setting RESTIC_CACHE_DIR for the unit, only one cache at
the correct location will be used.

https://restic.readthedocs.io/en/v0.15.1/manual_rest.html#caching
2023-03-11 12:59:10 +01:00
Ryan Lahfa
fd09c1bdc5
Merge pull request #214759 from Tom-Hubrecht/borgmatic
nixos/borgmatic: Allow defining multiple configurations
2023-03-04 11:38:39 +01:00
Joachim Breitner
20c135b191 docs: borg expects --rsh, not -rsh 2023-02-20 18:02:28 +01:00
Tom Hubrecht
919f2b2b62 nixos/borgmatic: Allow defining multiple configurations 2023-02-12 19:12:34 +01:00
pennae
bf4c0c1900 nixos/*: remove trailing period in mkEnableOptions
those are added by mkEnableOption, and .. is replaced to … by markdown
processing.
2023-02-08 15:23:34 +01:00
pennae
0a6e6cf7e6 nixos/manual: render module chapters with nixos-render-docs
this converts meta.doc into an md pointer, not an xml pointer. since we
no longer need xml for manual chapters we can also remove support for
manual chapters from md-to-db.sh

since pandoc converts smart quotes to docbook quote elements and our
nixos-render-docs does not we lose this distinction in the rendered
output. that's probably not that bad, our stylesheet didn't make use of
this anyway (and pre-23.05 versions of the chapters didn't use quote
elements either).

also updates the nixpkgs manual to clarify that option docs support all
extensions (although it doesn't support headings at all, so heading
anchors don't work by extension).
2023-01-27 20:07:34 +01:00
Nick Cao
99f9998309
Merge pull request #204386 from robryk/resticassert
nixos/restic: small enhancements
2023-01-22 16:23:04 +08:00
Robert Obryk
9dbdb05924 nixos/restic: add exclude parameter
This provides an easy way to specify exclude patterns in config. It was
already possible via extraBackupOptions; this change creates a simpler,
similar to other backup services, way to specify them.
2023-01-11 00:06:13 +01:00
Robert Obryk
751b9063a7 nixos/restic: assert that repository name is specified 2023-01-11 00:06:08 +01:00
pennae
53fc887582 nixos/manual: move "edit the MD file" comments to generated XML 2023-01-10 12:34:37 +01:00
pennae
bf92eaebe4 nixos/manual: generate module chapters with md-to-db.sh 2023-01-10 10:32:00 +01:00
pennae
23ea73b416 nixos/manual: enable smart quotes for all MD chapters 2023-01-10 10:31:59 +01:00
pennae
1ce4fde27b nixos/borgbackup: convert manual chapter to MD 2023-01-10 10:31:54 +01:00
pennae
90c61bc706 nixos/manual: normalize <screen>
as with program listings, the leading/trailing newlines do not affect
rendering but make markdown translation easier.
2023-01-10 10:31:53 +01:00
pennae
22144ba269 nixos/manual: normalize <package> -> <literal>
markdown can only do <literal>, so normalize to that. without
auto-linking to a package index the distinction is not very useful anyway.
2023-01-10 10:31:52 +01:00
pennae
d60f02b753 nixos/manual: normalize <code> -> <literal>
markdown can only translate to <literal>, so normalize to that or to
other more appropriate tags.
2023-01-10 10:31:52 +01:00
pennae
0715ecf936 nixos/manual: normalize <programlisting>
makes sure that program listing tags are separated from their contents
by exactly a newline character. this makes the markdown translation
easier to verify (since no new newlines need to be inserted), and
there's no rendering difference anyway.
2023-01-10 10:31:52 +01:00
Naïm Favier
4fb500d629
nixos/doc: fix some manpage references 2023-01-03 14:03:35 +01:00
Bjørn Forsman
0f0929f4aa nixos/borgbackup: fix ~/.cache, ~/.config ownership
Invoke `install` separately for each directory to get ownership right --
i.e. not always owned by root. When owned by root, user sessions break
as no user processes are allowed to create directores there. On normal
systems the directories already exist, but in clean environments / NixOS
test VMs, the bug shows.

Before:
  $ namei -l /home/user1/.cache/borg
  f: /home/user1/.cache/borg
  drwxr-xr-x root  root  /
  drwxr-xr-x root  root  home
  drwx------ user1 users user1
  drwxr-xr-x root  root  .cache
  drwxr-xr-x user1 users borg

After:
  $ namei -l /home/user1/.cache/borg
  f: /home/user1/.cache/borg
  drwxr-xr-x root  root  /
  drwxr-xr-x root  root  home
  drwx------ user1 users user1
  drwxr-xr-x user1 users .cache
  drwxr-xr-x user1 users borg
2022-12-28 13:07:16 +01:00
figsoda
6bb0dbf91f nixos: fix typos 2022-12-17 19:31:14 -05:00
Naïm Favier
723eb8d9b8
Merge pull request #205479 from IzumiRaine/borgbackup-patterns 2022-12-17 17:00:02 +01:00
Ryan Lahfa
4428f9f5e9
Merge pull request #198239 from jacobgreenleaf/jacobg-borg-inhibit
nixos/borgbackup: Add option for inhibiting sleep
2022-12-17 00:45:10 +01:00
Izumi Raine
cb4547a433 nixos/borgbackup: add option "patterns" 2022-12-10 16:49:34 +01:00
Naïm Favier
75e0609a00
nixos/borgbackup: fix newline escaping with optional arguments
The newline must always be escaped, otherwise `extraPruneArgs` will be treated as a separate command if `prune.prefix` is unset.
2022-12-10 16:46:34 +01:00
Bjørn Forsman
bbcfd192a8 nixos/borgbackup: change --prefix to --glob-archives
Fixes warning from `borg prune`:

  Warning: "--prefix" has been deprecated. Use "--glob-archives 'yourprefix*'" (-a) instead.
2022-12-07 02:24:00 +01:00
Yoan Tournade
4c915f1d1a Add BORG_RSH entry under an environment option 2022-12-07 01:00:59 +01:00
Jacob Greenleaf
0111e9547e nixos/borgbackup: Add option for inhibiting sleep
Adds a new option for backup jobs `inhibitsSleep` which prevents
the system from going to sleep while a backup is in progress.
Uses `systemd-inhibit`, which holds a "lock" that prevents the
system from sleeping while the process it invokes is running.

This did require wrapping the existing backup script using
`writeShellScript` so that it could be run by `systemd-inhibit`.
2022-12-04 19:57:41 -08:00
tu-maurice
00ae655e63 btrbk: Use sudo or doas based on configuration 2022-11-19 23:16:57 +01:00
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