aboutsummaryrefslogtreecommitdiff
path: root/flake.nix
diff options
context:
space:
mode:
Diffstat (limited to 'flake.nix')
-rw-r--r--flake.nix34
1 files changed, 25 insertions, 9 deletions
diff --git a/flake.nix b/flake.nix
index 6a6701e..34d28b8 100644
--- a/flake.nix
+++ b/flake.nix
@@ -6,12 +6,22 @@
6 url = "github:mozilla/nixpkgs-mozilla"; 6 url = "github:mozilla/nixpkgs-mozilla";
7 flake = false; 7 flake = false;
8 }; 8 };
9 gitignore = {
10 url = "github:hercules-ci/gitignore";
11 flake = false;
12 };
13 flake-compat = {
14 url = "github:edolstra/flake-compat";
15 flake = false;
16 };
17
9 }; 18 };
10 19
11 outputs = { self, nixpkgs, utils, naersk, mozillapkgs }: 20 outputs = { self, nixpkgs, utils, naersk, mozillapkgs, gitignore, ... }:
12 utils.lib.eachDefaultSystem (system: 21 utils.lib.eachDefaultSystem (system:
13 let 22 let
14 pkgs = nixpkgs.legacyPackages."${system}"; 23 pkgs = nixpkgs.legacyPackages."${system}";
24 inherit (import gitignore { inherit (pkgs) lib; }) gitignoreSource;
15 25
16 # Get a specific rust version 26 # Get a specific rust version
17 mozilla = pkgs.callPackage (mozillapkgs + "/package-set.nix") { }; 27 mozilla = pkgs.callPackage (mozillapkgs + "/package-set.nix") { };
@@ -20,24 +30,31 @@
20 channel = "nightly"; 30 channel = "nightly";
21 sha256 = "oK5ebje09MRn988saJMT3Zze/tRE7u9zTeFPV1CEeLc="; # set zeros after modifying channel or date 31 sha256 = "oK5ebje09MRn988saJMT3Zze/tRE7u9zTeFPV1CEeLc="; # set zeros after modifying channel or date
22 }; 32 };
23 rust = (mozilla.rustChannelOf chanspec).rust;
24 rust-src = (mozilla.rustChannelOf chanspec).rust-src;
25 33
26 nativeBuildInputs = with pkgs; [ 34 rustChannel = mozilla.rustChannelOf chanspec;
27 SDL2 35 rust = rustChannel.rust;
28 SDL2_ttf 36 rust-src = rustChannel.rust-src;
29 ];
30 37
31 naersk-lib = naersk.lib."${system}".override { 38 naersk-lib = naersk.lib."${system}".override {
32 cargo = rust; 39 cargo = rust;
33 rustc = rust; 40 rustc = rust;
34 }; 41 };
42
43 nativeBuildInputs = with pkgs; [
44 SDL2
45 SDL2_ttf
46 ];
47
35 in 48 in
36 rec { 49 rec {
37 packages.my-project = naersk-lib.buildPackage { 50 packages.my-project = naersk-lib.buildPackage {
38 pname = "obi"; 51 pname = "obiv";
39 version = "0.1.0"; 52 version = "0.1.0";
40 root = ./.; 53 root = ./.;
54 inherit nativeBuildInputs;
55 cargoBuildOptions =
56 v:
57 [ "$cargo_release" ''-j "$NIX_BUILD_CORES"'' "--out-dir" "out" "--all-features" "--bin" "obiv" "--message-format=$cargo_message_format" ];
41 }; 58 };
42 defaultPackage = packages.my-project; 59 defaultPackage = packages.my-project;
43 apps.my-project = utils.lib.mkApp { 60 apps.my-project = utils.lib.mkApp {
@@ -55,7 +72,6 @@
55 RUST_SRC_PATH = "${rust-src}/lib/rustlib/src/rust/library"; 72 RUST_SRC_PATH = "${rust-src}/lib/rustlib/src/rust/library";
56 RUST_LOG = "info"; 73 RUST_LOG = "info";
57 RUST_BACKTRACE = 1; 74 RUST_BACKTRACE = 1;
58
59 }; 75 };
60 }); 76 });
61} 77}