summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--krebs/3modules/backup.nix22
-rw-r--r--krebs/3modules/tv/default.nix1
-rw-r--r--krebs/4lib/types.nix4
-rw-r--r--krebs/5pkgs/get/default.nix6
-rw-r--r--tv/1systems/nomic.nix2
-rw-r--r--tv/2configs/backup.nix40
-rw-r--r--tv/2configs/default.nix9
-rw-r--r--tv/2configs/pulse.nix32
-rw-r--r--tv/2configs/xserver/default.nix1
9 files changed, 62 insertions, 55 deletions
diff --git a/krebs/3modules/backup.nix b/krebs/3modules/backup.nix
index 01bb16a2b..a1f335905 100644
--- a/krebs/3modules/backup.nix
+++ b/krebs/3modules/backup.nix
@@ -28,9 +28,17 @@ let
type = types.krebs.file-location;
};
startAt = mkOption {
- type = types.str;
+ default = "hourly";
+ type = types.str; # TODO systemd.time(7)'s calendar event
};
snapshots = mkOption {
+ default = {
+ hourly = { format = "%Y-%m-%dT%H"; retain = 4; };
+ daily = { format = "%Y-%m-%d"; retain = 7; };
+ weekly = { format = "%YW%W"; retain = 4; };
+ monthly = { format = "%Y-%m"; retain = 12; };
+ yearly = { format = "%Y"; };
+ };
type = types.attrsOf (types.submodule {
options = {
format = mkOption {
@@ -284,3 +292,15 @@ let
};
in out
+# TODO ionice
+# TODO mail on failed push, pull
+# TODO mail on missing push
+# TODO don't cancel plans on activation
+# also, don't hang while deploying at:
+# starting the following units: backup.wu-home-xu.push.service, backup.wu-home-xu.push.timer
+# TODO make sure /bku is properly mounted
+# TODO make sure that secure hosts cannot backup to insecure ones
+# TODO optionally only backup when src and dst are near enough :)
+# TODO try using btrfs for snapshots (configurable)
+# TODO warn if partial snapshots are found
+# TODO warn if unknown stuff is found in dst path
diff --git a/krebs/3modules/tv/default.nix b/krebs/3modules/tv/default.nix
index 6fd1c4224..31c1a375a 100644
--- a/krebs/3modules/tv/default.nix
+++ b/krebs/3modules/tv/default.nix
@@ -247,6 +247,7 @@ with lib;
};
};
secure = true;
+ ssh.privkey.path = <secrets/ssh.id_ed25519>;
ssh.pubkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIcJvu8JDVzObLUtlAQg9qVugthKSfitwCljuJ5liyHa";
};
xu = {
diff --git a/krebs/4lib/types.nix b/krebs/4lib/types.nix
index 81ce659bd..c596d0f9d 100644
--- a/krebs/4lib/types.nix
+++ b/krebs/4lib/types.nix
@@ -164,10 +164,6 @@ types // rec {
pubkey = mkOption {
type = str;
};
- pubkeys = mkOption {
- type = attrsOf str;
- default = {};
- };
};
};
diff --git a/krebs/5pkgs/get/default.nix b/krebs/5pkgs/get/default.nix
index 9a0192aab..13cdeca96 100644
--- a/krebs/5pkgs/get/default.nix
+++ b/krebs/5pkgs/get/default.nix
@@ -1,12 +1,12 @@
{ coreutils, gnugrep, gnused, fetchgit, jq, nix, stdenv, ... }:
stdenv.mkDerivation {
- name = "get-1.3.1";
+ name = "get-1.4.0";
src = fetchgit {
url = http://cgit.cd.krebsco.de/get;
- rev = "64c97edd3f9952cd5e703208c46748a035a515bf";
- sha256 = "32ca83f4fd86fd3285bef9dcfd0917308086d239189858daceca175de49ff97c";
+ rev = "08757d47c480c130d69270855c6c0371f6b7d385";
+ sha256 = "7c609e2cde7a071bbf62241a7bea60313fdbf076b9f7b3d97226417e13e5ba9d";
};
phases = [
diff --git a/tv/1systems/nomic.nix b/tv/1systems/nomic.nix
index 0c6c935a3..7bc7b70d2 100644
--- a/tv/1systems/nomic.nix
+++ b/tv/1systems/nomic.nix
@@ -11,6 +11,8 @@ with lib;
../2configs/hw/AO753.nix
#../2configs/consul-server.nix
../2configs/git.nix
+ ../2configs/pulse.nix
+ ../2configs/xserver
{
tv.iptables = {
enable = true;
diff --git a/tv/2configs/backup.nix b/tv/2configs/backup.nix
index 51d3bb8a7..ce937a744 100644
--- a/tv/2configs/backup.nix
+++ b/tv/2configs/backup.nix
@@ -2,41 +2,17 @@
with lib;
{
krebs.backup.plans = addNames {
- xu-test-cd = {
+ wu-home-xu = {
method = "push";
-
- src = { host = config.krebs.hosts.xu; path = "/tmp/xu-test"; };
- dst = { host = config.krebs.hosts.cd; path = "/tmp/backups/xu-test"; };
-
- #startAt = "0,6,12,18:00";
- startAt = "minutely";
+ src = { host = config.krebs.hosts.wu; path = "/home"; };
+ dst = { host = config.krebs.hosts.xu; path = "/bku/wu-home"; };
+ startAt = "05:00";
snapshots = {
- minutely = { format = "%Y-%m-%dT%H:%M"; retain = 5; };
- hourly = { format = "%Y-%m-%dT%H"; retain = 4; };
- daily = { format = "%Y-%m-%d"; retain = 7; };
- weekly = { format = "%YW%W"; retain = 4; };
- monthly = { format = "%Y-%m"; retain = 12; };
- yearly = { format = "%Y"; };
+ daily = { format = "%Y-%m-%d"; retain = 7; };
+ weekly = { format = "%YW%W"; retain = 4; };
+ monthly = { format = "%Y-%m"; retain = 12; };
+ yearly = { format = "%Y"; };
};
};
- #xu-test-wu = {
- # method = "push";
- # dst = { user = tv; host = wu; path = "/krebs/backup/xu-test"; };
- #};
- cd-test-xu = {
- method = "pull";
- src = { host = config.krebs.hosts.cd; path = "/tmp/cd-test"; };
- dst = { host = config.krebs.hosts.xu; path = "/tmp/backups/cd-test"; };
- startAt = "minutely";
- snapshots = {
- minutely = { format = "%Y-%m-%dT%H:%M"; retain = 5; };
- hourly = { format = "%Y-%m-%dT%H"; retain = 4; };
- daily = { format = "%Y-%m-%d"; retain = 7; };
- weekly = { format = "%YW%W"; retain = 4; };
- monthly = { format = "%Y-%m"; retain = 12; };
- yearly = { format = "%Y"; };
- };
- };
-
};
}
diff --git a/tv/2configs/default.nix b/tv/2configs/default.nix
index c300633bb..d3a1778f0 100644
--- a/tv/2configs/default.nix
+++ b/tv/2configs/default.nix
@@ -11,7 +11,7 @@ with lib;
source = {
git.nixpkgs = {
url = mkDefault https://github.com/NixOS/nixpkgs;
- rev = mkDefault "c44a593aa43bba6a0708f6f36065a514a5110613";
+ rev = mkDefault "b7ff0301d6f26bd8419e888fd0e129f3dc8bd328";
target-path = mkDefault "/var/src/nixpkgs";
};
dir.secrets = {
@@ -142,7 +142,12 @@ with lib;
'';
};
- programs.ssh.startAgent = false;
+ programs.ssh = {
+ extraConfig = ''
+ UseRoaming no
+ '';
+ startAgent = false;
+ };
}
{
diff --git a/tv/2configs/pulse.nix b/tv/2configs/pulse.nix
index 3db3532d5..e1894ca64 100644
--- a/tv/2configs/pulse.nix
+++ b/tv/2configs/pulse.nix
@@ -1,5 +1,6 @@
{ config, lib, pkgs, ... }:
+with lib;
let
pkg = pkgs.pulseaudioLight;
runDir = "/run/pulse";
@@ -35,36 +36,43 @@ let
in
{
- systemd.tmpfiles.rules = [
- "d ${runDir} 0750 pulse pulse - -"
- "d ${runDir}/home 0700 pulse pulse - -"
- ];
-
- system.activationScripts.pulseaudio-hack = ''
- ln -fns ${clientConf} /etc/pulse/client.conf
- '';
-
environment = {
etc = {
"asound.conf".source = alsaConf;
- #"pulse/client.conf" = lib.mkForce { source = clientConf; };
+ # XXX mkForce is not strong enough (and neither is mkOverride) to create
+ # /etc/pulse/client.conf, see pulseaudio-hack below for a solution.
+ #"pulse/client.conf" = mkForce { source = clientConf; };
+ #"pulse/client.conf".source = mkForce clientConf;
"pulse/default.pa".source = configFile;
};
- systemPackages = [ pkg ];
+ systemPackages = [
+ pkg
+ ] ++ optionals config.services.xserver.enable [
+ pkgs.pavucontrol
+ ];
};
# Allow PulseAudio to get realtime priority using rtkit.
security.rtkit.enable = true;
+ system.activationScripts.pulseaudio-hack = ''
+ ln -fns ${clientConf} /etc/pulse/client.conf
+ '';
+
systemd.services.pulse = {
wantedBy = [ "sound.target" ];
before = [ "sound.target" ];
environment = {
PULSE_RUNTIME_PATH = "${runDir}/home";
- #DISPLAY = ":${toString config.services.xserver.display}";
};
serviceConfig = {
ExecStart = "${pkg}/bin/pulseaudio";
+ ExecStartPre = pkgs.writeScript "pulse-start" ''
+ #! /bin/sh
+ install -o pulse -g pulse -m 0750 -d ${runDir}
+ install -o pulse -g pulse -m 0700 -d ${runDir}/home
+ '';
+ PermissionsStartOnly = "true";
User = "pulse";
};
};
diff --git a/tv/2configs/xserver/default.nix b/tv/2configs/xserver/default.nix
index facde4e76..5cd17aa1d 100644
--- a/tv/2configs/xserver/default.nix
+++ b/tv/2configs/xserver/default.nix
@@ -37,7 +37,6 @@ let
pkgs.ff
pkgs.gitAndTools.qgit
pkgs.mpv
- pkgs.pavucontrol
pkgs.slock
pkgs.sxiv
pkgs.xsel