summaryrefslogtreecommitdiffstats
path: root/lass/3modules
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2021-11-24 08:27:30 +0100
committermakefu <github@syntax-fehler.de>2021-11-24 08:27:30 +0100
commitd2776a87a51bbc63957ee2e590f18a7425a87987 (patch)
tree7052993633e46defc64737aff54d0272a8ce75c1 /lass/3modules
parent60b7a7bded68ebd3a5d76b6e0374e189f3a64300 (diff)
parent4c7abec39771cbd47dc091c674a0429f5c757ebc (diff)
Merge remote-tracking branch 'lass/master'
Diffstat (limited to 'lass/3modules')
-rw-r--r--lass/3modules/default.nix1
-rw-r--r--lass/3modules/restic.nix119
-rw-r--r--lass/3modules/xjail.nix1
3 files changed, 1 insertions, 120 deletions
diff --git a/lass/3modules/default.nix b/lass/3modules/default.nix
index 1ce88b238..570bb45be 100644
--- a/lass/3modules/default.nix
+++ b/lass/3modules/default.nix
@@ -9,7 +9,6 @@ _:
./news.nix
./nichtparasoup.nix
./pyload.nix
- ./restic.nix
./screenlock.nix
./usershadow.nix
./xjail.nix
diff --git a/lass/3modules/restic.nix b/lass/3modules/restic.nix
deleted file mode 100644
index c720793b1..000000000
--- a/lass/3modules/restic.nix
+++ /dev/null
@@ -1,119 +0,0 @@
-{ config, lib, pkgs, ... }:
-
-with import <stockholm/lib>;
-
-{
- options.lass.restic = mkOption {
- type = types.attrsOf (types.submodule ({ config, ... }: {
- options = {
- name = mkOption {
- type = types.str;
- default = config._module.args.name;
- };
- passwordFile = mkOption {
- type = types.str;
- default = toString <secrets/restic-password>;
- description = ''
- read the repository password from a file.
- '';
- example = "/etc/nixos/restic-password";
-
- };
- repo = mkOption {
- type = types.str;
- default = "sftp:backup@prism.r:/backups/${config.name}";
- description = ''
- repository to backup to.
- '';
- example = "sftp:backup@192.168.1.100:/backups/${config.name}";
- };
- dirs = mkOption {
- type = types.listOf types.str;
- default = [];
- description = ''
- which directories to backup.
- '';
- example = [
- "/var/lib/postgresql"
- "/home/user/backup"
- ];
- };
- timerConfig = mkOption {
- type = types.attrsOf types.str;
- default = {
- OnCalendar = "daily";
- };
- description = ''
- When to run the backup. See man systemd.timer for details.
- '';
- example = {
- OnCalendar = "00:05";
- RandomizedDelaySec = "5h";
- };
- };
- user = mkOption {
- type = types.str;
- default = "root";
- description = ''
- As which user the backup should run.
- '';
- example = "postgresql";
- };
- extraArguments = mkOption {
- type = types.listOf types.str;
- default = [];
- description = ''
- Extra arguments to append to the restic command.
- '';
- example = [
- "sftp.command='ssh backup@192.168.1.100 -i /home/user/.ssh/id_rsa -s sftp"
- ];
- };
- initialize = mkOption {
- type = types.bool;
- default = false;
- description = ''
- Create the repository if it doesn't exist.
- '';
- };
- };
- }));
- default = {};
- };
-
- config = {
- systemd.services =
- mapAttrs' (_: plan:
- let
- extraArguments = concatMapStringsSep " " (arg: "-o ${arg}") plan.extraArguments;
- connectTo = elemAt (splitString ":" plan.repo) 1;
- resticCmd = "${pkgs.restic}/bin/restic ${extraArguments}";
- in nameValuePair "backup.${plan.name}" {
- environment = {
- RESTIC_PASSWORD_FILE = plan.passwordFile;
- RESTIC_REPOSITORY = plan.repo;
- };
- path = with pkgs; [
- openssh
- ];
- restartIfChanged = false;
- serviceConfig = {
- ExecStartPre = mkIf plan.initialize (pkgs.writeScript "rustic-${plan.name}-init" ''
- #! ${pkgs.bash}/bin/bash
- ${resticCmd} snapshots || ${resticCmd} init
- '');
- ExecStart = pkgs.writeDash "rustic-${plan.name}" (
- "#! ${pkgs.bash}/bin/bash\n" +
- concatMapStringsSep "\n" (dir: "${resticCmd} backup ${dir}") plan.dirs
- );
- User = plan.user;
- };
- }
- ) config.lass.restic;
- systemd.timers =
- mapAttrs' (_: plan: nameValuePair "backup.${plan.name}" {
- wantedBy = [ "timers.target" ];
- timerConfig = plan.timerConfig;
- }) config.lass.restic;
- };
-}
diff --git a/lass/3modules/xjail.nix b/lass/3modules/xjail.nix
index 526e12db7..f94e7ebbf 100644
--- a/lass/3modules/xjail.nix
+++ b/lass/3modules/xjail.nix
@@ -48,6 +48,7 @@ with import <stockholm/lib>;
wm = mkOption {
#TODO find type
type = types.str;
+ defaultText = "‹script›";
default = "${pkgs.writeHaskellPackage "xephyrify-xmonad" {
executables.xmonad = {
extra-depends = [