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 | |
parent | 2a35f6c3cf57a33a5d7d33a6bceb4ea8c10cdac4 (diff) |
convert to nix flake
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | flake.lock | 91 | ||||
-rw-r--r-- | flake.nix | 46 | ||||
-rw-r--r-- | shell.nix | 11 |
4 files changed, 139 insertions, 11 deletions
@@ -15,3 +15,5 @@ | |||
15 | 15 | ||
16 | *.vim | 16 | *.vim |
17 | .envrc | 17 | .envrc |
18 | .direnv | ||
19 | result | ||
diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..6aa7a69 --- /dev/null +++ b/flake.lock | |||
@@ -0,0 +1,91 @@ | |||
1 | { | ||
2 | "nodes": { | ||
3 | "mozillapkgs": { | ||
4 | "flake": false, | ||
5 | "locked": { | ||
6 | "lastModified": 1603906276, | ||
7 | "narHash": "sha256-RsNPnEKd7BcogwkqhaV5kI/HuNC4flH/OQCC/4W5y/8=", | ||
8 | "owner": "mozilla", | ||
9 | "repo": "nixpkgs-mozilla", | ||
10 | "rev": "8c007b60731c07dd7a052cce508de3bb1ae849b4", | ||
11 | "type": "github" | ||
12 | }, | ||
13 | "original": { | ||
14 | "owner": "mozilla", | ||
15 | "repo": "nixpkgs-mozilla", | ||
16 | "type": "github" | ||
17 | } | ||
18 | }, | ||
19 | "naersk": { | ||
20 | "inputs": { | ||
21 | "nixpkgs": "nixpkgs" | ||
22 | }, | ||
23 | "locked": { | ||
24 | "lastModified": 1610392286, | ||
25 | "narHash": "sha256-3wFl5y+4YZO4SgRYK8WE7JIS3p0sxbgrGaQ6RMw+d98=", | ||
26 | "owner": "nmattia", | ||
27 | "repo": "naersk", | ||
28 | "rev": "d7bfbad3304fd768c0f93a4c3b50976275e6d4be", | ||
29 | "type": "github" | ||
30 | }, | ||
31 | "original": { | ||
32 | "owner": "nmattia", | ||
33 | "repo": "naersk", | ||
34 | "type": "github" | ||
35 | } | ||
36 | }, | ||
37 | "nixpkgs": { | ||
38 | "locked": { | ||
39 | "lastModified": 1610850544, | ||
40 | "narHash": "sha256-6GnsJuulJNdSrZNP98rRTRX/zJbxdC7m3qaH6WwsOuY=", | ||
41 | "owner": "NixOS", | ||
42 | "repo": "nixpkgs", | ||
43 | "rev": "2fbc36f3d891c86ae34dc0414bc78e74e8911218", | ||
44 | "type": "github" | ||
45 | }, | ||
46 | "original": { | ||
47 | "id": "nixpkgs", | ||
48 | "type": "indirect" | ||
49 | } | ||
50 | }, | ||
51 | "nixpkgs_2": { | ||
52 | "locked": { | ||
53 | "lastModified": 1610850544, | ||
54 | "narHash": "sha256-6GnsJuulJNdSrZNP98rRTRX/zJbxdC7m3qaH6WwsOuY=", | ||
55 | "owner": "NixOS", | ||
56 | "repo": "nixpkgs", | ||
57 | "rev": "2fbc36f3d891c86ae34dc0414bc78e74e8911218", | ||
58 | "type": "github" | ||
59 | }, | ||
60 | "original": { | ||
61 | "id": "nixpkgs", | ||
62 | "type": "indirect" | ||
63 | } | ||
64 | }, | ||
65 | "root": { | ||
66 | "inputs": { | ||
67 | "mozillapkgs": "mozillapkgs", | ||
68 | "naersk": "naersk", | ||
69 | "nixpkgs": "nixpkgs_2", | ||
70 | "utils": "utils" | ||
71 | } | ||
72 | }, | ||
73 | "utils": { | ||
74 | "locked": { | ||
75 | "lastModified": 1610051610, | ||
76 | "narHash": "sha256-U9rPz/usA1/Aohhk7Cmc2gBrEEKRzcW4nwPWMPwja4Y=", | ||
77 | "owner": "numtide", | ||
78 | "repo": "flake-utils", | ||
79 | "rev": "3982c9903e93927c2164caa727cd3f6a0e6d14cc", | ||
80 | "type": "github" | ||
81 | }, | ||
82 | "original": { | ||
83 | "owner": "numtide", | ||
84 | "repo": "flake-utils", | ||
85 | "type": "github" | ||
86 | } | ||
87 | } | ||
88 | }, | ||
89 | "root": "root", | ||
90 | "version": 7 | ||
91 | } | ||
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 | } | ||
diff --git a/shell.nix b/shell.nix deleted file mode 100644 index f6e0283..0000000 --- a/shell.nix +++ /dev/null | |||
@@ -1,11 +0,0 @@ | |||
1 | { pkgs ? import <nixpkgs> {} }: | ||
2 | |||
3 | pkgs.mkShell { | ||
4 | name = "rust-env"; | ||
5 | nativeBuildInputs = with pkgs; [ | ||
6 | rustc cargo | ||
7 | ]; | ||
8 | buildInputs = with pkgs; [ ncurses openssl ]; | ||
9 | |||
10 | RUST_BACKTRACE = 1; | ||
11 | } | ||