Skip to content

Commit

Permalink
Make less known wayland compositors usable (#32285)
Browse files Browse the repository at this point in the history
* bemenu: init at 2017-02-14

* velox: 2015-11-03 -> 2017-07-04

* orbment, velox: don't expose subprojects

the development of orbment and velox got stuck
their subprojects (bemenu, dmenu-wayland, st-wayland) don't work correctly outside of parent projects
so hide them to not confuse people
swc and wld libraries are unpopular and unlike wlc are not used by anything except velox

* pythonPackages.pydbus: init at 0.6.0

* way-cooler: 0.5.2 -> 0.6.2

* nixos/way-cooler: add module

* dconf module: use for wayland

non-invasive approach for #31293
see discussion at #32210

* sway: embed LD_LIBRARY_PATH for #32755

* way-cooler: switch from buildRustPackage to buildRustCrate #31150
  • Loading branch information
gnidorah authored and zimbatm committed Dec 21, 2017
1 parent 9e11982 commit b9851a9
Show file tree
Hide file tree
Showing 24 changed files with 3,524 additions and 137 deletions.
1 change: 1 addition & 0 deletions nixos/modules/module-list.nix
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@
./programs/tmux.nix
./programs/venus.nix
./programs/vim.nix
./programs/way-cooler.nix
./programs/wireshark.nix
./programs/xfs_quota.nix
./programs/xonsh.nix
Expand Down
16 changes: 12 additions & 4 deletions nixos/modules/programs/dconf.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{ config, lib, ... }:
{ config, lib, pkgs, ... }:

with lib;

let
inherit (lib) mkOption mkIf types mapAttrsToList;
cfg = config.programs.dconf;

mkDconfProfile = name: path:
Expand All @@ -13,6 +14,7 @@ in

options = {
programs.dconf = {
enable = mkEnableOption "dconf";

profiles = mkOption {
type = types.attrsOf types.path;
Expand All @@ -26,9 +28,15 @@ in

###### implementation

config = mkIf (cfg.profiles != {}) {
environment.etc =
config = mkIf (cfg.profiles != {} || cfg.enable) {
environment.etc = optionals (cfg.profiles != {})
(mapAttrsToList mkDconfProfile cfg.profiles);

environment.variables.GIO_EXTRA_MODULES = optional cfg.enable
"${pkgs.gnome3.dconf.lib}/lib/gio/modules";
# https://github.com/NixOS/nixpkgs/pull/31891
#environment.variables.XDG_DATA_DIRS = optional cfg.enable
# "$(echo ${pkgs.gnome3.gsettings_desktop_schemas}/share/gsettings-schemas/gsettings-desktop-schemas-*)";
};

}
5 changes: 3 additions & 2 deletions nixos/modules/programs/sway.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ let
cfg = config.programs.sway;
sway = pkgs.sway;

swayWrapped = pkgs.writeScriptBin "sway" ''
#! ${pkgs.stdenv.shell}
swayWrapped = pkgs.writeShellScriptBin "sway" ''
if [ "$1" != "" ]; then
sway-setcap "$@"
exit
Expand Down Expand Up @@ -65,8 +64,10 @@ in
};

users.extraGroups.sway = {};
security.pam.services.swaylock = {};

hardware.opengl.enable = mkDefault true;
fonts.enableDefaultFonts = mkDefault true;
programs.dconf.enable = mkDefault true;
};
}
78 changes: 78 additions & 0 deletions nixos/modules/programs/way-cooler.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
{ config, pkgs, lib, ... }:

with lib;

let
cfg = config.programs.way-cooler;
way-cooler = pkgs.way-cooler;

wcWrapped = pkgs.writeShellScriptBin "way-cooler" ''
${cfg.extraSessionCommands}
exec ${pkgs.dbus.dbus-launch} --exit-with-session ${way-cooler}/bin/way-cooler
'';
wcJoined = pkgs.symlinkJoin {
name = "way-cooler-wrapped";
paths = [ wcWrapped way-cooler ];
};
configFile = readFile "${way-cooler}/etc/way-cooler/init.lua";
spawnBar = ''
util.program.spawn_at_startup("lemonbar");
'';
in
{
options.programs.way-cooler = {
enable = mkEnableOption "way-cooler";

extraSessionCommands = mkOption {
default = "";
type = types.lines;
example = ''
export XKB_DEFAULT_LAYOUT=us,de
export XKB_DEFAULT_VARIANT=,nodeadkeys
export XKB_DEFAULT_OPTIONS=grp:caps_toggle,
'';
description = ''
Shell commands executed just before way-cooler is started.
'';
};

extraPackages = mkOption {
type = with types; listOf package;
default = with pkgs; [
westonLite xwayland dmenu
];
example = literalExample ''
with pkgs; [
westonLite xwayland dmenu
]
'';
description = ''
Extra packages to be installed system wide.
'';
};

enableBar = mkOption {
type = types.bool;
default = true;
description = ''
Whether to enable an unofficial bar.
'';
};
};

config = mkIf cfg.enable {
environment.systemPackages = [ wcJoined ] ++ cfg.extraPackages;

security.pam.services.wc-lock = {};
environment.etc."way-cooler/init.lua".text = ''
${configFile}
${optionalString cfg.enableBar spawnBar}
'';

hardware.opengl.enable = mkDefault true;
fonts.enableDefaultFonts = mkDefault true;
programs.dconf.enable = mkDefault true;
};

meta.maintainers = with maintainers; [ gnidorah ];
}
1 change: 0 additions & 1 deletion nixos/modules/security/pam.nix
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,6 @@ in
ftp = {};
i3lock = {};
i3lock-color = {};
swaylock = {};
screen = {};
vlock = {};
xlock = {};
Expand Down
34 changes: 0 additions & 34 deletions pkgs/applications/misc/dmenu/wayland.nix

This file was deleted.

27 changes: 27 additions & 0 deletions pkgs/applications/window-managers/orbment/bemenu.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{ stdenv, fetchFromGitHub, cmake, pkgconfig
, pango, wayland, libxkbcommon }:

stdenv.mkDerivation rec {
name = "bemenu-2017-02-14";

src = fetchFromGitHub {
owner = "Cloudef";
repo = "bemenu";
rev = "d6261274cf0b3aa51ce8ea7418a79495b20ad558";
sha256 = "08bc623y5yjbz7q83lhl6rb0xs6ji17z79c260bx0fgin8sfj5x8";
};

nativeBuildInputs = [ cmake pkgconfig ];

buildInputs = [ pango wayland libxkbcommon ];

enableParallelBuilding = true;

meta = with stdenv.lib; {
description = "A dynamic menu library and client program inspired by dmenu";
homepage = src.meta.homepage;
license = with licenses; [ gpl3 lgpl3 ];
maintainers = with maintainers; [ gnidorah ];
platforms = platforms.linux;
};
}
16 changes: 13 additions & 3 deletions pkgs/applications/window-managers/orbment/default.nix
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
{ lib, stdenv, fetchgit, cmake, pkgconfig
{ lib, stdenv, fetchgit, cmake, pkgconfig, makeWrapper, callPackage
, wlc, dbus_libs, wayland, libxkbcommon, pixman, libinput, udev, zlib, libpng
, libdrm, libX11
, westonLite
}:

stdenv.mkDerivation rec {
let
bemenu = callPackage ./bemenu.nix {};
in stdenv.mkDerivation rec {
name = "orbment-${version}";
version = "git-2016-08-13";

Expand All @@ -14,13 +17,20 @@ stdenv.mkDerivation rec {
fetchSubmodules = true;
};

nativeBuildInputs = [ cmake pkgconfig ];
nativeBuildInputs = [ cmake pkgconfig makeWrapper ];

buildInputs = [
wlc dbus_libs wayland libxkbcommon pixman libinput udev zlib libpng libX11
libdrm
];

postFixup = ''
wrapProgram $out/bin/orbment \
--prefix PATH : "${stdenv.lib.makeBinPath [ bemenu westonLite ]}"
'';

enableParallelBuilding = true;

meta = {
description = "Modular Wayland compositor";
homepage = src.url;
Expand Down
2 changes: 1 addition & 1 deletion pkgs/applications/window-managers/sway/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ stdenv.mkDerivation rec {

enableParallelBuilding = true;

cmakeFlags = "-DVERSION=${version}";
cmakeFlags = "-DVERSION=${version} -DLD_LIBRARY_PATH=/run/opengl-driver/lib:/run/opengl-driver-32/lib";

meta = with stdenv.lib; {
description = "i3-compatible window manager for Wayland";
Expand Down
52 changes: 40 additions & 12 deletions pkgs/applications/window-managers/velox/default.nix
Original file line number Diff line number Diff line change
@@ -1,25 +1,53 @@
{ lib, stdenv, fetchurl, fetchFromGitHub, pkgconfig
, swc, libxkbcommon
, wld, wayland, pixman, fontconfig
{ lib, stdenv, fetchFromGitHub, pkgconfig, makeWrapper, newScope
, libxkbcommon
, wayland, pixman, fontconfig
, stConf ? null, stPatches ? []
}:

stdenv.mkDerivation rec {
let
callPackage = newScope self;
self = {
swc = callPackage ./swc.nix {};
wld = callPackage ./wld.nix {};
dmenu-velox = callPackage ./dmenu.nix {};
st-velox = callPackage ./st.nix {
conf = stConf;
patches = stPatches;
};
};
in with self; stdenv.mkDerivation rec {
name = "velox-${version}";
version = "git-2015-11-03";
repo = "https://github.com/michaelforney/velox";
rev = "53b41348df7e37886cab012609923255e4397419";
version = "git-2017-07-04";

src = fetchurl {
url = "${repo}/archive/${rev}.tar.gz";
sha256 = "e49583efbbe62ea30f0084491ff757dff683f35eef6e9b68aa413e0b50c4bf20";
src = fetchFromGitHub {
owner = "michaelforney";
repo = "velox";
rev = "0b1d3d62861653d92d0a1056855a84fcef661bc0";
sha256 = "0p5ra5p5w21wl696rmv0vdnl7jnri5iwnxfs6nl6miwydhq2dmci";
};

nativeBuildInputs = [ pkgconfig ];
nativeBuildInputs = [ pkgconfig makeWrapper ];

buildInputs = [ swc libxkbcommon wld wayland pixman fontconfig ];

propagatedUserEnvPkgs = [ swc ];

makeFlags = "PREFIX=$(out)";
installPhase = "PREFIX=$out make install";
preBuild = ''
substituteInPlace config.c \
--replace /etc/velox.conf $out/etc/velox.conf
'';
installPhase = ''
PREFIX=$out make install
mkdir -p $out/etc
cp velox.conf.sample $out/etc/velox.conf
'';
postFixup = ''
wrapProgram $out/bin/velox \
--prefix PATH : "${stdenv.lib.makeBinPath [ dmenu-velox st-velox ]}"
'';

enableParallelBuilding = true;

meta = {
description = "velox window manager";
Expand Down
37 changes: 37 additions & 0 deletions pkgs/applications/window-managers/velox/dmenu.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{stdenv, fetchFromGitHub #, libX11, libXinerama, enableXft, libXft, zlib
, swc, wld, wayland, libxkbcommon, pixman, fontconfig
}:

with stdenv.lib;

stdenv.mkDerivation rec {
name = "dmenu-velox-${version}";
version = "git-2017-04-07";

src = fetchFromGitHub {
owner = "michaelforney";
repo = "dmenu";
rev = "f385d9d18813071b4b4257bf8d4d572daeda0e70";
sha256 = "14j8jv0nlybinhzkgd6dplvng9zy8p292prlx39w0k4fm6x5nv6y";
};

buildInputs = [ swc wld wayland libxkbcommon pixman fontconfig ];

postPatch = ''
sed -ri -e 's!\<(dmenu|dmenu_path)\>!'"$out/bin"'/&!g' dmenu_run
'';

preConfigure = [
''sed -i "s@PREFIX = /usr/local@PREFIX = $out@g; s@/usr/share/swc@${swc}/share/swc@g" config.mk''
];

enableParallelBuilding = true;

meta = {
description = "A generic, highly customizable, and efficient menu for the X Window System";
homepage = http://tools.suckless.org/dmenu;
license = stdenv.lib.licenses.mit;
maintainers = with stdenv.lib.maintainers; [ ];
platforms = with stdenv.lib.platforms; all;
};
}
Loading

0 comments on commit b9851a9

Please sign in to comment.