diff --git a/flake.nix b/flake.nix index eb62d70..376549b 100644 --- a/flake.nix +++ b/flake.nix @@ -1,12 +1,13 @@ { outputs = inputs: let inherit (builtins) fromJSON readFile fetchClosure attrValues; - inherit (import ./lib.nix) filterAttrs symlinkPath sane mapAndMergeAttrs aggregate optionalAttr; + inherit (import ./lib.nix) filterAttrs symlinkPath sane mapAndMergeAttrs aggregate optionalAttr last; # This is a really verbose name, but it ensures we don't get collisions nameOf = flakeUrl: pkg: let - parts = builtins.split "\\." flakeUrl; - name = builtins.elemAt parts ((builtins.length parts) - 1); + fragment = builtins.split "#" flakeUrl; + parts = builtins.split "\\." (last fragment); + name = last parts; in sane "${name}-${pkg.org_name}-${pkg.repo_name}-${pkg.version}"; diff --git a/lib.nix b/lib.nix index 3ca89b6..6653feb 100644 --- a/lib.nix +++ b/lib.nix @@ -99,6 +99,8 @@ let if hasAttr name attrs then {${name} = attrs.${name};} else {}; + + last = list: elemAt list ((length list) - 1); in { - inherit filterAttrs mapAndMergeAttrs sane symlinkPath aggregate optionalAttr; + inherit filterAttrs mapAndMergeAttrs sane symlinkPath aggregate optionalAttr last; }