-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathflake.nix
60 lines (54 loc) · 1.69 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
{
description = "A multiplayer piano using UDP sockets that can be played using computer keyboard, in the terminal.";
inputs = {
fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
};
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "nixpkgs/nixos-unstable";
};
outputs = { self, fenix, flake-utils, nixpkgs }:
flake-utils.lib.eachDefaultSystem (system:
let
toolchain = fenix.packages.${system}.minimal.toolchain;
pkgs = import nixpkgs { inherit system; };
manifest = (pkgs.lib.importTOML ./Cargo.toml);
in {
packages.default = (pkgs.makeRustPlatform {
cargo = toolchain;
rustc = toolchain;
}).buildRustPackage rec {
pname = manifest.package.name;
version = manifest.package.version;
src = pkgs.lib.cleanSource ./.;
cargoLock.lockFile = ./Cargo.lock;
cargoLock.allowBuiltinFetchGit = true;
buildType = "release";
nativeBuildInputs = with pkgs; [
makeWrapper
pkg-config
];
buildInputs = with pkgs; [
python310
alsa-lib
];
postInstall = ''
mkdir -p "$out"/lib
install -Dm644 "${pkgs.alsa-lib.out}"/lib/libasound* "$out"/lib/
cp -r assets "$out"/
wrapProgram "$out"/bin/piano-rs --set ASSETS "$out"/assets
'';
};
devShell = pkgs.mkShell {
nativeBuildInputs = with pkgs; [
pkg-config
];
buildInputs = with pkgs; [
python310
alsa-lib
];
};
}
);
}