Skip to content

Commit

Permalink
nix: add a wrapped desktop version that works on NixOS
Browse files Browse the repository at this point in the history
  • Loading branch information
sandydoo committed Jun 30, 2022
1 parent f6f2d64 commit 207766e
Showing 1 changed file with 34 additions and 1 deletion.
35 changes: 34 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
overlays = [ (import rust-overlay) ];
};

inherit (pkgs) lib stdenv;
inherit (pkgs) lib stdenv stdenvNoCC;

rustToolchain = pkgs.rust-bin.stable.latest.default.override {
targets = [ "wasm32-unknown-unknown" ];
Expand Down Expand Up @@ -90,6 +90,11 @@

formatter = pkgs.nixfmt;

apps.default = flake-utils.lib.mkApp {
name = "flux-desktop";
drv = packages.flux-desktop-wrapped;
};

packages = {
default = packages.flux-web;

Expand Down Expand Up @@ -117,6 +122,34 @@
inherit (packages) flux-wasm;
};

flux-desktop-wrapped = let
runtimeLibraries = with pkgs;
[ wayland
wayland-protocols
libxkbcommon
xorg.libX11
xorg.libXcursor
xorg.libXrandr
xorg.libXi
xorg.libxcb
libGL
];
in
# Can’t use symlinkJoin because of the hooks are passed to the
# dependency-only build.
stdenvNoCC.mkDerivation {
name = "flux-desktop-wrapped";
inherit (packages.flux-desktop) version;
nativeBuildInputs = [ pkgs.makeWrapper ];
buildCommand = ''
mkdir -p $out/bin
cp ${packages.flux-desktop}/bin/flux-desktop $out/bin
wrapProgram $out/bin/flux-desktop \
--prefix LD_LIBRARY_PATH : ${pkgs.lib.makeLibraryPath runtimeLibraries}
'';
passthru.unwrapped = packages.flux-desktop;
};

flux-desktop = craneLib.buildPackage {
src = ./.;
release = true;
Expand Down

0 comments on commit 207766e

Please sign in to comment.