forked from trycua/cua
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
161 lines (151 loc) · 4.93 KB
/
Copy pathflake.nix
File metadata and controls
161 lines (151 loc) · 4.93 KB
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
{
description = "CUA - Computer Use Agent";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-26.05";
flake-utils.url = "github:numtide/flake-utils";
};
outputs =
{
self,
nixpkgs,
flake-utils,
...
}:
flake-utils.lib.eachSystem
[
"x86_64-linux"
"aarch64-linux"
]
(
system:
let
pkgs = import nixpkgs { inherit system; };
rustSrc = ./libs/cua-driver/rust;
rustTestSrc = pkgs.lib.fileset.toSource {
root = ./libs/cua-driver;
fileset = pkgs.lib.fileset.unions [
./libs/cua-driver/rust
./libs/cua-driver/wayland-helper
./libs/cua-driver/compat-fixtures
./libs/cua-driver/tests/fixtures/shared/web/index.html
];
};
cuaDriverPackage = import ./nix/cua-driver/package.nix {
inherit pkgs;
src = rustSrc;
};
cuaCompositorPackage = pkgs.callPackage ./nix/cua-driver/compositor { };
# nixpkgs builds the AT-SPI launcher for NixOS's system profile.
# The E2E shell also runs on non-NixOS hosts such as GitHub's Ubuntu
# image, so point its private accessibility bus at store binaries.
hostAtSpi = pkgs.at-spi2-core.overrideAttrs (old: {
mesonFlags = map (
flag:
if pkgs.lib.hasPrefix "-Ddbus_daemon=" flag then
"-Ddbus_daemon=${pkgs.dbus}/bin/dbus-daemon"
else if pkgs.lib.hasPrefix "-Ddbus_broker=" flag then
"-Ddbus_broker=${pkgs.dbus-broker}/bin/dbus-broker-launch"
else
flag
) old.mesonFlags;
});
waylandE2eLibraries = with pkgs; [
alsa-lib
cairo
cups
dbus
expat
glib
gtk3
libayatana-appindicator
libdrm
libei
libgbm
librsvg
libsoup_3
libx11
libxcb
libxcomposite
libxdamage
libxext
libxfixes
libxi
libxkbcommon
libxrandr
libxtst
mesa
nspr
nss
openssl
pango
pipewire
webkitgtk_4_1
];
waylandE2eShell = extraPackages: pkgs.mkShell {
# hostAtSpi is referenced by absolute launcher path below, but is
# deliberately not a shell package: adding its rebuilt library and
# typelib hooks alongside GTK's stock AT-SPI closure loads two ATK
# copies and crashes PyGObject during Gtk import.
packages = (with pkgs; [
cargo
clang
chromium
dbus
ffmpeg
gobject-introspection
grim
jq
nodejs
pkg-config
procps
rustc
rustfmt
sway
unzip
wf-recorder
wtype
# Keep the GTK3 fixture on the mature Python/PyGObject combination.
(python312.withPackages (pythonPackages: [ pythonPackages.pygobject3 ]))
]) ++ extraPackages;
buildInputs = waylandE2eLibraries;
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath waylandE2eLibraries;
shellHook = ''
export NO_AT_BRIDGE=0
export CUA_AT_SPI_BUS_LAUNCHER="${hostAtSpi}/libexec/at-spi-bus-launcher"
export XDG_DATA_DIRS="${hostAtSpi}/share''${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}"
'';
};
in
{
packages = {
cua-compositor = cuaCompositorPackage;
cua-driver = cuaDriverPackage;
default = cuaDriverPackage;
};
checks = {
cua-compositor-build = cuaCompositorPackage;
cua-driver-build = cuaDriverPackage;
cua-driver-linux-rust-unit = import ./nix/cua-driver/tests/rust-unit.nix {
inherit pkgs;
src = rustTestSrc;
sourceSubdir = "rust";
};
cua-driver-policy-yaml = import ./nix/cua-driver/tests/policy-yaml.nix {
inherit pkgs;
cuaDriver = cuaDriverPackage;
};
cua-driver-policy-rego = import ./nix/cua-driver/tests/policy-rego.nix {
inherit pkgs;
cuaDriver = cuaDriverPackage;
};
};
devShells.cua-driver-wayland-e2e = waylandE2eShell [ ];
devShells.cua-driver-inject-e2e = waylandE2eShell [ cuaCompositorPackage ];
}
)
// {
# NixOS module — consumers must set services.cua-driver.package
# (or use the per-system package from self.packages)
nixosModules.cua-driver = ./nix/cua-driver/module.nix;
};
}