diff options
author | Akshay <[email protected]> | 2021-01-17 04:47:42 +0000 |
---|---|---|
committer | Akshay <[email protected]> | 2021-01-17 04:47:42 +0000 |
commit | 25db37406f3f9e81c6bef840c5aae57d2aaccfff (patch) | |
tree | 063842a5650a8d9b0a6683752085c1c15d6a3837 /flake.nix | |
parent | 2a35f6c3cf57a33a5d7d33a6bceb4ea8c10cdac4 (diff) |
convert to nix flake
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 | } | ||