diff options
author | Akshay <[email protected]> | 2021-09-10 15:12:30 +0100 |
---|---|---|
committer | Akshay <[email protected]> | 2021-09-10 15:12:30 +0100 |
commit | 336e97961ce6cf496ca177ab7ae11f3779bad868 (patch) | |
tree | 417d300b3fad61dfe3adc52d141c75a210851eaa |
init
l--------- | .direnv/flake-profile | 1 | ||||
-rw-r--r-- | .direnv/flake-profile.rc | 1 | ||||
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | Cargo.lock | 104 | ||||
-rw-r--r-- | Cargo.toml | 10 | ||||
-rw-r--r-- | flake.lock | 125 | ||||
-rw-r--r-- | flake.nix | 76 | ||||
-rw-r--r-- | src/main.rs | 3 |
8 files changed, 322 insertions, 0 deletions
diff --git a/.direnv/flake-profile b/.direnv/flake-profile new file mode 120000 index 0000000..1f4a10d --- /dev/null +++ b/.direnv/flake-profile | |||
@@ -0,0 +1 @@ | |||
/home/np/code/rust/nix-analyzer/.direnv/flake-profile.30522 \ No newline at end of file | |||
diff --git a/.direnv/flake-profile.rc b/.direnv/flake-profile.rc new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/.direnv/flake-profile.rc | |||
@@ -0,0 +1 @@ | |||
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..46b5d68 --- /dev/null +++ b/.gitignore | |||
@@ -0,0 +1,2 @@ | |||
1 | /target | ||
2 | .envrc | ||
diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..f09d0c9 --- /dev/null +++ b/Cargo.lock | |||
@@ -0,0 +1,104 @@ | |||
1 | # This file is automatically @generated by Cargo. | ||
2 | # It is not intended for manual editing. | ||
3 | version = 3 | ||
4 | |||
5 | [[package]] | ||
6 | name = "anyhow" | ||
7 | version = "1.0.43" | ||
8 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
9 | checksum = "28ae2b3dec75a406790005a200b1bd89785afc02517a00ca99ecfe093ee9e6cf" | ||
10 | |||
11 | [[package]] | ||
12 | name = "autocfg" | ||
13 | version = "1.0.1" | ||
14 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
15 | checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" | ||
16 | |||
17 | [[package]] | ||
18 | name = "cbitset" | ||
19 | version = "0.2.0" | ||
20 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
21 | checksum = "29b6ad25ae296159fb0da12b970b2fe179b234584d7cd294c891e2bbb284466b" | ||
22 | dependencies = [ | ||
23 | "num-traits", | ||
24 | ] | ||
25 | |||
26 | [[package]] | ||
27 | name = "countme" | ||
28 | version = "2.0.4" | ||
29 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
30 | checksum = "328b822bdcba4d4e402be8d9adb6eebf269f969f8eadef977a553ff3c4fbcb58" | ||
31 | |||
32 | [[package]] | ||
33 | name = "hashbrown" | ||
34 | version = "0.9.1" | ||
35 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
36 | checksum = "d7afe4a420e3fe79967a00898cc1f4db7c8a49a9333a29f8a4bd76a253d5cd04" | ||
37 | |||
38 | [[package]] | ||
39 | name = "memoffset" | ||
40 | version = "0.6.4" | ||
41 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
42 | checksum = "59accc507f1338036a0477ef61afdae33cde60840f4dfe481319ce3ad116ddf9" | ||
43 | dependencies = [ | ||
44 | "autocfg", | ||
45 | ] | ||
46 | |||
47 | [[package]] | ||
48 | name = "nix-analyzer" | ||
49 | version = "0.1.0" | ||
50 | dependencies = [ | ||
51 | "anyhow", | ||
52 | "rnix", | ||
53 | ] | ||
54 | |||
55 | [[package]] | ||
56 | name = "num-traits" | ||
57 | version = "0.2.14" | ||
58 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
59 | checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" | ||
60 | dependencies = [ | ||
61 | "autocfg", | ||
62 | ] | ||
63 | |||
64 | [[package]] | ||
65 | name = "rnix" | ||
66 | version = "0.9.0" | ||
67 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
68 | checksum = "1b37f8af07a0354606141df076458660af7e22238e4117a041c21c548080addd" | ||
69 | dependencies = [ | ||
70 | "cbitset", | ||
71 | "rowan", | ||
72 | "smol_str", | ||
73 | ] | ||
74 | |||
75 | [[package]] | ||
76 | name = "rowan" | ||
77 | version = "0.12.6" | ||
78 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
79 | checksum = "a1b36e449f3702f3b0c821411db1cbdf30fb451726a9456dce5dabcd44420043" | ||
80 | dependencies = [ | ||
81 | "countme", | ||
82 | "hashbrown", | ||
83 | "memoffset", | ||
84 | "rustc-hash", | ||
85 | "text-size", | ||
86 | ] | ||
87 | |||
88 | [[package]] | ||
89 | name = "rustc-hash" | ||
90 | version = "1.1.0" | ||
91 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
92 | checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" | ||
93 | |||
94 | [[package]] | ||
95 | name = "smol_str" | ||
96 | version = "0.1.18" | ||
97 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
98 | checksum = "b203e79e90905594272c1c97c7af701533d42adaab0beb3859018e477d54a3b0" | ||
99 | |||
100 | [[package]] | ||
101 | name = "text-size" | ||
102 | version = "1.1.0" | ||
103 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
104 | checksum = "288cb548dbe72b652243ea797201f3d481a0609a967980fcc5b2315ea811560a" | ||
diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..d7f3afa --- /dev/null +++ b/Cargo.toml | |||
@@ -0,0 +1,10 @@ | |||
1 | [package] | ||
2 | name = "nix-analyzer" | ||
3 | version = "0.1.0" | ||
4 | edition = "2018" | ||
5 | |||
6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
7 | |||
8 | [dependencies] | ||
9 | anyhow = "1.0" | ||
10 | rnix = "0.9.0" | ||
diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..8ba571c --- /dev/null +++ b/flake.lock | |||
@@ -0,0 +1,125 @@ | |||
1 | { | ||
2 | "nodes": { | ||
3 | "flake-compat": { | ||
4 | "flake": false, | ||
5 | "locked": { | ||
6 | "lastModified": 1627913399, | ||
7 | "narHash": "sha256-hY8g6H2KFL8ownSiFeMOjwPC8P0ueXpCVEbxgda3pko=", | ||
8 | "owner": "edolstra", | ||
9 | "repo": "flake-compat", | ||
10 | "rev": "12c64ca55c1014cdc1b16ed5a804aa8576601ff2", | ||
11 | "type": "github" | ||
12 | }, | ||
13 | "original": { | ||
14 | "owner": "edolstra", | ||
15 | "repo": "flake-compat", | ||
16 | "type": "github" | ||
17 | } | ||
18 | }, | ||
19 | "gitignore": { | ||
20 | "flake": false, | ||
21 | "locked": { | ||
22 | "lastModified": 1611672876, | ||
23 | "narHash": "sha256-qHu3uZ/o9jBHiA3MEKHJ06k7w4heOhA+4HCSIvflRxo=", | ||
24 | "owner": "hercules-ci", | ||
25 | "repo": "gitignore", | ||
26 | "rev": "211907489e9f198594c0eb0ca9256a1949c9d412", | ||
27 | "type": "github" | ||
28 | }, | ||
29 | "original": { | ||
30 | "owner": "hercules-ci", | ||
31 | "repo": "gitignore", | ||
32 | "type": "github" | ||
33 | } | ||
34 | }, | ||
35 | "mozillapkgs": { | ||
36 | "flake": false, | ||
37 | "locked": { | ||
38 | "lastModified": 1629225446, | ||
39 | "narHash": "sha256-HJX4Pc5ZUAg4apxB/XHuJ+6ukzvRQqeZMjscOBst2bA=", | ||
40 | "owner": "mozilla", | ||
41 | "repo": "nixpkgs-mozilla", | ||
42 | "rev": "0510159186dd2ef46e5464484fbdf119393afa58", | ||
43 | "type": "github" | ||
44 | }, | ||
45 | "original": { | ||
46 | "owner": "mozilla", | ||
47 | "repo": "nixpkgs-mozilla", | ||
48 | "type": "github" | ||
49 | } | ||
50 | }, | ||
51 | "naersk": { | ||
52 | "inputs": { | ||
53 | "nixpkgs": "nixpkgs" | ||
54 | }, | ||
55 | "locked": { | ||
56 | "lastModified": 1631004250, | ||
57 | "narHash": "sha256-LGh0CjAZwh13AVkTi9w9lITEC7x6bwSQyFViOZ6HyNo=", | ||
58 | "owner": "nmattia", | ||
59 | "repo": "naersk", | ||
60 | "rev": "08afb3d1dbfe016108b72e05b02ba0f6ecb3c8e1", | ||
61 | "type": "github" | ||
62 | }, | ||
63 | "original": { | ||
64 | "owner": "nmattia", | ||
65 | "repo": "naersk", | ||
66 | "type": "github" | ||
67 | } | ||
68 | }, | ||
69 | "nixpkgs": { | ||
70 | "locked": { | ||
71 | "lastModified": 1631279684, | ||
72 | "narHash": "sha256-IxRRCEW+8crDkbYj+uzwkfjZ8swugtnAmfRpPOpKq6I=", | ||
73 | "owner": "NixOS", | ||
74 | "repo": "nixpkgs", | ||
75 | "rev": "ded7b6cb1bf3d6d03328b3f592069f2c4956a97f", | ||
76 | "type": "github" | ||
77 | }, | ||
78 | "original": { | ||
79 | "id": "nixpkgs", | ||
80 | "type": "indirect" | ||
81 | } | ||
82 | }, | ||
83 | "nixpkgs_2": { | ||
84 | "locked": { | ||
85 | "lastModified": 1631279684, | ||
86 | "narHash": "sha256-IxRRCEW+8crDkbYj+uzwkfjZ8swugtnAmfRpPOpKq6I=", | ||
87 | "owner": "NixOS", | ||
88 | "repo": "nixpkgs", | ||
89 | "rev": "ded7b6cb1bf3d6d03328b3f592069f2c4956a97f", | ||
90 | "type": "github" | ||
91 | }, | ||
92 | "original": { | ||
93 | "id": "nixpkgs", | ||
94 | "type": "indirect" | ||
95 | } | ||
96 | }, | ||
97 | "root": { | ||
98 | "inputs": { | ||
99 | "flake-compat": "flake-compat", | ||
100 | "gitignore": "gitignore", | ||
101 | "mozillapkgs": "mozillapkgs", | ||
102 | "naersk": "naersk", | ||
103 | "nixpkgs": "nixpkgs_2", | ||
104 | "utils": "utils" | ||
105 | } | ||
106 | }, | ||
107 | "utils": { | ||
108 | "locked": { | ||
109 | "lastModified": 1629481132, | ||
110 | "narHash": "sha256-JHgasjPR0/J1J3DRm4KxM4zTyAj4IOJY8vIl75v/kPI=", | ||
111 | "owner": "numtide", | ||
112 | "repo": "flake-utils", | ||
113 | "rev": "997f7efcb746a9c140ce1f13c72263189225f482", | ||
114 | "type": "github" | ||
115 | }, | ||
116 | "original": { | ||
117 | "owner": "numtide", | ||
118 | "repo": "flake-utils", | ||
119 | "type": "github" | ||
120 | } | ||
121 | } | ||
122 | }, | ||
123 | "root": "root", | ||
124 | "version": 7 | ||
125 | } | ||
diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..ceccfc8 --- /dev/null +++ b/flake.nix | |||
@@ -0,0 +1,76 @@ | |||
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 | gitignore = { | ||
10 | url = "github:hercules-ci/gitignore"; | ||
11 | flake = false; | ||
12 | }; | ||
13 | flake-compat = { | ||
14 | url = "github:edolstra/flake-compat"; | ||
15 | flake = false; | ||
16 | }; | ||
17 | }; | ||
18 | |||
19 | outputs = { self, nixpkgs, utils, naersk, mozillapkgs, gitignore, ... }: | ||
20 | utils.lib.eachDefaultSystem (system: | ||
21 | let | ||
22 | pkgs = nixpkgs.legacyPackages."${system}"; | ||
23 | inherit (import gitignore { inherit (pkgs) lib; }) gitignoreSource; | ||
24 | |||
25 | # Get a specific rust version | ||
26 | mozilla = pkgs.callPackage (mozillapkgs + "/package-set.nix") { }; | ||
27 | chanspec = { | ||
28 | date = "2021-03-31"; | ||
29 | channel = "nightly"; | ||
30 | sha256 = "oK5ebje09MRn988saJMT3Zze/tRE7u9zTeFPV1CEeLc="; # set zeros after modifying channel or date | ||
31 | }; | ||
32 | |||
33 | rustChannel = mozilla.rustChannelOf chanspec; | ||
34 | rust = rustChannel.rust; | ||
35 | rust-src = rustChannel.rust-src; | ||
36 | |||
37 | naersk-lib = naersk.lib."${system}".override { | ||
38 | cargo = rust; | ||
39 | rustc = rust; | ||
40 | }; | ||
41 | |||
42 | nativeBuildInputs = with pkgs; [ ]; | ||
43 | |||
44 | in | ||
45 | rec { | ||
46 | packages.nix-analyzer = naersk-lib.buildPackage { | ||
47 | pname = "nix-analyzer"; | ||
48 | version = "0.1.0"; | ||
49 | root = gitignoreSource ./.; | ||
50 | inherit nativeBuildInputs; | ||
51 | }; | ||
52 | defaultPackage = packages.nix-analyzer; | ||
53 | apps.nix-analyzer = utils.lib.mkApp { | ||
54 | drv = packages.nix-analyzer; | ||
55 | }; | ||
56 | apps.check = { | ||
57 | type = "app"; | ||
58 | program = "${pkgs.cargo-watch}/bin/cargo-watch"; | ||
59 | }; | ||
60 | defaultApp = apps.nix-analyzer; | ||
61 | devShell = pkgs.mkShell { | ||
62 | nativeBuildInputs = nativeBuildInputs ++ [ | ||
63 | rust | ||
64 | rust-src | ||
65 | pkgs.rust-analyzer | ||
66 | pkgs.rustfmt | ||
67 | pkgs.cargo | ||
68 | pkgs.cargo-watch | ||
69 | pkgs.cargo-tarpaulin | ||
70 | ]; | ||
71 | RUST_SRC_PATH = "${rust-src}/lib/rustlib/src/rust/library"; | ||
72 | RUST_LOG = "info"; | ||
73 | RUST_BACKTRACE = 1; | ||
74 | }; | ||
75 | }); | ||
76 | } | ||
diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..e7a11a9 --- /dev/null +++ b/src/main.rs | |||
@@ -0,0 +1,3 @@ | |||
1 | fn main() { | ||
2 | println!("Hello, world!"); | ||
3 | } | ||