Skip to content

Instantly share code, notes, and snippets.

Created February 22, 2017 21:05
Show Gist options
  • Save anonymous/cfebacf292cb03fb7fb90d9e08900742 to your computer and use it in GitHub Desktop.
Save anonymous/cfebacf292cb03fb7fb90d9e08900742 to your computer and use it in GitHub Desktop.
{ config, lib, pkgs, ...}:
with lib;
let
cfg = config.services.wayland.windowManager.sway;
in
{
### Interface
options = {
services.wayland.windowManager.sway = {
enable = mkEnableOption "Sway window manager";
configFile = mkOption {
default = null;
type = with types; nullOr path;
description =
''
Location of the Sway configuration file.
'';
};
};
};
### Implementation
config = mkIf cfg.enable {
services.wayland.windowManager.session = [{
name = "sway";
start =
''
${pkgs.sway}/bin/sway ${optionalString (cfg.configFile != null)
"-c \"${cfg.configFile}\""
} & waitPID=$!
'';
}];
environment.systemPackages = [ pkgs.sway ];
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment