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