-
Notifications
You must be signed in to change notification settings - Fork 9
/
flake.nix
105 lines (86 loc) · 2.94 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05";
flake-utils.url = "github:numtide/flake-utils";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, rust-overlay, flake-utils }:
let systems = [ "x86_64-linux" "aarch64-linux" ];
in flake-utils.lib.eachSystem systems (system:
let
overlays = [ (import rust-overlay) ];
pkgs = import nixpkgs { inherit system overlays; };
cargoToml = builtins.fromTOML (builtins.readFile ./Cargo.toml);
cargoPackageVersion = cargoToml.package.version;
commitHash = self.shortRev or self.dirtyShortRev or "unknown";
version = "${cargoPackageVersion}-${commitHash}";
buildXwaylandSatellite =
{ lib
, rustPlatform
, pkg-config
, makeBinaryWrapper
, libxcb
, xcb-util-cursor
, xwayland
, withSystemd ? true
}:
rustPlatform.buildRustPackage rec {
pname = "xwayland-satellite";
inherit version;
src = self;
cargoLock = {
lockFile = "${src}/Cargo.lock";
allowBuiltinFetchGit = true;
};
nativeBuildInputs = [
rustPlatform.bindgenHook
pkg-config
makeBinaryWrapper
];
buildInputs = [
libxcb
xcb-util-cursor
];
buildNoDefaultFeatures = true;
buildFeatures = lib.optionals withSystemd [ "systemd" ];
postPatch = ''
substituteInPlace resources/xwayland-satellite.service \
--replace-fail '/usr/local/bin' "$out/bin"
'';
postInstall = lib.optionalString withSystemd ''
install -Dm0644 resources/xwayland-satellite.service -t $out/lib/systemd/user
'';
postFixup = ''
wrapProgram $out/bin/xwayland-satellite \
--prefix PATH : "${lib.makeBinPath [ xwayland ]}"
'';
doCheck = false;
meta = with lib; {
description = "Xwayland outside your Wayland";
homepage = "https://github.com/Supreeeme/xwayland-satellite";
license = licenses.mpl20;
platforms = platforms.linux;
};
};
xwayland-satellite = pkgs.callPackage buildXwaylandSatellite { };
in
{
devShell = (pkgs.mkShell.override { stdenv = pkgs.clangStdenv; }) {
buildInputs = with pkgs; [
rustPlatform.bindgenHook
rust-bin.stable.latest.default
pkg-config
xcb-util-cursor
xorg.libxcb
xwayland
];
};
packages = {
xwayland-satellite = xwayland-satellite;
default = xwayland-satellite;
};
});
}