-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
109 lines (86 loc) · 2.74 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
{
description = "xrwm";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs";
flake-utils.url = "github:numtide/flake-utils";
flake-compat = { url = "github:edolstra/flake-compat"; flake = false; };
nixpkgs-wayland = { url = "github:nix-community/nixpkgs-wayland"; };
};
outputs = { self, nixpkgs, flake-utils, ... }@inputs:
flake-utils.lib.eachSystem
(with flake-utils.lib.system; [
x86_64-linux
])
(system:
let
pkgs = import nixpkgs {
inherit system;
};
systemLibraries = with pkgs; [
xorg.libX11
xorg.libXinerama
xorg.libXcursor
xorg.libXrandr
xorg.libXi
xorg.libXxf86vm
xorg.libXext
libGL
zlib
mesa
glslang
vulkan-headers
vulkan-validation-layers
libxkbcommon
pixman
udev
wayland
wayland-protocols
inputs.nixpkgs-wayland.packages.${system}.wlroots
];
dynamicLibraries = with pkgs; [
vulkan-loader
];
packageName = "xrwm";
in
{
packages.${packageName} = pkgs.haskell.lib.overrideCabal
(pkgs.haskellPackages.callCabal2nix packageName self {
# Dependency overrides go here
})
(drv: {
extraLibraries = with pkgs; [ udev ];
postFixup = ''
patchelf --add-needed libvulkan.so "$out/bin/xrwm"
patchelf --add-rpath "${pkgs.lib.strings.makeLibraryPath dynamicLibraries}" "$out/bin/xrwm"
'';
});
devShells.init = pkgs.mkShell {
packages = with pkgs; [
cabal-install
ghc
];
};
devShells.dev = pkgs.mkShell {
packages = with pkgs; [
rnix-lsp
haskell-language-server
haskellPackages.fourmolu
ghcid
vulkan-tools
];
buildInputs = systemLibraries ++ dynamicLibraries;
inputsFrom = [
self.devShells.${system}.init
self.packages.${system}.${packageName}
];
shellHook = ''
[ $STARSHIP_SHELL ] && exec $STARSHIP_SHELL
'';
LD_LIBRARY_PATH = pkgs.lib.strings.makeLibraryPath dynamicLibraries;
VK_LAYER_PATH = "${pkgs.vulkan-validation-layers}/share/vulkan/explicit_layer.d";
CURRENT_PROJECT = packageName;
};
defaultPackage = self.packages.${system}.${packageName};
devShell = self.devShells.${system}.dev;
});
}