aboutsummaryrefslogtreecommitdiff
path: root/flake.nix
diff options
context:
space:
mode:
Diffstat (limited to 'flake.nix')
-rw-r--r--flake.nix103
1 files changed, 58 insertions, 45 deletions
diff --git a/flake.nix b/flake.nix
index e726b95..b067ee0 100644
--- a/flake.nix
+++ b/flake.nix
@@ -6,53 +6,66 @@
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 };
9 }; 13 };
10 14
11 outputs = { self, nixpkgs, utils, naersk, mozillapkgs }: 15 outputs = { self, nixpkgs, utils, naersk, mozillapkgs, gitignore, ... }:
12 utils.lib.eachDefaultSystem (system: let 16 utils.lib.eachDefaultSystem (system:
17 let
13 pkgs = nixpkgs.legacyPackages."${system}"; 18 pkgs = nixpkgs.legacyPackages."${system}";
19 inherit (import gitignore { inherit (pkgs) lib; }) gitignoreSource;
20
21 # Get a specific rust version
22 mozilla = pkgs.callPackage (mozillapkgs + "/package-set.nix") {};
23
24 rust = (mozilla.rustChannelOf {
25 date = "2021-03-31";
26 channel = "nightly";
27 sha256 = "oK5ebje09MRn988saJMT3Zze/tRE7u9zTeFPV1CEeLc="; # set zeros after modifying channel or date
28 }).rust;
14 29
15 # Get a specific rust version 30 rust-src = (mozilla.rustChannelOf {
16 mozilla = pkgs.callPackage (mozillapkgs + "/package-set.nix") {}; 31 date = "2021-03-31";
17 rust = (mozilla.rustChannelOf { 32 channel = "nightly";
18 date = "2021-03-31"; 33 sha256 = "oK5ebje09MRn988saJMT3Zze/tRE7u9zTeFPV1CEeLc="; # set zeros after modifying channel or date
19 channel = "nightly"; 34 }).rust-src;
20 sha256 = "oK5ebje09MRn988saJMT3Zze/tRE7u9zTeFPV1CEeLc="; # set zeros after modifying channel or date 35
21 }).rust; 36 naersk-lib = naersk.lib."${system}".override {
22 rust-src = (mozilla.rustChannelOf { 37 cargo = rust;
23 date = "2021-03-31"; 38 rustc = rust;
24 channel = "nightly"; 39 };
25 sha256 = "oK5ebje09MRn988saJMT3Zze/tRE7u9zTeFPV1CEeLc="; # set zeros after modifying channel or date
26 }).rust-src;
27 40
28 naersk-lib = naersk.lib."${system}".override { 41 nativeBuildInputs = with pkgs; [
29 cargo = rust; 42 SDL2
30 rustc = rust; 43 SDL2_ttf
31 }; 44 ];
32 in rec { 45
33 packages.my-project = naersk-lib.buildPackage { 46 in rec {
34 pname = "sdl-tests"; 47 packages.my-project = naersk-lib.buildPackage {
35 version = "0.1.0"; 48 pname = "sdl-tests";
36 root = ./.; 49 version = "0.1.0";
37 }; 50 root = gitignoreSource ./.;
38 defaultPackage = packages.my-project; 51 inherit nativeBuildInputs;
39 apps.my-project = utils.lib.mkApp { 52 };
40 drv = packages.my-project; 53 defaultPackage = packages.my-project;
41 }; 54 apps.my-project = utils.lib.mkApp {
42 defaultApp = apps.my-project; 55 drv = packages.my-project;
43 devShell = pkgs.mkShell { 56 };
44 nativeBuildInputs = [ 57 defaultApp = apps.my-project;
45 rust 58 devShell = pkgs.mkShell {
46 rust-src 59 nativeBuildInputs = nativeBuildInputs ++ (with pkgs; [
47 pkgs.rust-analyzer 60 rust
48 pkgs.rustfmt 61 rust-src
49 pkgs.cargo 62 rust-analyzer
50 pkgs.SDL2 63 rustfmt
51 pkgs.SDL2_ttf 64 cargo
52 ]; 65 ]);
53 RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}"; 66 RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}";
54 RUST_LOG="info"; 67 RUST_LOG="info";
55 RUST_BACKTRACE=1; 68 RUST_BACKTRACE=1;
56 }; 69 };
57 }); 70 });
58 } 71}