diff --git a/flake.lock b/flake.lock index 083b14ff0..0bd6038d6 100644 --- a/flake.lock +++ b/flake.lock @@ -8,11 +8,11 @@ "rust-analyzer-src": "rust-analyzer-src" }, "locked": { - "lastModified": 1771312404, - "narHash": "sha256-eJ1YY3a+uQTfa1T3LsR2JX7n3F9vAKAwsuX/3Aecve0=", + "lastModified": 1772521798, + "narHash": "sha256-N69u6BZTfCyCsqyc1Qv/qvqkGkTCO6peGInKae51r/E=", "owner": "nix-community", "repo": "fenix", - "rev": "b9696f35e4413cbd2873e4ac0252cd444f772772", + "rev": "9ba6d89cd7cb4d2b94953d56bea1d46e08aa53bd", "type": "github" }, "original": { @@ -41,11 +41,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1771177547, - "narHash": "sha256-trTtk3WTOHz7hSw89xIIvahkgoFJYQ0G43IlqprFoMA=", + "lastModified": 1772479524, + "narHash": "sha256-u7nCaNiMjqvKpE+uZz9hE7pgXXTmm5yvdtFaqzSzUQI=", "owner": "nixos", "repo": "nixpkgs", - "rev": "ac055f38c798b0d87695240c7b761b82fc7e5bc2", + "rev": "4215e62dc2cd3bc705b0a423b9719ff6be378a43", "type": "github" }, "original": { @@ -65,11 +65,11 @@ "rust-analyzer-src": { "flake": false, "locked": { - "lastModified": 1771264911, - "narHash": "sha256-vDNZ6Y1M3DSa1JbPGgqtdJPl4rMzxebUK9hmZcopxX0=", + "lastModified": 1772438613, + "narHash": "sha256-D+yZsIKkfRABreaY0Q+jsCtLB5WlnBKpZ1+Sk5qjuRQ=", "owner": "rust-lang", "repo": "rust-analyzer", - "rev": "3360aebb35a099ff4a7bbd37e9a0dd44b8f23748", + "rev": "3c4ae110c7682cfc723f9f0adb49c19e2e7a0893", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 7d6c3acdb..9fc1f30d8 100644 --- a/flake.nix +++ b/flake.nix @@ -50,7 +50,7 @@ devShell = pkgs.mkShell { nativeBuildInputs = [ pkgs.pkg-config - pkgs.lua5_4 + pkgs.pinnacle.luaEnv pkgs.libgbm ]; buildInputs = with pkgs; [ @@ -74,7 +74,7 @@ lua5_4 # libs - seatd.dev + seatd systemdLibs.dev libxkbcommon libinput @@ -82,13 +82,13 @@ xwayland libdisplay-info libgbm - pkg-config # winit on x11 libxcursor libxrandr libxi libx11 + alacritty ]; runtimeDependencies = with pkgs; [ @@ -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" + ''; }; } )) diff --git a/nix/packages/default.nix b/nix/packages/default.nix index f79fa60c5..e22a7d3f2 100644 --- a/nix/packages/default.nix +++ b/nix/packages/default.nix @@ -5,7 +5,7 @@ wayland, lua54Packages, lua5_4, - extraLuaPackages ? [ ], + extraLuaPackages ? (ps: [ ]), protobuf, seatd, systemdLibs, @@ -22,16 +22,12 @@ callPackage, libglvnd, autoPatchelfHook, - fetchzip, - fetchurl, - libxcrypt, libxcursor, libxi, libxrandr, libx11, }: let - pinnacle = ../..; buildRustConfig = callPackage ./pinnacle-config.nix { }; meta = { @@ -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; @@ -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 @@ -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). @@ -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 ":" ${ @@ -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 = [ @@ -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; }; diff --git a/nix/packages/pinnacle-lua-config.nix b/nix/packages/pinnacle-lua-config.nix deleted file mode 100644 index 70c163aab..000000000 --- a/nix/packages/pinnacle-lua-config.nix +++ /dev/null @@ -1,5 +0,0 @@ -{lua54Packages, lua5_4}: -{lua-client-api, ...}@args: -lua54Packages.buildLuarocksPackage ((builtins.removeAttrs args ["lua-client-api"]) // { - propagatedBuildInputs = [lua5_4 lua-client-api]; -})