-
-
Notifications
You must be signed in to change notification settings - Fork 17
/
flake.nix
89 lines (81 loc) · 2.44 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
{
description = "steam-tui flake to manage projects + builds";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/master";
};
outputs = { self, nixpkgs, ... }@inputs:
let
forAllSystems = nixpkgs.lib.genAttrs nixpkgs.lib.platforms.unix;
nixpkgsFor = forAllSystems (system: import nixpkgs {
inherit system;
config = {
allowUnfreePredicate = pkg: builtins.elem (nixpkgs.lib.getName pkg) [
"steam"
"steamcmd"
"steam-original"
"steam-run"
];
};
});
in
{
packages = forAllSystems (system:
let pkgs = nixpkgsFor.${system}; in {
steam-tui = with pkgs;
rustPlatform.buildRustPackage rec {
name = "steam-tui-dev";
pname = "steam-tui";
src = ./.;
nativeBuildInputs = [
openssl
pkg-config
];
buildInputs = [
steamcmd
];
# NOTE: Copied from pkgs.
preFixup = ''
mv $out/bin/steam-tui $out/bin/.steam-tui-unwrapped
cat > $out/bin/steam-tui <<EOF
#!${runtimeShell}
export PATH=${steamcmd}/bin:\$PATH
exec ${steam-run}/bin/steam-run $out/bin/.steam-tui-unwrapped '\$@'
EOF
chmod +x $out/bin/steam-tui
'';
checkFlags = [
"--skip=impure"
];
PKG_CONFIG_PATH = "${openssl.dev}/lib/pkgconfig";
cargoLock = {
lockFileContents = builtins.readFile ./Cargo.lock;
};
};
default = self.packages.${system}.steam-tui;
});
devShells = forAllSystems (system:
let pkgs = nixpkgsFor.${system}; in {
default = pkgs.mkShell {
inputsFrom = builtins.attrValues self.packages.${system};
buildInputs = with pkgs; [
# build
rustfmt
rustc
cargo
clippy
rustup
# steam
steam
steam-run
# misc
wine
proton-caller
python3
# binary
self.packages.${system}.steam-tui
];
STEAM_RUN_WRAPPER = "${pkgs.steam-run}/bin/steam-run";
};
});
};
}