diff --git a/nix/pkgs.nix b/nix/pkgs.nix index bcb2cd4..24042f3 100644 --- a/nix/pkgs.nix +++ b/nix/pkgs.nix @@ -11,5 +11,5 @@ let }; in { - inherit pkgs hp; + inherit pkgs hp sources; } diff --git a/nix/toc.nix b/nix/toc.nix index 22b9cef..541a06f 100644 --- a/nix/toc.nix +++ b/nix/toc.nix @@ -4,26 +4,54 @@ let packages = import ./pkgs.nix { inherit compiler; }; - inherit (packages) pkgs; + inherit (packages) pkgs sources; - toc = pkgs.stdenv.mkDerivation { - name = "gh-md-toc-24-05-2020"; + toc = pkgs.resholve.mkDerivation { + pname = "gh-md-toc"; + version = sources.github-markdown-toc.version; - src = builtins.fetchurl { - url = "https://raw.githubusercontent.com/ekalinin/github-markdown-toc/488f310064b16c1eb9c17862cc5844189ee65955/gh-md-toc"; - sha256 = "1253n0qw3xgikl7gcdicg3vmc3wzz6122bmhmffj1irrachq89fi"; - }; + src = sources.github-markdown-toc; - phases = [ - "installPhase" - "patchPhase" - ]; + dontConfigure = true; + dontBuild = true; installPhase = '' - mkdir -p $out/bin - cp $src $out/bin/gh-md-toc - chmod +x $out/bin/gh-md-toc + runHook preInstall + + mkdir -p "$out/bin" + cp gh-md-toc "$out/bin/gh-md-toc" + chmod +x "$out/bin/gh-md-toc" + + runHook postInstall ''; + + solutions = { + default = { + scripts = [ "bin/gh-md-toc" ]; + interpreter = "${pkgs.bash}/bin/bash"; + inputs = [ + pkgs.bash + pkgs.coreutils + pkgs.curl + pkgs.gawk + pkgs.gnugrep + pkgs.gnused + # which + ]; + fix = { + "$grepcmd" = [ "grep" "-Eo" ]; + "$SHELL" = [ "bash" ]; + }; + keep = { + "$tool" = true; + }; + fake = { + external = [ + "wget" + ]; + }; + }; + }; }; in pkgs.writeShellScriptBin "update-toc" '' diff --git a/npins/sources.json b/npins/sources.json index b299682..a274f5b 100644 --- a/npins/sources.json +++ b/npins/sources.json @@ -1,5 +1,20 @@ { "pins": { + "github-markdown-toc": { + "type": "GitRelease", + "repository": { + "type": "GitHub", + "owner": "ekalinin", + "repo": "github-markdown-toc" + }, + "pre_releases": false, + "version_upper_bound": null, + "release_prefix": null, + "version": "0.10.0", + "revision": "7d0a86b3be2e8e959cd9747fcf2c4a1f0e6a24eb", + "url": "https://api.github.com/repos/ekalinin/github-markdown-toc/tarball/0.10.0", + "hash": "14gnj1pwbscs0bj1wkzc342r0v1d5ib4c8bizyqg5djkl4j3rlzh" + }, "nixpkgs": { "type": "Channel", "name": "nixos-unstable",