-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
117 lines (96 loc) · 3.04 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
106
107
108
109
110
111
112
113
114
115
116
117
{
inputs = {
flake-utils.url = "github:numtide/flake-utils";
flake-linter = {
url = "gitlab:kira-bruneau/flake-linter";
inputs = {
flake-utils.follows = "flake-utils";
nixpkgs.follows = "nixpkgs";
};
};
nixpkgs.url = "nixpkgs/nixpkgs-unstable";
crane.url = "github:ipetkov/crane";
};
outputs =
{
self,
flake-utils,
flake-linter,
nixpkgs,
crane,
}:
flake-utils.lib.eachDefaultSystem (
system:
let
root = ./.;
lib = nixpkgs.lib;
pkgs = nixpkgs.legacyPackages.${system};
linter = import ./flake-linter.nix { flake-linter-lib = flake-linter.lib.${system}; };
craneLib = crane.mkLib pkgs;
commonArgs = {
src = lib.fileset.toSource {
root = root;
fileset = lib.fileset.unions [
(craneLib.fileset.commonCargoSources root)
(lib.fileset.maybeMissing ./wayland-protocols)
];
};
strictDeps = true;
nativeBuildInputs = with pkgs; [ pkg-config ];
buildInputs = with pkgs; [
libcec
udev
];
C_INCLUDE_PATH = "${pkgs.libcec}/include/libcec";
};
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
default = craneLib.buildPackage (commonArgs // { inherit cargoArtifacts; });
in
{
checks = {
inherit default;
flake-linter = linter.check;
};
packages = {
gamescope = pkgs.fetchFromGitHub {
owner = "ValveSoftware";
repo = "gamescope";
rev = "refs/tags/3.15.14";
hash = "sha256-/g0/f7WkkS3AouvLQmRaiDbMyVEfikeoOCqqFjmWO0k=";
};
mpris-zbus = pkgs.stdenv.mkDerivation (finalAttrs: {
pname = "mpris-zbus";
version = "2.2";
src = pkgs.fetchFromGitLab {
domain = "gitlab.freedesktop.org";
owner = "mpris";
repo = "mpris-spec";
rev = "refs/tags/v${finalAttrs.version}";
hash = "sha256-gkL81/wlSkS5BNZ4BHEtWKyDhQGvwKPvNbljPt6hiQE=";
};
nativeBuildInputs = with pkgs; [ zbus-xmlgen ];
# Remove problematic tp:type attributes
# https://github.com/dbus2/zbus/issues/255
postPatch = ''
find spec -type f -iname '*.xml' -print0 | xargs -0 -n1 sed -i 's/tp:type="[^"]*"//g'
'';
dontBuild = true;
installPhase = ''
mkdir "$out"
cd "$out"
find "$NIX_BUILD_TOP/$sourceRoot/spec" -type f -iname '*.xml' -print0 | xargs -0 -n1 -exec zbus-xmlgen file
'';
});
inherit default;
};
apps = {
inherit (linter) fix;
default = flake-utils.lib.mkApp { drv = default; };
};
devShells.default = craneLib.devShell {
inputsFrom = [ default ];
inherit (default) C_INCLUDE_PATH;
};
}
);
}