Skip to content

Commit

Permalink
pkgs/mir: shamelessly steal files
Browse files Browse the repository at this point in the history
[NixOS/nixpkgs | mir: init at 2.10.0](NixOS/nixpkgs#207534)
  • Loading branch information
phossil committed Jan 14, 2023
1 parent fdb3aca commit a2b9599
Show file tree
Hide file tree
Showing 10 changed files with 253 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
result
*.log
logs
2 changes: 1 addition & 1 deletion common/qvwm.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

{
# meh
services.xserver.displayManager.sessionPackages = [ (pkgs.callPackage ./../pkgs/qvwm { }) ];
services.xserver.displayManager.sessionPackages = [ (pkgs.callPackage ./../pkgs/qvwm.nix { }) ];
}
6 changes: 3 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 2 additions & 4 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
./common/libvirtd.nix
./common/shell.nix
./common/user-input.nix
./common/qvwm.nix
./package-sets
./package-sets/creative.nix
./package-sets/dump-cli.nix
Expand All @@ -49,11 +50,8 @@
./package-sets/gayming.nix
./package-sets/lsp.nix
./package-sets/media.nix
./package-sets/mir.nix
./package-sets/themes.nix
({ config, pkgs, ... }:
{
services.xserver.desktopManager.enlightenment.enable = true;
})
];
};
Gem-3350 = lib.nixosSystem {
Expand Down
1 change: 1 addition & 0 deletions package-sets/dump-gui.nix
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
sunshine
rlaunch
gthumb
oneko
# broken packages
#natron multibootusb clasp-common-lisp monodevelop
#heimdall-gui rustracer puddletag
Expand Down
13 changes: 13 additions & 0 deletions package-sets/mir.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{ lib, pkgs, ... }:

{
environment.systemPackages = with pkgs; [
# mir wayland compositor
(pkgs.callPackage ../pkgs/mir {
egl-wayland = pkgs.callPackage ./../pkgs/mir/egl-wayland.nix {
eglexternalplatform = pkgs.callPackage ./../pkgs/mir/eglexternalplatform.nix { };
};
eglexternalplatform = pkgs.callPackage ./../pkgs/mir/eglexternalplatform.nix { };
})
];
}
2 changes: 1 addition & 1 deletion pkgs/clasp.nix
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ stdenv.mkDerivation rec {
llvm
clang
clang-unwrapped
]) ++ [
]) ++ [
gmp
zlib
ncurses
Expand Down
129 changes: 129 additions & 0 deletions pkgs/mir/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
{ lib
, stdenv
, fetchFromGitHub
, cmake
, boost
, egl-wayland
, libglvnd
, glm
, glog
, lttng-ust
, udev
, glib
, wayland
, libxcb
, xorg
, libdrm
, mesa
, libepoxy
, nettle
, libxkbcommon
, libinput
, libxmlxx
, libuuid
, pcre2
, freetype
, libyamlcpp
, python3
, libevdev
, libselinux
, libsepol
, eglexternalplatform
, doxygen
, libxslt
, pkg-config
}:

let
pythonEnv = python3.withPackages (ps: [ ps.pillow ]);
in

stdenv.mkDerivation rec {
pname = "mir";
version = "2.10.0";

src = fetchFromGitHub {
owner = "MirServer";
repo = "mir";
rev = "v${version}";
sha256 = "sha256-HPbToo7lhsHyx0w4oO2wp3zZ0xpr6SlEm2oE6Rm8b3E=";
};

postPatch = ''
# Fix error broken path found in pc file ("//")
for f in $(find . -name '*.pc.in') ; do
substituteInPlace $f \
--replace "/@CMAKE_INSTALL_LIBDIR@" "@CMAKE_INSTALL_LIBDIR@" \
--replace "/@CMAKE_INSTALL_INCLUDEDIR@" "@CMAKE_INSTALL_INCLUDEDIR@"
done
# Fix paths for generating drm-formats
substituteInPlace src/platform/graphics/CMakeLists.txt \
--replace "/usr/include/drm/drm_fourcc.h" "${libdrm.dev}/include/libdrm/drm_fourcc.h" \
--replace "/usr/include/libdrm/drm_fourcc.h" "${libdrm.dev}/include/libdrm/drm_fourcc.h"
# Fix server-platform install path
substituteInPlace src/platforms/CMakeLists.txt \
--replace "\''${CMAKE_INSTALL_PREFIX}/\''${CMAKE_INSTALL_LIBDIR}/mir/server-platform" "\''${CMAKE_INSTALL_LIBDIR}/mir/server-platform"
'';

nativeBuildInputs = [
cmake
doxygen
libxslt
pkg-config
pythonEnv
];

buildInputs = [
boost
eglexternalplatform
egl-wayland
freetype
glib
glm
glog
libdrm
libepoxy
libevdev
libglvnd
libinput
libselinux
libsepol
libuuid
libxcb
libxkbcommon
libxmlxx
libyamlcpp
lttng-ust
mesa
nettle
pcre2
udev
wayland
xorg.libX11
xorg.libXau
xorg.libXcursor
xorg.libXdmcp
xorg.libXrender
xorg.xorgproto
];

buildFlags = [ "all" "doc" ];

cmakeFlags = [
"-DMIR_PLATFORM='gbm-kms;eglstream-kms;x11;wayland'"
# Tests depend on package wlcs which is not yet packaged
"-DMIR_ENABLE_TESTS=OFF"
];

outputs = [ "out" "dev" "doc" ];

meta = with lib; {
description = "Compositor and display server used by Canonical";
homepage = "https://mir-server.io";
license = licenses.gpl2Plus;
maintainers = with maintainers; [ onny ];
platforms = platforms.linux;
};
}
63 changes: 63 additions & 0 deletions pkgs/mir/egl-wayland.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{ lib
, stdenv
, fetchFromGitHub
, pkg-config
, meson
, ninja
, wayland-scanner
, libGL
, libX11
, mesa
, wayland
, wayland-protocols
, eglexternalplatform
}:

stdenv.mkDerivation rec {
pname = "egl-wayland";
version = "1.1.11";

outputs = [ "out" "dev" ];

src = fetchFromGitHub {
owner = "Nvidia";
repo = pname;
rev = version;
sha256 = "sha256-xb0d8spr4GoGZl/8C8BoPMPN7PAlzuQV11tEJbOQQ4U=";
};

depsBuildBuild = [
pkg-config
];

nativeBuildInputs = [
meson
ninja
pkg-config
wayland-scanner
];

buildInputs = [
eglexternalplatform
libGL
libX11
mesa
wayland
wayland-protocols
];

postFixup = ''
# Doubled prefix in pc file after postbuild hook replaces includedir prefix variable with dev output path
substituteInPlace $dev/lib/pkgconfig/wayland-eglstream.pc \
--replace "=$dev/$dev" "=$dev" \
--replace "Requires:" "Requires.private:"
'';

meta = with lib; {
description = "The EGLStream-based Wayland external platform";
homepage = "https://github.com/NVIDIA/egl-wayland/";
license = licenses.mit;
platforms = platforms.linux;
maintainers = with maintainers; [ hedning ];
};
}
39 changes: 39 additions & 0 deletions pkgs/mir/eglexternalplatform.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{ lib
, stdenvNoCC
, fetchFromGitHub
}:

stdenvNoCC.mkDerivation rec {
pname = "eglexternalplatform";
version = "1.1";

src = fetchFromGitHub {
owner = "Nvidia";
repo = "eglexternalplatform";
rev = version;
sha256 = "0lr5s2xa1zn220ghmbsiwgmx77l156wk54c7hybia0xpr9yr2nhb";
};

installPhase = ''
runHook preInstall
mkdir -p "$out/include/"
cp interface/eglexternalplatform.h "$out/include/"
cp interface/eglexternalplatformversion.h "$out/include/"
substituteInPlace eglexternalplatform.pc \
--replace "/usr/include/EGL" "$out/include"
mkdir -p "$out/share/pkgconfig"
cp eglexternalplatform.pc "$out/share/pkgconfig/"
runHook postInstall
'';

meta = with lib; {
description = "The EGL External Platform interface";
homepage = "https://github.com/NVIDIA/eglexternalplatform";
license = licenses.mit;
platforms = platforms.linux;
maintainers = with maintainers; [ hedning ];
};
}

0 comments on commit a2b9599

Please sign in to comment.