-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathflake.nix
60 lines (56 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 = "pixelflut - a pixel drawing game for programmers";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, flake-utils, rust-overlay }: flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
system = system;
overlays = [ (import rust-overlay) ];
};
rustPlatform = pkgs.makeRustPlatform rec {
cargo = (pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml);
rustc = cargo;
};
cargoToml = (builtins.fromTOML (builtins.readFile ./Cargo.toml));
in
rec {
packages = rec {
default = pixeldike;
pixeldike = rustPlatform.buildRustPackage {
name = "pixeldike";
version = cargoToml.package.version;
src = ./.;
cargoLock.lockFile = ./Cargo.lock;
buildFeatures = [ "default" "ws" "windowing" ];
RUSTFLAGS = "--cfg tokio_unstable ";
};
pixeldike-oci = pkgs.dockerTools.buildLayeredImage {
name = "ghcr.io/lilioid/pixeldike";
tag = "latest";
config = {
Entrypoint = [ "${pixeldike}/bin/pixeldike" ];
User = "1000:1000";
};
};
};
apps = rec {
default = pixeldike;
pixeldike = flake-utils.lib.mkApp {
drv = packages.pixeldike;
};
};
devShells.default = pkgs.mkShell {
packages = with pkgs; [
rustPlatform.rust.cargo
pre-commit
];
};
});
}