about summary refs log tree commit diff
path: root/modules
diff options
context:
space:
mode:
authoraszlig <aszlig@redmoonstudios.org>2014-10-21 21:23:33 +0200
committeraszlig <aszlig@redmoonstudios.org>2014-10-21 21:23:33 +0200
commitf509ef74c50ccda67afbc3e1a32ee50a94b8d575 (patch)
treee75ef65fcd993fc9a4fd7cc7ec5e7134449b0bad /modules
parent0e989400c3a699e0b0f9cecda36a7da231d98dec (diff)
common-workstation: Move SLiM stuff into a module.
Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Diffstat (limited to 'modules')
-rw-r--r--modules/module-list.nix1
-rw-r--r--modules/slim/default.nix44
2 files changed, 45 insertions, 0 deletions
diff --git a/modules/module-list.nix b/modules/module-list.nix
index 84cd81e1..c04fc681 100644
--- a/modules/module-list.nix
+++ b/modules/module-list.nix
@@ -1,3 +1,4 @@
 [
   ./i3
+  ./slim
 ]
diff --git a/modules/slim/default.nix b/modules/slim/default.nix
new file mode 100644
index 00000000..d8905ed7
--- /dev/null
+++ b/modules/slim/default.nix
@@ -0,0 +1,44 @@
+{ pkgs, config, lib, ... }:
+
+with lib;
+
+let
+  cfg = config.vuizvui.slim;
+  randrHeads = config.services.xserver.xrandrHeads;
+in {
+  options.vuizvui.slim.enable = mkEnableOption "Vuizvui SLiM";
+
+  config.services.xserver.displayManager.slim = mkIf cfg.enable {
+    enable = true;
+    defaultUser = "aszlig";
+    theme = pkgs.stdenv.mkDerivation {
+      name = "nixos-theme-vuizvui";
+      src = pkgs.slimThemes.nixosSlim;
+      phases = [ "unpackPhase" "patchPhase" "installPhase" ];
+      patchPhase = let
+        headFactor = if randrHeads == [] then 1 else lib.length randrHeads;
+        centerLeft = 100 / (headFactor * 2);
+      in ''
+        ${pkgs.imagemagick}/bin/mogrify \
+          -fill '#080010' -draw 'color 0,0 reset' \
+          share/slim/themes/nixos-slim-testing/background.png
+        ${pkgs.imagemagick}/bin/mogrify \
+          -negate -region 100x110+0+0 -negate -fill white -colorize 20% \
+          share/slim/themes/nixos-slim-testing/panel.png
+        sed -i \
+          -e 's/^\([a-z_]\+_x[^0-9]*\)[0-9]\+%/\1${toString centerLeft}%/' \
+          share/slim/themes/nixos-slim-testing/slim.theme
+        cat >> share/slim/themes/nixos-slim-testing/slim.theme <<EOF
+        session_x      ${toString centerLeft}%
+        msg_color      #ffffff
+        username_color #ffffff
+        password_color #ffffff
+        input_color    #ffffff
+        EOF
+      '';
+      installPhase = ''
+        cp -R share/slim/themes/nixos-slim-testing "$out"
+      '';
+    };
+  };
+}