-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
70 lines (63 loc) · 2.07 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
{
description = "A basic flake";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, fenix, flake-utils, nixpkgs }:
flake-utils.lib.eachDefaultSystem (system: {
packages =
let
inherit (fenix.packages.${system}.latest) toolchain;
pkgs = nixpkgs.legacyPackages.${system};
runtimeLibs = "/run/opengl-driver/lib/:${pkgs.lib.makeLibraryPath (with pkgs; [ libGL libGLU libxkbcommon bzip2 wayland fontconfig ])}";
in
rec {
unwrapped = (pkgs.makeRustPlatform {
cargo = toolchain;
rustc = toolchain;
}).buildRustPackage {
pname = "ftlman-unwrapped";
version = "0.3.0";
nativeBuildInputs = with pkgs; [
pkg-config
];
buildInputs = with pkgs; with pkgs.xorg; [
libX11
libXcursor
libXrandr
libxcb
libxkbcommon
libXi
fontconfig
openssl
];
src = ./.;
cargoLock = {
lockFile = ./Cargo.lock;
outputHashes = {
# silpkg's internal macros crate
# for some reason cargo doesn't lock this
"silpkg-macros-0.0.0" = "sha256-EIz400bWOGtdtTp7F6xAlCfb1M2vfbdVyb86j/ICFAE=";
};
};
shellHook = ''
export LD_LIBRARY_PATH=${runtimeLibs}
'';
};
default = pkgs.runCommandNoCC "ftlman"
{
pname = "ftlman";
inherit (unwrapped) version;
nativeBuildInputs = [ pkgs.makeWrapper ];
} ''
makeWrapper ${unwrapped}/bin/ftlman $out/bin/ftlman --suffix LD_LIBRARY_PATH : ${runtimeLibs}
'';
};
devShells.default = self.packages.${system}.unwrapped;
});
}