nixpkgs/nixos/modules/services/x11/window-managers/i3.nix
Eelco Dolstra 29027fd1e1 Rewrite ‘with pkgs.lib’ -> ‘with lib’
Using pkgs.lib on the spine of module evaluation is problematic
because the pkgs argument depends on the result of module
evaluation. To prevent an infinite recursion, pkgs and some of the
modules are evaluated twice, which is inefficient. Using ‘with lib’
prevents this problem.
2014-04-14 16:26:48 +02:00

44 lines
925 B
Nix

{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.xserver.windowManager.i3;
in
{
options = {
services.xserver.windowManager.i3 = {
enable = mkOption {
default = false;
example = true;
description = "Enable the i3 tiling window manager.";
};
configFile = mkOption {
default = null;
type = types.nullOr types.path;
description = ''
Path to the i3 configuration file.
If left at the default value, $HOME/.i3/config will be used.
'';
};
};
};
config = mkIf cfg.enable {
services.xserver.windowManager = {
session = [{
name = "i3";
start = ''
${pkgs.i3}/bin/i3 ${optionalString (cfg.configFile != null)
"-c \"${cfg.configFile}\""
} &
waitPID=$!
'';
}];
};
environment.systemPackages = [ pkgs.i3 ];
};
}