summaryrefslogtreecommitdiffstats
path: root/lass/3modules
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2019-01-16 11:20:14 +0100
committertv <tv@krebsco.de>2019-01-16 11:20:14 +0100
commit6cef97deb3a96731a4737f05513e2e5855f60685 (patch)
treec21b0eef944b80adecb7d95aa79ba4a475ef6dd1 /lass/3modules
parent2d2ab95f0707209c4c248d43cb57877a50a37991 (diff)
parenta1d9c22bbd8eff9198f378e9007ddf4cb9ee2e5c (diff)
Merge remote-tracking branch 'prism/master'
Diffstat (limited to 'lass/3modules')
-rw-r--r--lass/3modules/default.nix1
-rw-r--r--lass/3modules/mysql-backup.nix16
-rw-r--r--lass/3modules/xserver/default.nix103
-rw-r--r--lass/3modules/xserver/xserver.conf.nix40
4 files changed, 8 insertions, 152 deletions
diff --git a/lass/3modules/default.nix b/lass/3modules/default.nix
index 2cf6a66b9..613c7c8ac 100644
--- a/lass/3modules/default.nix
+++ b/lass/3modules/default.nix
@@ -14,6 +14,5 @@ _:
./umts.nix
./usershadow.nix
./xjail.nix
- ./xserver
];
}
diff --git a/lass/3modules/mysql-backup.nix b/lass/3modules/mysql-backup.nix
index d2ae67171..516f96c34 100644
--- a/lass/3modules/mysql-backup.nix
+++ b/lass/3modules/mysql-backup.nix
@@ -41,7 +41,7 @@ let
};
location = mkOption {
type = str;
- default = "/bku/sql_dumps";
+ default = "/backups/sql_dumps";
};
};
}));
@@ -51,11 +51,9 @@ let
imp = {
- #systemd.timers =
- # mapAttrs (_: plan: {
- # wantedBy = [ "timers.target" ];
- # timerConfig = plan.timerConfig;
- #}) cfg.config;
+ services.mysql.ensureUsers = [
+ { ensurePermissions = { "*.*" = "ALL"; }; name = "root"; }
+ ];
systemd.services =
mapAttrs' (_: plan: nameValuePair "mysqlBackup-${plan.name}" {
@@ -75,8 +73,10 @@ let
start = plan: let
- backupScript = plan: db:
- "mysqldump -u ${plan.user} ${optionalString (plan.password != null) "-p$(cat ${plan.password})"} ${db} | gzip -c > ${plan.location}/${db}.gz";
+ backupScript = plan: db: ''
+ mkdir -p ${plan.location}
+ mysqldump -u ${plan.user} ${optionalString (plan.password != null) "-p$(cat ${plan.password})"} ${db} | gzip -c > ${plan.location}/${db}.gz
+ '';
in pkgs.pkgs.writeDash "mysqlBackup.${plan.name}" ''
${concatMapStringsSep "\n" (backupScript plan) plan.databases}
diff --git a/lass/3modules/xserver/default.nix b/lass/3modules/xserver/default.nix
deleted file mode 100644
index cdd80857a..000000000
--- a/lass/3modules/xserver/default.nix
+++ /dev/null
@@ -1,103 +0,0 @@
-{ config, pkgs, ... }@args:
-with import <stockholm/lib>;
-let
-
- out = {
- options.lass.xserver = api;
- config = mkIf cfg.enable imp;
- };
-
- user = config.krebs.build.user;
-
- cfg = config.lass.xserver;
- xcfg = config.services.xserver;
- api = {
- enable = mkEnableOption "lass xserver";
- };
- imp = {
-
- services.xserver = {
- enable = true;
- display = 11;
- tty = 11;
- };
-
- systemd.services.display-manager.enable = false;
-
- systemd.services.xmonad = {
- wantedBy = [ "multi-user.target" ];
- requires = [ "xserver.service" ];
- environment = {
- DISPLAY = ":${toString xcfg.display}";
-
- XMONAD_STARTUP_HOOK = pkgs.writeDash "xmonad-startup-hook" ''
- ${pkgs.xorg.xhost}/bin/xhost +LOCAL: &
- ${xcfg.displayManager.sessionCommands}
- if test -z "$DBUS_SESSION_BUS_ADDRESS"; then
- exec ${pkgs.dbus.dbus-launch} --exit-with-session "$0" ""
- fi
- export DBUS_SESSION_BUS_ADDRESS
- ${config.systemd.package}/bin/systemctl --user import-environment DISPLAY DBUS_SESSION_BUS_ADDRESS
- wait
- '';
-
- XMONAD_DATA_DIR = "/tmp";
- };
- serviceConfig = {
- SyslogIdentifier = "xmonad";
- ExecStart = "${pkgs.xmonad-lass}/bin/xmonad";
- ExecStop = "${pkgs.xmonad-lass}/bin/xmonad --shutdown";
- User = user.name;
- WorkingDirectory = user.home;
- };
- };
-
- systemd.services.xserver = {
- after = [
- "systemd-udev-settle.service"
- "local-fs.target"
- "acpid.service"
- ];
- reloadIfChanged = true;
- environment = {
- XKB_BINDIR = "${pkgs.xorg.xkbcomp}/bin"; # Needed for the Xkb extension.
- XORG_DRI_DRIVER_PATH = "/run/opengl-driver/lib/dri"; # !!! Depends on the driver selected at runtime.
- LD_LIBRARY_PATH = concatStringsSep ":" (
- [ "${pkgs.xorg.libX11}/lib" "${pkgs.xorg.libXext}/lib" ]
- ++ concatLists (catAttrs "libPath" xcfg.drivers));
- };
- serviceConfig = {
- SyslogIdentifier = "xserver";
- ExecReload = "${pkgs.coreutils}/bin/echo NOP";
- ExecStart = toString [
- "${pkgs.xorg.xorgserver}/bin/X"
- ":${toString xcfg.display}"
- "vt${toString xcfg.tty}"
- "-config ${import ./xserver.conf.nix args}"
- "-logfile /dev/null -logverbose 0 -verbose 3"
- "-nolisten tcp"
- "-xkbdir ${pkgs.xkeyboard_config}/etc/X11/xkb"
- (optional (xcfg.dpi != null) "-dpi ${toString xcfg.dpi}")
- ];
- User = user.name;
- };
- };
- krebs.xresources.resources.dpi = ''
- ${optionalString (xcfg.dpi != null) "Xft.dpi: ${toString xcfg.dpi}"}
- '';
- systemd.services.urxvtd = {
- wantedBy = [ "multi-user.target" ];
- reloadIfChanged = true;
- serviceConfig = {
- SyslogIdentifier = "urxvtd";
- ExecReload = "${pkgs.coreutils}/bin/echo NOP";
- ExecStart = "${pkgs.rxvt_unicode_with-plugins}/bin/urxvtd";
- Restart = "always";
- RestartSec = "2s";
- StartLimitBurst = 0;
- User = user.name;
- };
- };
- };
-
-in out
diff --git a/lass/3modules/xserver/xserver.conf.nix b/lass/3modules/xserver/xserver.conf.nix
deleted file mode 100644
index 6f34e0150..000000000
--- a/lass/3modules/xserver/xserver.conf.nix
+++ /dev/null
@@ -1,40 +0,0 @@
-{ config, lib, pkgs, ... }:
-
-with import <stockholm/lib>;
-
-let
- cfg = config.services.xserver;
-in
-
-pkgs.stdenv.mkDerivation {
- name = "xserver.conf";
-
- xfs = optionalString (cfg.useXFS != false)
- ''FontPath "${toString cfg.useXFS}"'';
-
- inherit (cfg) config;
-
- buildCommand =
- ''
- echo 'Section "Files"' >> $out
- echo $xfs >> $out
-
- for i in ${toString config.fonts.fonts}; do
- if test "''${i:0:''${#NIX_STORE}}" == "$NIX_STORE"; then
- for j in $(find $i -name fonts.dir); do
- echo " FontPath \"$(dirname $j)\"" >> $out
- done
- fi
- done
-
- for i in $(find ${toString cfg.modules} -type d); do
- if test $(echo $i/*.so* | wc -w) -ne 0; then
- echo " ModulePath \"$i\"" >> $out
- fi
- done
-
- echo 'EndSection' >> $out
-
- echo "$config" >> $out
- '';
-}