-
Notifications
You must be signed in to change notification settings - Fork 22
/
flake.nix
73 lines (72 loc) · 2.13 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
{
description = "Nix flake for go-wlroots";
inputs = {
nixpkgs.url = "nixpkgs/nixos-unstable";
utils.url = "github:numtide/flake-utils";
gomod2nix = {
url = "github:tweag/gomod2nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, utils, gomod2nix }:
utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ gomod2nix.overlays.default ];
};
libxkbcommon =
pkgs.libxkbcommon.overrideAttrs (finalAttrs: prevAttrs: rec {
version = "1.6.0";
src = pkgs.fetchurl {
url = "https://xkbcommon.org/download/${prevAttrs.pname}-${version}.tar.xz";
hash = "sha256-DtwU7M3TkVFEWLxfWkuZhj7S1lHk3XYakKv09G75nCs=";
};
});
in
{
packages = rec {
default = tinywl;
tinywl = with pkgs; buildGoApplication {
pname = "tinywl";
version = "v0.0.0";
src = ./.;
subPackages = "cmd/tinywl";
modules = ./gomod2nix.toml;
nativeBuildInputs = [ pkg-config wayland ];
buildInputs = [
libxkbcommon
pixman
wlroots
wayland
libGL
udev
xorg.libX11
xorg.xcbutilwm
];
preBuild = ''
wayland-scanner private-code ${wayland-protocols}/share/wayland-protocols/stable/xdg-shell/xdg-shell.xml wlroots/xdg-shell-protocol.c
wayland-scanner server-header ${wayland-protocols}/share/wayland-protocols/stable/xdg-shell/xdg-shell.xml wlroots/xdg-shell-protocol.h
'';
};
};
devShells.default = with pkgs; mkShell {
buildInputs = [
gcc
go
gopls
gomod2nix.packages.${system}.default
libxkbcommon
wlroots
pkg-config
wayland
udev
libGL
pixman
xorg.libX11
xorg.xcbutilwm
];
};
}
);
}