diff options
Diffstat (limited to 'flake.nix')
-rw-r--r-- | flake.nix | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..a046490 --- /dev/null +++ b/flake.nix | |||
@@ -0,0 +1,46 @@ | |||
1 | { | ||
2 | inputs = { | ||
3 | utils.url = "github:numtide/flake-utils"; | ||
4 | naersk.url = "github:nmattia/naersk"; | ||
5 | mozillapkgs = { | ||
6 | url = "github:mozilla/nixpkgs-mozilla"; | ||
7 | flake = false; | ||
8 | }; | ||
9 | }; | ||
10 | |||
11 | outputs = { self, nixpkgs, utils, naersk, mozillapkgs }: | ||
12 | utils.lib.eachDefaultSystem (system: let | ||
13 | pkgs = nixpkgs.legacyPackages."${system}"; | ||
14 | |||
15 | # Get a specific rust version | ||
16 | mozilla = pkgs.callPackage (mozillapkgs + "/package-set.nix") {}; | ||
17 | rust = (mozilla.rustChannelOf { | ||
18 | date = "2020-12-23"; | ||
19 | channel = "nightly"; | ||
20 | sha256 = "LbKHsCOFXWpg/SEyACfzZuWjKbkXdH6EJKOPSGoO01E="; # set zeros after modifying channel or date | ||
21 | }).rust; | ||
22 | |||
23 | naersk-lib = naersk.lib."${system}".override { | ||
24 | cargo = rust; | ||
25 | rustc = rust; | ||
26 | }; | ||
27 | in rec { | ||
28 | packages.my-project = naersk-lib.buildPackage { | ||
29 | pname = "dijo"; | ||
30 | root = ./.; | ||
31 | }; | ||
32 | defaultPackage = packages.my-project; | ||
33 | apps.my-project = utils.lib.mkApp { | ||
34 | drv = packages.my-project; | ||
35 | }; | ||
36 | defaultApp = apps.my-project; | ||
37 | devShell = pkgs.mkShell { | ||
38 | nativeBuildInputs = [ | ||
39 | rust | ||
40 | pkgs.cargo | ||
41 | pkgs.cargo | ||
42 | pkgs.ncurses | ||
43 | ]; | ||
44 | }; | ||
45 | }); | ||
46 | } | ||