-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathflake.nix
More file actions
95 lines (93 loc) · 2.96 KB
/
flake.nix
File metadata and controls
95 lines (93 loc) · 2.96 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
{
description = "A very basic flake";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixpkgs-unstable";
fenix.url = "github:nix-community/fenix/monthly";
crane.url = "github:ipetkov/crane";
};
outputs =
{
self,
nixpkgs,
fenix,
crane,
}:
let
forAllSystems = nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed;
in
{
devShells = forAllSystems (system: {
default = import ./shell.nix {
pkgs = nixpkgs.legacyPackages.${system};
rustfmt-nightly = fenix.packages.${system}.default.rustfmt;
};
});
packages = forAllSystems (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
craneLib = crane.mkLib pkgs;
rpath-libs = [
pkgs.libGL
pkgs.libxkbcommon
pkgs.wayland
pkgs.luajit
pkgs.dbus.lib
];
craneCommonArgs = {
version = "0.1.2";
pname = "entrace-deps";
src = pkgs.lib.fileset.toSource {
root = ./.;
fileset = pkgs.lib.fileset.unions [
(craneLib.fileset.commonCargoSources ./.)
(pkgs.lib.fileset.fileFilter (file: file.hasExt "md") ./.)
(pkgs.lib.fileset.maybeMissing ./gui/vendor)
(pkgs.lib.fileset.maybeMissing ./docs)
];
};
cargoCheckExtraArgs = "";
buildInputs = [ ] ++ rpath-libs;
nativeBuildInputs = [
pkgs.mold-wrapped
pkgs.patchelf
pkgs.pkg-config
];
};
cargoArtifacts = craneLib.buildDepsOnly craneCommonArgs;
craneWithCommonArgs =
x: craneLib.buildPackage (craneCommonArgs // { inherit cargoArtifacts; } // x);
entraceApp = craneWithCommonArgs {
pname = "entrace";
cargoExtraArgs = "-p entrace_gui";
postFixup = ''
ENTRACE_BIN="$out/bin/entrace"
patchelf --add-rpath ${pkgs.lib.makeLibraryPath rpath-libs} "$ENTRACE_BIN"
patchelf \
--add-needed libwayland-client.so \
--add-needed libxkbcommon.so \
--add-needed libEGL.so \
--add-needed libluajit-5.1.so \
--add-needed libdbus-1.so "$ENTRACE_BIN"
'';
};
in
{
default = entraceApp;
entrace = entraceApp;
entrace_core = craneWithCommonArgs {
pname = "entrace_core";
cargoExtraArgs = "-p entrace_core";
};
entrace_core_lite = craneWithCommonArgs {
pname = "entrace_core_lite";
cargoExtraArgs = "-p entrace_core --no-default-features";
};
entrace_script = craneWithCommonArgs {
pname = "entrace-script";
cargoExtraArgs = "-p entrace_script";
};
}
);
};
}