summary refs log tree commit diff
path: root/nixos/modules/programs/rootston.nix
diff options
context:
space:
mode:
authorMichael Weiss <dev.primeos@gmail.com>2017-12-23 17:25:19 +0100
committerMichael Weiss <dev.primeos@gmail.com>2017-12-23 17:34:29 +0100
commitb322cad42bc4040b76c7e82490947aef5ac9b734 (patch)
treeeda51c4e2bfb6c362751cc2907a89d5fe91a6c81 /nixos/modules/programs/rootston.nix
parentc3cfdc17bf0a4e61ad5e3af3e3da6355fb9b5466 (diff)
downloadnixlib-b322cad42bc4040b76c7e82490947aef5ac9b734.tar
nixlib-b322cad42bc4040b76c7e82490947aef5ac9b734.tar.gz
nixlib-b322cad42bc4040b76c7e82490947aef5ac9b734.tar.bz2
nixlib-b322cad42bc4040b76c7e82490947aef5ac9b734.tar.lz
nixlib-b322cad42bc4040b76c7e82490947aef5ac9b734.tar.xz
nixlib-b322cad42bc4040b76c7e82490947aef5ac9b734.tar.zst
nixlib-b322cad42bc4040b76c7e82490947aef5ac9b734.zip
nixos/rootston: Init
Probably only relevant for a quick testing setup and NixOS VM tests.
Diffstat (limited to 'nixos/modules/programs/rootston.nix')
-rw-r--r--nixos/modules/programs/rootston.nix88
1 files changed, 88 insertions, 0 deletions
diff --git a/nixos/modules/programs/rootston.nix b/nixos/modules/programs/rootston.nix
new file mode 100644
index 000000000000..a8fe2b22be57
--- /dev/null
+++ b/nixos/modules/programs/rootston.nix
@@ -0,0 +1,88 @@
+{ config, pkgs, lib, ... }:
+
+with lib;
+
+let
+  cfg = config.programs.rootston;
+
+  rootstonWrapped = pkgs.writeScriptBin "rootston" ''
+    #! ${pkgs.stdenv.shell}
+    if [[ "$#" -ge 1 ]]; then
+      exec ${pkgs.rootston}/bin/rootston "$@"
+    else
+      exec ${pkgs.rootston}/bin/rootston -C ${cfg.configFile}
+    fi
+  '';
+in {
+  options.programs.rootston = {
+    enable = mkEnableOption ''
+      rootston, the reference compositor for wlroots. The purpose of rootston
+      is to test and demonstrate the features of wlroots (if you want a real
+      Wayland compositor you should e.g. use Sway instead). You can manually
+      start the compositor by running "rootston" from a terminal'';
+
+    extraPackages = mkOption {
+      type = with types; listOf package;
+      default = with pkgs; [
+        xwayland rxvt_unicode dmenu
+      ];
+      defaultText = literalExample ''
+        with pkgs; [
+          xwayland dmenu rxvt_unicode
+        ]
+      '';
+      example = literalExample "[ ]";
+      description = ''
+        Extra packages to be installed system wide.
+      '';
+    };
+
+    config = mkOption {
+      type = types.str;
+      default = ''
+        [keyboard]
+        meta-key = Logo
+
+        # Sway/i3 like Keybindings
+        # Maps key combinations with commands to execute
+        # Commands include:
+        # - "exit" to stop the compositor
+        # - "exec" to execute a shell command
+        # - "close" to close the current view
+        # - "next_window" to cycle through windows
+        [bindings]
+        Logo+Shift+e = exit
+        Logo+q = close
+        Logo+m = maximize
+        Alt+Tab = next_window
+        Logo+Return = exec urxvt
+        # Note: Dmenu will only work properly while e.g. urxvt is running.
+        Logo+d = exec dmenu_run
+      '';
+      description = ''
+        Default configuration for rootston (used when called without any
+        parameters).
+      '';
+    };
+
+    configFile = mkOption {
+      type = types.path;
+      default = "/etc/rootston.ini";
+      example = literalExample "${pkgs.rootston}/etc/rootston.ini";
+      description = ''
+        Path to the default rootston configuration file (the "config" option
+        will have no effect if you change the path).
+      '';
+    };
+  };
+
+  config = mkIf cfg.enable {
+    environment.etc."rootston.ini".text = cfg.config;
+    environment.systemPackages = [ rootstonWrapped ] ++ cfg.extraPackages;
+
+    hardware.opengl.enable = mkDefault true;
+    fonts.enableDefaultFonts = mkDefault true;
+  };
+
+  meta.maintainers = with lib.maintainers; [ primeos ];
+}