From b248510454fb9ab7d1857aede9d974be251e667c Mon Sep 17 00:00:00 2001 From: takagiy Date: Wed, 27 Jan 2021 23:44:27 +0900 Subject: [PATCH] wmderland: init at 2020-07-17 --- nixos/tests/all-tests.nix | 1 + nixos/tests/wmderland.nix | 54 +++++++++++++++++++ .../wmderland/0001-remove-flto.patch | 13 +++++ .../window-managers/wmderland/default.nix | 49 +++++++++++++++++ .../window-managers/wmderlandc/default.nix | 32 +++++++++++ pkgs/top-level/all-packages.nix | 4 ++ 6 files changed, 153 insertions(+) create mode 100644 nixos/tests/wmderland.nix create mode 100644 pkgs/applications/window-managers/wmderland/0001-remove-flto.patch create mode 100644 pkgs/applications/window-managers/wmderland/default.nix create mode 100644 pkgs/applications/window-managers/wmderlandc/default.nix diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index 9ffeba27a7f..536778467df 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -371,6 +371,7 @@ in virtualbox = handleTestOn ["x86_64-linux"] ./virtualbox.nix {}; wasabibackend = handleTest ./wasabibackend.nix {}; wireguard = handleTest ./wireguard {}; + wmderland = handleTest ./wmderland.nix {}; wordpress = handleTest ./wordpress.nix {}; xandikos = handleTest ./xandikos.nix {}; xautolock = handleTest ./xautolock.nix {}; diff --git a/nixos/tests/wmderland.nix b/nixos/tests/wmderland.nix new file mode 100644 index 00000000000..d121ed98b7a --- /dev/null +++ b/nixos/tests/wmderland.nix @@ -0,0 +1,54 @@ +import ./make-test-python.nix ({ pkgs, ...} : { + name = "wmderland"; + meta = with pkgs.stdenv.lib.maintainers; { + maintainers = [ takagiy ]; + }; + + machine = { lib, ... }: { + imports = [ ./common/x11.nix ./common/user-account.nix ]; + test-support.displayManager.auto.user = "alice"; + services.xserver.displayManager.defaultSession = lib.mkForce "none+wmderland"; + services.xserver.windowManager.wmderland.enable = true; + + systemd.services.setupWmderlandConfig = { + wantedBy = [ "multi-user.target" ]; + before = [ "multi-user.target" ]; + environment = { + HOME = "/home/alice"; + }; + unitConfig = { + type = "oneshot"; + RemainAfterExit = true; + user = "alice"; + }; + script = let + config = pkgs.writeText "config" '' + set $Mod = Mod1 + bindsym $Mod+Return exec ${pkgs.xterm}/bin/xterm -cm -pc + ''; + in '' + mkdir -p $HOME/.config/wmderland + cp ${config} $HOME/.config/wmderland/config + ''; + }; + }; + + testScript = { ... }: '' + with subtest("ensure x starts"): + machine.wait_for_x() + machine.wait_for_file("/home/alice/.Xauthority") + machine.succeed("xauth merge ~alice/.Xauthority") + + with subtest("ensure we can open a new terminal"): + machine.send_key("alt-ret") + machine.wait_until_succeeds("pgrep xterm") + machine.wait_for_window(r"alice.*?machine") + machine.screenshot("terminal") + + with subtest("ensure we can communicate through ipc with wmderlandc"): + # Kills the previously open xterm + machine.succeed("pgrep xterm") + machine.execute("DISPLAY=:0 wmderlandc kill") + machine.fail("pgrep xterm") + ''; +}) diff --git a/pkgs/applications/window-managers/wmderland/0001-remove-flto.patch b/pkgs/applications/window-managers/wmderland/0001-remove-flto.patch new file mode 100644 index 00000000000..cae1eac0a20 --- /dev/null +++ b/pkgs/applications/window-managers/wmderland/0001-remove-flto.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 17a4944..33406f3 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -10,7 +10,7 @@ include(BuildType) + # Request C++14 standard, using new CMake variables. + set(CMAKE_CXX_STANDARD 14) + set(CMAKE_CXX_STANDARD_REQUIRED True) +-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -flto -Wall") ++set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") + + # If the BuildType is Debug, then add -rdynamic. + # (used to print stacktrace with function names) diff --git a/pkgs/applications/window-managers/wmderland/default.nix b/pkgs/applications/window-managers/wmderland/default.nix new file mode 100644 index 00000000000..c0fcdd859b2 --- /dev/null +++ b/pkgs/applications/window-managers/wmderland/default.nix @@ -0,0 +1,49 @@ +{ lib, stdenv, fetchFromGitHub, cmake, libnotify, libX11, xorgproto, nixosTests }: + +stdenv.mkDerivation { + pname = "wmderland"; + version = "unstable-2020-07-17"; + + src = fetchFromGitHub { + owner = "aesophor"; + repo = "wmderland"; + rev = "a40a3505dd735b401d937203ab6d8d1978307d72"; + sha256 = "0npmlnybblp82mfpinjbz7dhwqgpdqc1s63wc1zs8mlcs19pdh98"; + }; + + nativeBuildInputs = [ + cmake + ]; + + cmakeBuildType = "MinSizeRel"; + + patches = [ ./0001-remove-flto.patch ]; + + postPatch = '' + substituteInPlace src/util.cc \ + --replace "notify-send" "${libnotify}/bin/notify-send" + ''; + + buildInputs = [ + libX11 + xorgproto + ]; + + postInstall = '' + install -Dm0644 -t $out/share/wmderland/contrib $src/example/config + install -Dm0644 -t $out/share/xsessions $src/example/wmderland.desktop + ''; + + passthru = { + tests.basic = nixosTests.wmderland; + providedSessions = [ "wmderland" ]; + }; + + meta = with lib; { + description = "Modern and minimal X11 tiling window manager"; + homepage = "https://github.com/aesophor/wmderland"; + license = licenses.mit; + platforms = libX11.meta.platforms; + maintainers = with maintainers; [ takagiy ]; + }; +} diff --git a/pkgs/applications/window-managers/wmderlandc/default.nix b/pkgs/applications/window-managers/wmderlandc/default.nix new file mode 100644 index 00000000000..24690eeaa46 --- /dev/null +++ b/pkgs/applications/window-managers/wmderlandc/default.nix @@ -0,0 +1,32 @@ +{ lib, stdenv, fetchFromGitHub, cmake, libX11, xorgproto }: + +stdenv.mkDerivation { + pname = "wmderlandc"; + version = "unstable-2020-07-17"; + + src = fetchFromGitHub { + owner = "aesophor"; + repo = "wmderland"; + rev = "a40a3505dd735b401d937203ab6d8d1978307d72"; + sha256 = "0npmlnybblp82mfpinjbz7dhwqgpdqc1s63wc1zs8mlcs19pdh98"; + }; + + sourceRoot = "source/ipc-client"; + + nativeBuildInputs = [ + cmake + ]; + + buildInputs = [ + libX11 + xorgproto + ]; + + meta = with lib; { + description = "A tiny program to interact with wmderland"; + homepage = "https://github.com/aesophor/wmderland/tree/master/ipc-client"; + license = licenses.mit; + platforms = platforms.all; + maintainers = with maintainers; [ takagiy ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 9efc75240c0..fced1f1d60c 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -24191,6 +24191,10 @@ in wmctrl = callPackage ../tools/X11/wmctrl { }; + wmderland = callPackage ../applications/window-managers/wmderland { }; + + wmderlandc = callPackage ../applications/window-managers/wmderlandc { }; + wmii_hg = callPackage ../applications/window-managers/wmii-hg { }; wofi = callPackage ../applications/misc/wofi { };