Add optional systemd support to flake package (#63)

* Enable systemd support in the flake package

* Add optional derivation without systemd support
This commit is contained in:
e-tho 2024-10-23 07:03:07 +02:00 committed by GitHub
parent ab2d09962c
commit 8703e243eb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -15,11 +15,39 @@
let
overlays = [ (import rust-overlay) ];
pkgs = import nixpkgs { inherit system overlays; };
lib = pkgs.lib;
naersk' = pkgs.callPackage naersk {
cargo = pkgs.rust-bin.stable.latest.default;
rustc = pkgs.rust-bin.stable.latest.default;
};
in {
buildXwaylandSatellite = { withSystemd ? false }: naersk'.buildPackage {
src = ./.;
nativeBuildInputs = with pkgs; [
rustPlatform.bindgenHook
rust-bin.stable.latest.default
pkg-config
xcb-util-cursor
xorg.libxcb
makeWrapper
] ++ lib.optional withSystemd pkgs.systemd;
buildInputs = [ pkgs.xwayland ];
cargoBuildOptions = opts: opts ++ lib.optional withSystemd "--features systemd";
postInstall = ''
wrapProgram $out/bin/xwayland-satellite \
--prefix PATH : ${pkgs.xwayland}/bin
'';
};
in
{
devShell = (pkgs.mkShell.override { stdenv = pkgs.clangStdenv; }) {
buildInputs = with pkgs; [
rustPlatform.bindgenHook
@ -33,26 +61,9 @@
};
packages = rec {
xwayland-satellite = naersk'.buildPackage {
src = ./.;
xwayland-satellite-nosd = buildXwaylandSatellite { withSystemd = false; };
nativeBuildInputs = with pkgs; [
rustPlatform.bindgenHook
rust-bin.stable.latest.default
pkg-config
xcb-util-cursor
xorg.libxcb
makeWrapper
];
buildInputs = [ pkgs.xwayland ];
postInstall = ''
wrapProgram $out/bin/xwayland-satellite \
--prefix PATH : ${pkgs.xwayland}/bin
'';
};
xwayland-satellite = buildXwaylandSatellite { withSystemd = true; };
default = xwayland-satellite;
};