aboutsummaryrefslogtreecommitdiff
path: root/infra/libkookie
diff options
context:
space:
mode:
authorMx Kookie <kookie@spacekookie.de>2020-12-21 19:15:24 +0100
committerMx Kookie <kookie@spacekookie.de>2020-12-22 20:42:39 +0100
commitda4d1cefba9a99c9c1306be56f81bfbc1f890c46 (patch)
tree8b8125e112a43f4241a9b6d688071122225d4844 /infra/libkookie
parent9a10d19ced763cccf64aa662fd3bc0fa811ce3af (diff)
libkookie: i3: adding i3status config generation module
Diffstat (limited to 'infra/libkookie')
-rw-r--r--infra/libkookie/configuration/workstation/i3/tempest.nix8
-rw-r--r--infra/libkookie/modules/workstation/ui/i3/core/i3status.nix52
-rw-r--r--infra/libkookie/modules/workstation/ui/i3/core/setup.nix29
-rw-r--r--infra/libkookie/modules/workstation/ui/i3/hm.nix14
4 files changed, 93 insertions, 10 deletions
diff --git a/infra/libkookie/configuration/workstation/i3/tempest.nix b/infra/libkookie/configuration/workstation/i3/tempest.nix
index 23717d813ed5..cc8bd84eebe9 100644
--- a/infra/libkookie/configuration/workstation/i3/tempest.nix
+++ b/infra/libkookie/configuration/workstation/i3/tempest.nix
@@ -6,9 +6,15 @@
# Then configure it
libkookie.ui.i3 = {
+ compton = true;
+ # TODO: include these files via git LFS
+ wallpaper = /home/Pictures/Wallpapers/small-memory.webp;
fonts = [ "Iosevka:13" ];
+
+ i3Status = {
+ segments = ["ipv6" "disk" "ethernet _first_" "load" "tztime local"];
+ };
};
- # FIXME: make this be included automatically
home.packages = with pkgs; [ iosevka ];
}
diff --git a/infra/libkookie/modules/workstation/ui/i3/core/i3status.nix b/infra/libkookie/modules/workstation/ui/i3/core/i3status.nix
new file mode 100644
index 000000000000..6efcd281e1dc
--- /dev/null
+++ b/infra/libkookie/modules/workstation/ui/i3/core/i3status.nix
@@ -0,0 +1,52 @@
+{ config, lib, pkgs, ... }:
+
+let
+
+ # Grab settings from the submodule
+ cfg = config.libkookie.ui.i3.i3Status;
+ colors = (builtins.toString cfg.colors);
+ interval = (builtins.toString cfg.interval);
+
+ # Utility functions to build the config
+ append = (seg: "order += ${seg}");
+in
+with lib.mkIf;
+{
+ text = ''
+ general {
+ colors = ${colors}
+ interval = ${interval}
+ format = ${cfg.format}
+ }
+
+ ${lib.concatMapStringsSep "\n" (l: append l) cfg.segments}
+
+ wireless _first_ {
+ format_up = "W: (%quality at %essid, %bitrate) %ip"
+ format_down = "W: down"
+ }
+
+ ethernet _first_ {
+ format_up = "E: %ip (%speed)"
+ format_down = "E: <down>"
+ }
+
+ tztime local {
+ format = "%Y-%m-%d %H:%M:%S"
+ }
+
+ load {
+ format = "%1min"
+ }
+
+ disk "/" {
+ format = "%avail"
+ }
+
+ battery 0 {
+ format = "%status %percentage %remaining %emptytime"
+ format_down = "NO BAT"
+ low_threshold = 10
+ }
+ '';
+}
diff --git a/infra/libkookie/modules/workstation/ui/i3/core/setup.nix b/infra/libkookie/modules/workstation/ui/i3/core/setup.nix
index 85c913d6a298..17a77f6f5549 100644
--- a/infra/libkookie/modules/workstation/ui/i3/core/setup.nix
+++ b/infra/libkookie/modules/workstation/ui/i3/core/setup.nix
@@ -1,11 +1,24 @@
-{ lib, config, pkgs, home-manager, ... } @ args:
+/** Main entry point for the home-manager module configuration
+ *
+ * For some reason, access to the config.libkookie.* option tree
+ * is not possible here, but instead needs to be deferred to an
+ * imported expression. For that reason, this file only contains
+ * key allocations, and no actual configuration content.
+ */
+
+{ config, lib, pkgs, home-manager, ... } @ args:
-let config = (import ./config.nix args);
-in
{
- xsession.windowManager.i3 = {
- enable = true;
- package = pkgs.i3;
- inherit config;
- };
+ xsession.windowManager.i3 =
+ let config = (import ./config.nix args);
+ in
+ {
+ enable = true;
+ package = pkgs.i3;
+ inherit config;
+ };
+
+ xdg.configFile."i3/compton.conf" = (import ./compton.nix args);
+
+ xdg.configFile."i3/i3status.conf" = (import ./i3status.nix args);
}
diff --git a/infra/libkookie/modules/workstation/ui/i3/hm.nix b/infra/libkookie/modules/workstation/ui/i3/hm.nix
index 0341fc5b07ac..23aef4337a67 100644
--- a/infra/libkookie/modules/workstation/ui/i3/hm.nix
+++ b/infra/libkookie/modules/workstation/ui/i3/hm.nix
@@ -18,13 +18,25 @@ in
'';
};
+ # TODO: figure out a way to make this a package type
fonts = mkOption {
- type = with types; listOf package;
+ type = with types; listOf str;
default = [ "monospace" ];
description = ''
A set of fonts to use by the i3 module for rendering text
'';
};
+
+ i3Status = mkOption {
+ type = with types; submodule {
+ options = {
+ colors = mkOption { type = bool; default = true; };
+ format = mkOption { type = str; default = "dzen2"; };
+ interval = mkOption { type = int; default = 1; };
+ segments = mkOption { type = listOf str; default = []; };
+ };
+ };
+ };
};
config = (import core/setup.nix args);