Skip to content

Instantly share code, notes, and snippets.

@fayesafe
Created May 23, 2019 06:09
Show Gist options
  • Save fayesafe/6ebe4aa3cc6b8f98f861eb1d1a5f2f79 to your computer and use it in GitHub Desktop.
Save fayesafe/6ebe4aa3cc6b8f98f861eb1d1a5f2f79 to your computer and use it in GitHub Desktop.
nixos 2bwm patches
{ stdenv, fetchFromGitHub, conf ? null, patches
, libxcb, xcbutilkeysyms, xcbutilwm
, libX11, writeText, xcbutil, xcbutilxrm }:
with stdenv.lib;
stdenv.mkDerivation rec {
version = "0.2";
name = "2bwm-${version}";
src = fetchFromGitHub {
owner = "venam";
repo = "2bwm";
rev = "v${version}";
sha256 = "1la1ixpm5knsj2gvdcmxzj1jfbzxvhmgzps4f5kbvx5047xc6ici";
};
# Allow users set their own list of patches
inherit patches;
buildInputs = [ libxcb xcbutilkeysyms xcbutilwm libX11 xcbutil xcbutilxrm ];
configFile = optionalString (conf!=null) (writeText "config.h" conf);
preBuild = optionalString (conf!=null) "cp ${configFile} config.h";
installPhase = "make install DESTDIR=$out PREFIX=\"\"";
meta = with stdenv.lib; {
homepage = https://github.com/venam/2bwm;
description = "A fast floating WM written over the XCB library and derived from mcwm";
license = licenses.mit;
maintainers = [ maintainers.sternenseemann ];
platforms = platforms.unix;
};
}
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.xserver.windowManager."2bwm";
_2bwm = pkgs._2bwm.override { conf = cfg.config; };
in
{
###### interface
options = {
services.xserver.windowManager."2bwm".enable = mkEnableOption "2bwm";
services.xserver.windowManager."2bwm".config = mkOption {
type = types.nullOr types.str;
default = null;
description = "configuration file for 2bwm";
};
};
###### implementation
config = mkIf cfg.enable {
services.xserver.windowManager.session = singleton
{ name = "2bwm";
start =
''
${_2bwm}/bin/2bwm &
waitPID=$!
'';
};
environment.systemPackages = [ _2bwm ];
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment