aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--flake.lock51
-rw-r--r--flake.nix55
-rw-r--r--shell/src/main.rs4
3 files changed, 84 insertions, 26 deletions
diff --git a/flake.lock b/flake.lock
index 369d5eb..8f73a8f 100644
--- a/flake.lock
+++ b/flake.lock
@@ -1,5 +1,21 @@
1{ 1{
2 "nodes": { 2 "nodes": {
3 "advisory-db": {
4 "flake": false,
5 "locked": {
6 "lastModified": 1706115649,
7 "narHash": "sha256-Qrqb54qGaRsFdLDj8EJtI5leFGFfqWHLRgC+t6KWlpQ=",
8 "owner": "rustsec",
9 "repo": "advisory-db",
10 "rev": "1d2202ea2b32fabd3307641010301bfe187ef11a",
11 "type": "github"
12 },
13 "original": {
14 "owner": "rustsec",
15 "repo": "advisory-db",
16 "type": "github"
17 }
18 },
3 "crane": { 19 "crane": {
4 "inputs": { 20 "inputs": {
5 "nixpkgs": [ 21 "nixpkgs": [
@@ -7,16 +23,16 @@
7 ] 23 ]
8 }, 24 },
9 "locked": { 25 "locked": {
10 "lastModified": 1701384536, 26 "lastModified": 1705625727,
11 "narHash": "sha256-PdYjpXmkn4FYJU7uvmCa54b0PPXBgDZHJaJpSEWR1Ek=", 27 "narHash": "sha256-naMq6+TNLpEiBBjc0XaCbMLYJxJXWTZz4JGSpYGgIOM=",
12 "rev": "07c531adf572dafd494db0672cdac00e48216171", 28 "rev": "8f515142e805dc377cf8edb0ff75d14a11307f89",
13 "revCount": 469, 29 "revCount": 485,
14 "type": "tarball", 30 "type": "tarball",
15 "url": "https://api.flakehub.com/f/pinned/ipetkov/crane/0.15.1/018c226e-9985-758b-9809-17419c4ebd2d/source.tar.gz" 31 "url": "https://api.flakehub.com/f/pinned/ipetkov/crane/0.16.0/018d1f38-c6e9-7615-a492-9b554687ba26/source.tar.gz"
16 }, 32 },
17 "original": { 33 "original": {
18 "type": "tarball", 34 "type": "tarball",
19 "url": "https://flakehub.com/f/ipetkov/crane/0.15.1.tar.gz" 35 "url": "https://flakehub.com/f/ipetkov/crane/0.16.0.tar.gz"
20 } 36 }
21 }, 37 },
22 "flake-utils": { 38 "flake-utils": {
@@ -24,26 +40,26 @@
24 "systems": "systems" 40 "systems": "systems"
25 }, 41 },
26 "locked": { 42 "locked": {
27 "lastModified": 1701680307, 43 "lastModified": 1705309234,
28 "narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=", 44 "narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=",
29 "rev": "4022d587cbbfd70fe950c1e2083a02621806a725", 45 "rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26",
30 "revCount": 88, 46 "revCount": 90,
31 "type": "tarball", 47 "type": "tarball",
32 "url": "https://api.flakehub.com/f/pinned/numtide/flake-utils/0.1.88%2Brev-4022d587cbbfd70fe950c1e2083a02621806a725/018c340d-3287-7c66-818b-f2f646a808e3/source.tar.gz" 48 "url": "https://api.flakehub.com/f/pinned/numtide/flake-utils/0.1.90%2Brev-1ef2e671c3b0c19053962c07dbda38332dcebf26/018d0c5a-ac7d-77f2-bef1-1527903ad3cc/source.tar.gz"
33 }, 49 },
34 "original": { 50 "original": {
35 "type": "tarball", 51 "type": "tarball",
36 "url": "https://flakehub.com/f/numtide/flake-utils/0.1.88.tar.gz" 52 "url": "https://flakehub.com/f/numtide/flake-utils/0.1.90.tar.gz"
37 } 53 }
38 }, 54 },
39 "nixpkgs": { 55 "nixpkgs": {
40 "locked": { 56 "locked": {
41 "lastModified": 1703467016, 57 "lastModified": 1705916986,
42 "narHash": "sha256-/5A/dNPhbQx/Oa2d+Get174eNI3LERQ7u6WTWOlR1eQ=", 58 "narHash": "sha256-iBpfltu6QvN4xMpen6jGGEb6jOqmmVQKUrXdOJ32u8w=",
43 "rev": "d02d818f22c777aa4e854efc3242ec451e5d462a", 59 "rev": "d7f206b723e42edb09d9d753020a84b3061a79d8",
44 "revCount": 553579, 60 "revCount": 554771,
45 "type": "tarball", 61 "type": "tarball",
46 "url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.2311.553579%2Brev-d02d818f22c777aa4e854efc3242ec451e5d462a/018ca90b-a320-767a-a3c2-3cd4ab8c3551/source.tar.gz" 62 "url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.2311.554771%2Brev-d7f206b723e42edb09d9d753020a84b3061a79d8/018d35d3-1b83-7e69-a58c-3fca76cb78bb/source.tar.gz"
47 }, 63 },
48 "original": { 64 "original": {
49 "type": "tarball", 65 "type": "tarball",
@@ -52,6 +68,7 @@
52 }, 68 },
53 "root": { 69 "root": {
54 "inputs": { 70 "inputs": {
71 "advisory-db": "advisory-db",
55 "crane": "crane", 72 "crane": "crane",
56 "flake-utils": "flake-utils", 73 "flake-utils": "flake-utils",
57 "nixpkgs": "nixpkgs" 74 "nixpkgs": "nixpkgs"
diff --git a/flake.nix b/flake.nix
index 458ecac..0c3fea5 100644
--- a/flake.nix
+++ b/flake.nix
@@ -1,12 +1,16 @@
1{ 1{
2 inputs = { 2 inputs = {
3 nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.2311.*.tar.gz"; 3 nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.2311.*.tar.gz";
4 flake-utils.url = "https://flakehub.com/f/numtide/flake-utils/0.1.88.tar.gz"; 4 flake-utils.url = "https://flakehub.com/f/numtide/flake-utils/0.1.90.tar.gz";
5 crane.url = "https://flakehub.com/f/ipetkov/crane/0.15.1.tar.gz"; 5 crane.url = "https://flakehub.com/f/ipetkov/crane/0.16.0.tar.gz";
6 crane.inputs.nixpkgs.follows = "nixpkgs"; 6 crane.inputs.nixpkgs.follows = "nixpkgs";
7 advisory-db = {
8 url = "github:rustsec/advisory-db";
9 flake = false;
10 };
7 }; 11 };
8 12
9 outputs = { self, crane, nixpkgs, flake-utils, ... }@inputs: 13 outputs = { self, nixpkgs, flake-utils, crane, advisory-db, ... }@inputs:
10 flake-utils.lib.eachDefaultSystem 14 flake-utils.lib.eachDefaultSystem
11 (system: 15 (system:
12 let 16 let
@@ -16,19 +20,56 @@
16 }; 20 };
17 21
18 craneLib = crane.lib.${system}; 22 craneLib = crane.lib.${system};
23 src = craneLib.cleanCargoSource (craneLib.path ./.);
19 24
20 gitolfs3 = craneLib.buildPackage { 25 commonArgs = {
26 inherit src;
27 strictDeps = true;
21 pname = "gitolfs3"; 28 pname = "gitolfs3";
22 version = "0.1.0"; 29 version = "0.1.0";
23 src = craneLib.cleanCargoSource (craneLib.path ./.);
24 }; 30 };
31
32 cargoArtifacts = craneLib.buildDepsOnly commonArgs;
33
34 gitolfs3 = craneLib.buildPackage (commonArgs // {
35 # We already have the gitolfs3-nextest check
36 doCheck = false;
37 });
25 in 38 in
26 { 39 {
40 checks = {
41 inherit gitolfs3;
42
43 gitolfs3-clippy = craneLib.cargoClippy (commonArgs // {
44 inherit cargoArtifacts;
45 cargoClippyExtraArgs = "--all-targets -- --deny warnings";
46 });
47
48 gitolfs3-doc = craneLib.cargoDoc (commonArgs // {
49 inherit cargoArtifacts;
50 });
51
52 # Check formatting
53 gitolfs3-fmt = craneLib.cargoFmt commonArgs;
54
55 # Audit dependencies
56 gitolfs3-audit = craneLib.cargoAudit (commonArgs // {
57 inherit advisory-db;
58 });
59
60 # Run tests with cargo-nextest
61 gitolfs3-nextest = craneLib.cargoNextest (commonArgs // {
62 inherit cargoArtifacts;
63 partitions = 1;
64 partitionType = "count";
65 });
66 };
67
27 packages.gitolfs3 = gitolfs3; 68 packages.gitolfs3 = gitolfs3;
28 packages.default = self.packages.${system}.gitolfs3; 69 packages.default = self.packages.${system}.gitolfs3;
29 70
30 devShells.default = pkgs.mkShell { 71 devShells.default = craneLib.devShell {
31 inputsFrom = [ gitolfs3 ]; 72 checks = self.checks.${system};
32 }; 73 };
33 74
34 formatter = pkgs.nixpkgs-fmt; 75 formatter = pkgs.nixpkgs-fmt;
diff --git a/shell/src/main.rs b/shell/src/main.rs
index ef0ef48..4901e7f 100644
--- a/shell/src/main.rs
+++ b/shell/src/main.rs
@@ -56,7 +56,7 @@ fn parse_cmd(mut cmd: &str) -> Option<Vec<String>> {
56 let mut args = Vec::<String>::new(); 56 let mut args = Vec::<String>::new();
57 57
58 cmd = cmd.trim_matches(is_posix_space); 58 cmd = cmd.trim_matches(is_posix_space);
59 while cmd != "" { 59 while !cmd.is_empty() {
60 if cmd.starts_with('\'') { 60 if cmd.starts_with('\'') {
61 let (arg, remaining) = parse_sq(cmd)?; 61 let (arg, remaining) = parse_sq(cmd)?;
62 args.push(arg); 62 args.push(arg);
@@ -91,7 +91,7 @@ fn main() -> ExitCode {
91 eprintln!("Missing argument for argument '-c'"); 91 eprintln!("Missing argument for argument '-c'");
92 return bad_usage; 92 return bad_usage;
93 }; 93 };
94 if args.next() != None { 94 if args.next().is_some() {
95 eprintln!("Too many arguments passed"); 95 eprintln!("Too many arguments passed");
96 return bad_usage; 96 return bad_usage;
97 } 97 }