Skip to content

Commit

Permalink
Improve git deps parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
Mifom committed Mar 31, 2022
1 parent 149164a commit 1a7d76a
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,16 @@
(pkg:

let
isGit = builtins.match ''git\+(.*)\?rev=([0-9a-f]+)(#.*)?'' pkg.source;
gitRegexp = x: builtins.match "git\+(.*)\?((branch=(.+)#([0-9a-f]+)(#.*)?)|(rev=([0-9a-f]+)(#.*)?))" x;
isGit = x: let gitArr = gitRegexp x; in
if isNull gitArr then
null
else
let url_ = builtins.elemAt gitArr 0;
url = builtins.substring 1 (builtins.stringLength url_ - 2) url_;
rev5 = builtins.elemAt gitArr 4;
rev8 = builtins.elemAt gitArr 7;
in if isNull rev5 then [url rev8] else [url rev5];
isRegistry = builtins.match ''registry\+(.*)'' pkg.source;
in

Expand Down

0 comments on commit 1a7d76a

Please sign in to comment.