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:
parent
ab2d09962c
commit
8703e243eb
1 changed files with 31 additions and 20 deletions
51
flake.nix
51
flake.nix
|
|
@ -15,11 +15,39 @@
|
||||||
let
|
let
|
||||||
overlays = [ (import rust-overlay) ];
|
overlays = [ (import rust-overlay) ];
|
||||||
pkgs = import nixpkgs { inherit system overlays; };
|
pkgs = import nixpkgs { inherit system overlays; };
|
||||||
|
lib = pkgs.lib;
|
||||||
|
|
||||||
naersk' = pkgs.callPackage naersk {
|
naersk' = pkgs.callPackage naersk {
|
||||||
cargo = pkgs.rust-bin.stable.latest.default;
|
cargo = pkgs.rust-bin.stable.latest.default;
|
||||||
rustc = 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; }) {
|
devShell = (pkgs.mkShell.override { stdenv = pkgs.clangStdenv; }) {
|
||||||
buildInputs = with pkgs; [
|
buildInputs = with pkgs; [
|
||||||
rustPlatform.bindgenHook
|
rustPlatform.bindgenHook
|
||||||
|
|
@ -33,26 +61,9 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
packages = rec {
|
packages = rec {
|
||||||
xwayland-satellite = naersk'.buildPackage {
|
xwayland-satellite-nosd = buildXwaylandSatellite { withSystemd = false; };
|
||||||
src = ./.;
|
|
||||||
|
|
||||||
nativeBuildInputs = with pkgs; [
|
xwayland-satellite = buildXwaylandSatellite { withSystemd = true; };
|
||||||
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
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
default = xwayland-satellite;
|
default = xwayland-satellite;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue