Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions flake.lock

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

24 changes: 19 additions & 5 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
devShell = pkgs.mkShell {
nativeBuildInputs = [
pkgs.pkg-config
pkgs.lua5_4
pkgs.pinnacle.luaEnv
pkgs.libgbm
];
buildInputs = with pkgs; [
Expand All @@ -74,21 +74,21 @@
lua5_4

# libs
seatd.dev
seatd
systemdLibs.dev
libxkbcommon
libinput
mesa
xwayland
libdisplay-info
libgbm
pkg-config

# winit on x11
libxcursor
libxrandr
libxi
libx11
alacritty
];

runtimeDependencies = with pkgs; [
Expand All @@ -97,8 +97,22 @@
libglvnd # libEGL
libgbm
];

LD_LIBRARY_PATH = "${pkgs.wayland}/lib:${pkgs.libGL}/lib:${pkgs.libxkbcommon}/lib:${pkgs.libgbm}/lib";
NIX_LD_LIBRARY_PATH = "${pkgs.lib.makeLibraryPath (
with pkgs;
[
wayland
lua5_4
libinput
libxkbcommon
libdisplay-info
seatd
libgbm
udev
]
)}";
shellHook = ''
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$NIX_LD_LIBRARY_PATH"
'';
};
}
))
Expand Down
83 changes: 31 additions & 52 deletions nix/packages/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
wayland,
lua54Packages,
lua5_4,
extraLuaPackages ? [ ],
extraLuaPackages ? (ps: [ ]),
protobuf,
seatd,
systemdLibs,
Expand All @@ -22,16 +22,12 @@
callPackage,
libglvnd,
autoPatchelfHook,
fetchzip,
fetchurl,
libxcrypt,
libxcursor,
libxi,
libxrandr,
libx11,
}:
let
pinnacle = ../..;
buildRustConfig = callPackage ./pinnacle-config.nix { };

meta = {
Expand All @@ -40,29 +36,7 @@ let
license = lib.licenses.gpl3;
maintainers = [ "pinnacle-comp" ];
};
version = "0.2.2";

# we need a newer version of luaposix than what's in nixpkgs
luaposix = lua54Packages.luaposix.overrideAttrs (old: rec {
version = "36.3.0-1";
knownRockspec =
(fetchurl {
url = "mirror://luarocks/luaposix-36.3-1.rockspec";
sha256 = "sha256-6/sAsOWrrXjdzPlAp/Z5FetQfzrkrf6TmOz3FZaBiks=";
}).outPath;
src = fetchzip {
url = "http://github.com/luaposix/luaposix/archive/v36.3.zip";
sha256 = "sha256-RKDH1sB7r7xDqueByWwps5fBfl5GBL9L86FjzfStBUw=";
};

disabled = lua54Packages.luaOlder "5.1" || lua54Packages.luaAtLeast "5.5";
propagatedBuildInputs = with lua54Packages; [
bit32
std-normalize
libxcrypt
];
meta.broken = disabled;
});
version = "0.2.3";

