Merge pull request #30800 from gnidorah/sway
sway module: make it useful to end user
This commit is contained in:
commit
cb217f87a0
@ -1,13 +1,61 @@
|
|||||||
{ config, pkgs, lib, ... }:
|
{ config, pkgs, lib, ... }:
|
||||||
|
|
||||||
with lib;
|
with lib;
|
||||||
{
|
|
||||||
options.programs.sway.enable = mkEnableOption "sway";
|
|
||||||
|
|
||||||
config = mkIf config.programs.sway.enable {
|
let
|
||||||
environment.systemPackages = [ pkgs.sway pkgs.xwayland ];
|
cfg = config.programs.sway;
|
||||||
|
sway = pkgs.sway;
|
||||||
|
|
||||||
|
swayWrapped = pkgs.writeScriptBin "sway" ''
|
||||||
|
#! ${pkgs.stdenv.shell}
|
||||||
|
${cfg.extraSessionCommands}
|
||||||
|
PATH="${sway}/bin:$PATH"
|
||||||
|
exec ${pkgs.dbus.dbus-launch} --exit-with-session "${sway}/bin/sway"
|
||||||
|
'';
|
||||||
|
swayJoined = pkgs.symlinkJoin {
|
||||||
|
name = "sway-wrapped";
|
||||||
|
paths = [ swayWrapped sway ];
|
||||||
|
};
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.programs.sway = {
|
||||||
|
enable = mkEnableOption "sway";
|
||||||
|
|
||||||
|
extraSessionCommands = mkOption {
|
||||||
|
default = "";
|
||||||
|
type = types.lines;
|
||||||
|
example = ''
|
||||||
|
export XKB_DEFAULT_LAYOUT=us,ru
|
||||||
|
export XKB_DEFAULT_OPTIONS=grp:alt_shift_toggle,
|
||||||
|
export QT_QPA_PLATFORM=wayland
|
||||||
|
export QT_WAYLAND_DISABLE_WINDOWDECORATION="1"
|
||||||
|
'';
|
||||||
|
description = ''
|
||||||
|
Shell commands executed just before sway is started.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
extraPackages = mkOption {
|
||||||
|
type = with types; listOf package;
|
||||||
|
default = with pkgs; [ ];
|
||||||
|
example = literalExample ''
|
||||||
|
with pkgs; [
|
||||||
|
i3status
|
||||||
|
xwayland j4-dmenu-desktop dunst
|
||||||
|
qt5.qtwayland
|
||||||
|
imagemagick
|
||||||
|
]
|
||||||
|
'';
|
||||||
|
description = ''
|
||||||
|
Extra packages to be installed system wide.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
environment.systemPackages = [ swayJoined ] ++ cfg.extraPackages;
|
||||||
security.wrappers.sway = {
|
security.wrappers.sway = {
|
||||||
source = "${pkgs.sway}/bin/sway";
|
source = "${swayJoined}/bin/sway";
|
||||||
capabilities = "cap_sys_ptrace,cap_sys_tty_config=eip";
|
capabilities = "cap_sys_ptrace,cap_sys_tty_config=eip";
|
||||||
owner = "root";
|
owner = "root";
|
||||||
group = "sway";
|
group = "sway";
|
||||||
@ -15,5 +63,8 @@ with lib;
|
|||||||
};
|
};
|
||||||
|
|
||||||
users.extraGroups.sway = {};
|
users.extraGroups.sway = {};
|
||||||
|
|
||||||
|
hardware.opengl.enable = mkDefault true;
|
||||||
|
fonts.enableDefaultFonts = mkDefault true;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
{ stdenv, fetchFromGitHub
|
{ stdenv, fetchFromGitHub
|
||||||
, makeWrapper, cmake, pkgconfig, asciidoc, libxslt, docbook_xsl
|
, cmake, pkgconfig, asciidoc, libxslt, docbook_xsl
|
||||||
, wayland, wlc, libxkbcommon, pixman, fontconfig, pcre, json_c, dbus_libs
|
, wayland, wlc, libxkbcommon, pcre, json_c, dbus_libs
|
||||||
, pango, cairo, libinput, libcap, xwayland, pam, gdk_pixbuf, libpthreadstubs
|
, pango, cairo, libinput, libcap, pam, gdk_pixbuf, libpthreadstubs
|
||||||
, libXdmcp
|
, libXdmcp
|
||||||
|
, buildDocs ? true
|
||||||
}:
|
}:
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
@ -17,28 +18,17 @@ stdenv.mkDerivation rec {
|
|||||||
};
|
};
|
||||||
|
|
||||||
nativeBuildInputs = [
|
nativeBuildInputs = [
|
||||||
makeWrapper cmake pkgconfig
|
cmake pkgconfig
|
||||||
asciidoc libxslt docbook_xsl
|
] ++ stdenv.lib.optional buildDocs [ asciidoc libxslt docbook_xsl ];
|
||||||
];
|
|
||||||
buildInputs = [
|
buildInputs = [
|
||||||
wayland wlc libxkbcommon pixman fontconfig pcre json_c dbus_libs
|
wayland wlc libxkbcommon pcre json_c dbus_libs
|
||||||
pango cairo libinput libcap xwayland pam gdk_pixbuf libpthreadstubs
|
pango cairo libinput libcap pam gdk_pixbuf libpthreadstubs
|
||||||
libXdmcp
|
libXdmcp
|
||||||
];
|
];
|
||||||
|
|
||||||
patchPhase = ''
|
enableParallelBuilding = true;
|
||||||
sed -i s@/etc/sway@$out/etc/sway@g CMakeLists.txt;
|
|
||||||
'';
|
|
||||||
|
|
||||||
makeFlags = "PREFIX=$(out)";
|
|
||||||
cmakeFlags = "-DVERSION=${version}";
|
cmakeFlags = "-DVERSION=${version}";
|
||||||
installPhase = "PREFIX=$out make install";
|
|
||||||
|
|
||||||
LD_LIBRARY_PATH = stdenv.lib.makeLibraryPath [ wlc dbus_libs ];
|
|
||||||
preFixup = ''
|
|
||||||
wrapProgram $out/bin/sway \
|
|
||||||
--prefix LD_LIBRARY_PATH : "${LD_LIBRARY_PATH}";
|
|
||||||
'';
|
|
||||||
|
|
||||||
meta = with stdenv.lib; {
|
meta = with stdenv.lib; {
|
||||||
description = "i3-compatible window manager for Wayland";
|
description = "i3-compatible window manager for Wayland";
|
||||||
|
@ -1,11 +1,17 @@
|
|||||||
{ stdenv, fetchFromGitHub, cmake, pkgconfig
|
{ stdenv, fetchFromGitHub, fetchpatch, cmake, pkgconfig
|
||||||
, wayland, pixman, libxkbcommon, libinput, libxcb, xcbutilwm, xcbutilimage, mesa
|
, wayland, pixman, libxkbcommon, libinput, xcbutilwm, xcbutilimage, mesa_noglu
|
||||||
, libdrm, udev, libX11, libXdamage, systemd, dbus_libs, wayland-protocols
|
, libX11, dbus_libs, wayland-protocols
|
||||||
, libpthreadstubs, libXau, libXdmcp, libXext, libXxf86vm
|
, libpthreadstubs, libXdmcp, libXext
|
||||||
, withOptionalPackages ? true, zlib, valgrind, doxygen
|
, withOptionalPackages ? true, zlib, valgrind, doxygen
|
||||||
}:
|
}:
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
let
|
||||||
|
# for 0.0.10
|
||||||
|
xwaylandPatch = fetchpatch {
|
||||||
|
url = "https://github.com/Cloudef/wlc/commit/a130f6006560fb8ac02fb59a90ced1659563f9ca.diff";
|
||||||
|
sha256 = "0kzcbqklcyg8bganm65di8cif6dpc8bkrsvkjia09kr92lymxm2c";
|
||||||
|
};
|
||||||
|
in stdenv.mkDerivation rec {
|
||||||
name = "wlc-${version}";
|
name = "wlc-${version}";
|
||||||
version = "0.0.10";
|
version = "0.0.10";
|
||||||
|
|
||||||
@ -17,16 +23,21 @@ stdenv.mkDerivation rec {
|
|||||||
sha256 = "09kvwhrpgkxlagn9lgqxc80jbg56djn29a6z0n6h0dsm90ysyb2k";
|
sha256 = "09kvwhrpgkxlagn9lgqxc80jbg56djn29a6z0n6h0dsm90ysyb2k";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
patches = [
|
||||||
|
xwaylandPatch
|
||||||
|
];
|
||||||
|
|
||||||
nativeBuildInputs = [ cmake pkgconfig ];
|
nativeBuildInputs = [ cmake pkgconfig ];
|
||||||
|
|
||||||
buildInputs = [
|
buildInputs = [
|
||||||
wayland pixman libxkbcommon libinput libxcb xcbutilwm xcbutilimage mesa
|
wayland pixman libxkbcommon libinput xcbutilwm xcbutilimage mesa_noglu
|
||||||
libdrm udev libX11 libXdamage systemd dbus_libs wayland-protocols
|
libX11 dbus_libs wayland-protocols
|
||||||
libpthreadstubs libXau libXdmcp libXext libXxf86vm ]
|
libpthreadstubs libXdmcp libXext ]
|
||||||
++ stdenv.lib.optionals withOptionalPackages [ zlib valgrind doxygen ];
|
++ stdenv.lib.optionals withOptionalPackages [ zlib valgrind doxygen ];
|
||||||
|
|
||||||
doCheck = true;
|
doCheck = true;
|
||||||
checkTarget = "test";
|
checkTarget = "test";
|
||||||
|
enableParallelBuilding = true;
|
||||||
|
|
||||||
meta = with stdenv.lib; {
|
meta = with stdenv.lib; {
|
||||||
description = "A library for making a simple Wayland compositor";
|
description = "A library for making a simple Wayland compositor";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user