lua-client-api = lua54Packages.buildLuarocksPackage rec {
inherit meta version;
Expand All @@ -76,7 +50,7 @@ let
];
};
sourceRoot = "${src.name}/api/lua";
knownRockspec = ../../api/lua/rockspecs/pinnacle-api-0.2.0-1.rockspec;
knownRockspec = ../../api/lua/rockspecs/pinnacle-api-0.2.2-1.rockspec;
propagatedBuildInputs = with lua54Packages; [
cqueues
http
Expand All @@ -87,25 +61,24 @@ let

postInstall = ''
mkdir -p $out/share/pinnacle/protobuf/pinnacle
cp -rL --no-preserve ownership,mode ${../..}/api/protobuf/pinnacle $out/share/pinnacle/protobuf
cp -rL --no-preserve ownership,mode ../../api/protobuf/pinnacle $out/share/pinnacle/protobuf
mkdir -p $out/share/pinnacle/snowcap/protobuf/snowcap
cp -rL --no-preserve ownership,mode ${../..}/snowcap/api/protobuf/snowcap $out/share/pinnacle/snowcap/protobuf
cp -rL --no-preserve ownership,mode ../../snowcap/api/protobuf/snowcap $out/share/pinnacle/snowcap/protobuf
mkdir -p $out/share/pinnacle/protobuf/google
cp -rL --no-preserve ownership,mode ${../..}/api/protobuf/google $out/share/pinnacle/protobuf
cp -rL --no-preserve ownership,mode ../../api/protobuf/google $out/share/pinnacle/protobuf
mkdir -p $out/share/pinnacle/snowcap/protobuf/google
cp -rL --no-preserve ownership,mode ${../..}/snowcap/api/protobuf/google $out/share/pinnacle/snowcap/protobuf
cp -rL --no-preserve ownership,mode ../../snowcap/api/protobuf/google $out/share/pinnacle/snowcap/protobuf
find $out/share/pinnacle
'';
};
buildLuaConfig = args: callPackage ./pinnacle-lua-config (args // { inherit lua-client-api; });
in
rustPlatform.buildRustPackage (finalAttrs: {
inherit meta version;

pname = "pinnacle-server";
src = pinnacle;
src = ../..;
cargoLock = {
lockFile = "${pinnacle}/Cargo.lock";
lockFile = "${../..}/Cargo.lock";
# as we're not in-tree in nixpkgs right now, we don't benefit from the public nix subsituters.
# consequently, we can neither provide a single static `cargoHash` nor a set of hashes for just
# the dependencies fetched via git (these can change since cargo doesn't pin the git revision).
Expand Down Expand Up @@ -146,15 +119,21 @@ rustPlatform.buildRustPackage (finalAttrs: {
autoPatchelfHook
];

# integration tests don't work inside the nix sandbox, I think because the wayland socket is inaccessible.
cargoTestFlags = [ "--lib" ];
# the below is necessary to actually execute the integration tests
# TODO:
# 1. figure out if it's possible to run the integration tests inside the nix sandbox
# 2. fix the RPATH of the test binary prior to execution so LD_LIBRARY_PATH isn't necessary (it should be avoided with nix)
# preCheck = ''
# export LD_LIBRARY_PATH="${wayland}/lib:${libGL}/lib:${libxkbcommon}/lib"
# '';
checkFeatures = [ "testing" ];
checkNoDefaultFeatures = true;
cargoTestFlags = [
"--exclude"
"wlcs_pinnacle"
"--all"
"--"
"--skip"
"process_spawn"
];

preCheck = ''
export LD_LIBRARY_PATH="${lib.makeLibraryPath [ wayland ]}";
export XDG_RUNTIME_DIR=$(mktemp -d)
'';

postInstall = ''
wrapProgram $out/bin/pinnacle --prefix PATH ":" ${
Expand All @@ -165,13 +144,13 @@ rustPlatform.buildRustPackage (finalAttrs: {
xwayland
]
}
install -m755 ${../../resources/pinnacle-session} $out/bin/pinnacle-session
install -m755 ./resources/pinnacle-session $out/bin/pinnacle-session
mkdir -p $out/share/wayland-sessions
install -m644 ${../../resources/pinnacle.desktop} $out/share/wayland-sessions/pinnacle.desktop
install -m644 ./resources/pinnacle.desktop $out/share/wayland-sessions/pinnacle.desktop
patchShebangs $out/bin/pinnacle-session
mkdir -p $out/share/xdg-desktop-portal
install -m644 ${../../resources/pinnacle-portals.conf} $out/share/xdg-desktop-portal/pinnacle-portals.conf
install -m644 ${../../resources/pinnacle-portals.conf} $out/share/xdg-desktop-portal/pinnacle-uwsm-portals.conf
install -m644 ./resources/pinnacle-portals.conf $out/share/xdg-desktop-portal/pinnacle-portals.conf
install -m644 ./resources/pinnacle-portals.conf $out/share/xdg-desktop-portal/pinnacle-uwsm-portals.conf
'';

runtimeDependencies = [
Expand All @@ -184,12 +163,12 @@ rustPlatform.buildRustPackage (finalAttrs: {
luaEnv = lua5_4.withPackages (
ps:
[
lua-client-api
finalAttrs.passthru.lua-client-api
ps.cjson
]
++ extraLuaPackages
++ (extraLuaPackages ps)
);
inherit buildRustConfig buildLuaConfig;
inherit buildRustConfig;
providedSessions = [ "pinnacle" ];
lua-client-api = lua-client-api;
};
Expand Down
5 changes: 0 additions & 5 deletions nix/packages/pinnacle-lua-config.nix

This file was deleted.

Loading