summary refs log tree commit diff
path: root/pkgs/servers/dns
diff options
context:
space:
mode:
authorrnhmjoj <rnhmjoj@inventati.org>2021-09-08 22:38:57 +0200
committerrnhmjoj <rnhmjoj@inventati.org>2021-09-11 23:22:45 +0200
commit7a9f5d69c88efbf907bbffacaa21fbf159d23284 (patch)
tree4e1c460cfa8f0bc1062d21462b1440ded2f47102 /pkgs/servers/dns
parentd559051a1c578db37a8e85e132a07d8466b9cd37 (diff)
downloadnixpkgs-7a9f5d69c88efbf907bbffacaa21fbf159d23284.tar
nixpkgs-7a9f5d69c88efbf907bbffacaa21fbf159d23284.tar.gz
nixpkgs-7a9f5d69c88efbf907bbffacaa21fbf159d23284.tar.bz2
nixpkgs-7a9f5d69c88efbf907bbffacaa21fbf159d23284.tar.lz
nixpkgs-7a9f5d69c88efbf907bbffacaa21fbf159d23284.tar.xz
nixpkgs-7a9f5d69c88efbf907bbffacaa21fbf159d23284.tar.zst
nixpkgs-7a9f5d69c88efbf907bbffacaa21fbf159d23284.zip
ncdns: 2020-11-22 -> 2021-07-18
Diffstat (limited to 'pkgs/servers/dns')
-rw-r--r--pkgs/servers/dns/ncdns/default.nix102
-rw-r--r--pkgs/servers/dns/ncdns/deps.nix318
2 files changed, 89 insertions, 331 deletions
diff --git a/pkgs/servers/dns/ncdns/default.nix b/pkgs/servers/dns/ncdns/default.nix
index b046aff12bd..7fad548df7a 100644
--- a/pkgs/servers/dns/ncdns/default.nix
+++ b/pkgs/servers/dns/ncdns/default.nix
@@ -1,27 +1,103 @@
-{ lib, nixosTests, git, buildGoPackage, fetchFromGitHub, libcap }:
+{ lib
+, buildGoModule
+, fetchFromGitHub
+, nixosTests
+, libcap
+}:
 
-buildGoPackage rec {
-  pname = "ncdns";
-  version = "2020-11-22";
-
-  goPackagePath = "github.com/namecoin/ncdns";
-  goDeps = ./deps.nix;
+let
 
-  src = fetchFromGitHub {
+  # ncdns source
+  ncdns = fetchFromGitHub {
     owner = "namecoin";
     repo = "ncdns";
-    rev = "2fa54cd3b5480dba82170ab8ecb511fbd4977c41";
-    sha256 = "0mrxbg5lmy3s281ff6nxpp03z4mqwq7h5hkqm9qy8nb280x1sx7h";
+    rev = "2a486311b0fe1a921af34aa3b31e6e4e0569accc";
+    sha256 = "01arwlycp1iia4bd3dgyn8dam1av2a7d9hv7f085n14l2i2aza7v";
+  };
+
+  # script to patch the crypto/x509 package
+  x509 = fetchFromGitHub {
+    owner = "namecoin";
+    repo = "x509-compressed";
+    rev = "fb9f2b7bc9fcba954d70f63857cc0c3841b1cf47";
+    sha256 = "1arkbpbzvhcmz5fhjqg34x2jbjnwmlisapk22rjki17qpamh7zks";
+    # ncdns must be put in a subdirectory for this to work.
+    extraPostFetch = ''
+      cp -r --no-preserve=mode "${ncdns}" "$out/ncdns"
+    '';
   };
 
-  patches = [ ./fix-tpl-path.patch ];
+in
+
+buildGoModule {
+  pname = "ncdns";
+  version = "unstable-2020-07-18";
+
+  src = x509;
+
+  vendorSha256 = "02bqf6vkj5msk35sr5sklnqqd16n7gns7knzqslw077xrxiz7bsg";
+
+  # Override the go-modules fetcher derivation to apply
+  # upstream's patch of the crypto/x509 library.
+  modBuildPhase = ''
+    go mod init github.com/namecoin/x509-compressed
+    go generate ./...
+    go mod tidy
+
+    cd ncdns
+    go mod init github.com/namecoin/ncdns
+    go mod edit \
+      -replace github.com/coreos/go-systemd=github.com/coreos/go-systemd/v22@latest \
+      -replace github.com/namecoin/x509-compressed=$NIX_BUILD_TOP/source
+    go mod tidy
+  '';
+
+  # Copy over the lockfiles as well, because the source
+  # doesn't contain it. The fixed-output derivation is
+  # probably not reproducible anyway.
+  modInstallPhase = ''
+    mv -t vendor go.mod go.sum
+    cp -r --reflink=auto vendor "$out"
+  '';
 
   buildInputs = [ libcap ];
 
+  # The fetcher derivation must run with a different
+  # $sourceRoot, but buildGoModule doesn't allow that,
+  # so we use this ugly hack.
+  unpackPhase = ''
+    runHook preUnpack
+
+    unpackFile "$src"
+    sourceRoot=$PWD/source/ncdns
+    chmod -R u+w -- "$sourceRoot"
+    cd $sourceRoot
+
+    runHook postUpack
+  '';
+
+  # Same as above: can't use `patches` because that would
+  # be also applied to the fetcher derivation, thus failing.
+  patchPhase = ''
+    runHook prePatch
+    patch -p1 < ${./fix-tpl-path.patch}
+    runHook postPatch
+  '';
+
+  preBuild = ''
+    chmod -R u+w vendor
+    mv -t . vendor/go.{mod,sum}
+  '';
+
+  preCheck = ''
+    # needed to run the ncdns test suite
+    ln -s $PWD/vendor ../../go/src
+  '';
+
   postInstall = ''
     mkdir -p "$out/share"
-    cp -r "$src/_doc" "$out/share/doc"
-    cp -r "$src/_tpl" "$out/share/tpl"
+    cp -r _doc "$out/share/doc"
+    cp -r _tpl "$out/share/tpl"
   '';
 
   meta = with lib; {
diff --git a/pkgs/servers/dns/ncdns/deps.nix b/pkgs/servers/dns/ncdns/deps.nix
deleted file mode 100644
index f48faa9648b..00000000000
--- a/pkgs/servers/dns/ncdns/deps.nix
+++ /dev/null
@@ -1,318 +0,0 @@
-# This file was generated by https://github.com/kamilchm/go2nix v1.3.0
-[
-  {
-    goPackagePath = "github.com/BurntSushi/toml";
-    fetch = {
-      type = "git";
-      url = "https://github.com/BurntSushi/toml";
-      rev = "ea60c4def909bde529d41a7e0674e31eba751da3";
-      sha256 = "08xhd9jlgkql8kqpi98aaq9k8hgb6x7197r6crp84r1ic8k7im4y";
-    };
-  }
-  {
-    goPackagePath = "github.com/alecthomas/template";
-    fetch = {
-      type = "git";
-      url = "https://github.com/alecthomas/template";
-      rev = "fb15b899a75114aa79cc930e33c46b577cc664b1";
-      sha256 = "1vlasv4dgycydh5wx6jdcvz40zdv90zz1h7836z7lhsi2ymvii26";
-    };
-  }
-  {
-    goPackagePath = "github.com/alecthomas/units";
-    fetch = {
-      type = "git";
-      url = "https://github.com/alecthomas/units";
-      rev = "1786d5ef83d4868925e518b2995c30430aec0f06";
-      sha256 = "1grs2y4gnyq8wv9w61c231a01c7qd916b7rxqy798b8sfirr3ci8";
-    };
-  }
-  {
-    goPackagePath = "github.com/btcsuite/btcd";
-    fetch = {
-      type = "git";
-      url = "https://github.com/btcsuite/btcd";
-      rev = "6bd4c64a54faeb343d5e3c1ee5802450a291787f";
-      sha256 = "15plh7rrmx1ydy3ldnylr727s9szrrkqzbf2ma2ka2qag1vy6nvb";
-    };
-  }
-  {
-    goPackagePath = "github.com/btcsuite/btclog";
-    fetch = {
-      type = "git";
-      url = "https://github.com/btcsuite/btclog";
-      rev = "84c8d2346e9fc8c7b947e243b9c24e6df9fd206a";
-      sha256 = "02dl46wcnfpg9sqvg0ipipkpnd7lrf4fnvb9zy56jqa7mfcwc7wk";
-    };
-  }
-  {
-    goPackagePath = "github.com/btcsuite/btcutil";
-    fetch = {
-      type = "git";
-      url = "https://github.com/btcsuite/btcutil";
-      rev = "a53e38424cce1c9de2062b69364efd35fd428d15";
-      sha256 = "1izjvgi0d5wnknfwdnqa196hn4vj1n5ga7swbhcfsgghk2zngwr4";
-    };
-  }
-  {
-    goPackagePath = "github.com/btcsuite/go-socks";
-    fetch = {
-      type = "git";
-      url = "https://github.com/btcsuite/go-socks";
-      rev = "4720035b7bfd2a9bb130b1c184f8bbe41b6f0d0f";
-      sha256 = "18cv2icj059lq4s99p6yh91hlas5f2gi3f1p4c10sjgwrs933d7b";
-    };
-  }
-  {
-    goPackagePath = "github.com/btcsuite/websocket";
-    fetch = {
-      type = "git";
-      url = "https://github.com/btcsuite/websocket";
-      rev = "31079b6807923eb23992c421b114992b95131b55";
-      sha256 = "0xpkf257ml6fpfdgv7hxxc41n0d5yxxm3njm50qpzp7j71l9cjwa";
-    };
-  }
-  {
-    goPackagePath = "github.com/coreos/go-systemd";
-    fetch = {
-      type = "git";
-      url = "https://github.com/coreos/go-systemd";
-      rev = "87511f396ae9991f8589f6e6dcf58e28a91ba52b";
-      sha256 = "139ylav4vl4h7ndy1xkj0dn45rbknv2rfjlifrj622n96c4rrazx";
-    };
-  }
-  {
-    goPackagePath = "github.com/golang/groupcache";
-    fetch = {
-      type = "git";
-      url = "https://github.com/golang/groupcache";
-      rev = "8c9f03a8e57eb486e42badaed3fb287da51807ba";
-      sha256 = "0vjjr79r32icjzlb05wn02k59av7jx0rn1jijml8r4whlg7dnkfh";
-    };
-  }
-  {
-    goPackagePath = "github.com/hlandau/buildinfo";
-    fetch = {
-      type = "git";
-      url = "https://github.com/hlandau/buildinfo";
-      rev = "337a29b5499734e584d4630ce535af64c5fe7813";
-      sha256 = "1kq3r1i4rr9bcvj5yg8w1l95f6sfc3kn6kgcdmlh5i3j9w2sram8";
-    };
-  }
-  {
-    goPackagePath = "github.com/hlandau/degoutils";
-    fetch = {
-      type = "git";
-      url = "https://github.com/hlandau/degoutils";
-      rev = "8fa2440b63444dad556d76366f1c3ee070c8a577";
-      sha256 = "1yj39jbrk3xx3cyl8f4asakc74lsl0brasi25xjf6219pg69q0iy";
-    };
-  }
-  {
-    goPackagePath = "github.com/hlandau/dexlogconfig";
-    fetch = {
-      type = "git";
-      url = "https://github.com/hlandau/dexlogconfig";
-      rev = "244f29bd260884993b176cd14ef2f7631f6f3c18";
-      sha256 = "1d01ghx6xawj3nk3lpk51wbbpxdnc9vzvijvlayvp7cxgsacslbc";
-    };
-  }
-  {
-    goPackagePath = "github.com/hlandau/xlog";
-    fetch = {
-      type = "git";
-      url = "https://github.com/hlandau/xlog";
-      rev = "197ef798aed28e08ed3e176e678fda81be993a31";
-      sha256 = "08rjlqnjbfgpz5rbjq89l7y5vyhk99ivr928sqdi5gnqznbqs4m8";
-    };
-  }
-  {
-    goPackagePath = "github.com/kr/pretty";
-    fetch = {
-      type = "git";
-      url = "https://github.com/kr/pretty";
-      rev = "a883a8422cd235c67c6c4fdcb7bbb022143e10b1";
-      sha256 = "0vp5ijbapw8j52c3l992m1wm8nhl23n68xk3lqxhad3srxmdb9z4";
-    };
-  }
-  {
-    goPackagePath = "github.com/kr/text";
-    fetch = {
-      type = "git";
-      url = "https://github.com/kr/text";
-      rev = "cafcf9720371e5625e7300397de921f58e069d17";
-      sha256 = "0q164xvv7nwgjq2l2lln4y7yp036jpwx8v7yfsz432czl10d4g0h";
-    };
-  }
-  {
-    goPackagePath = "github.com/mattn/go-isatty";
-    fetch = {
-      type = "git";
-      url = "https://github.com/mattn/go-isatty";
-      rev = "cb30d6282491c185f77d9bec5d25de1bb61a06bc";
-      sha256 = "0v59mv94acd2m72q8adhigxkx1vn38l5h0d8hp0nxga2v9f3v8kd";
-    };
-  }
-  {
-    goPackagePath = "github.com/miekg/dns";
-    fetch = {
-      type = "git";
-      url = "https://github.com/miekg/dns";
-      rev = "23c4faca9d32b0abbb6e179aa1aadc45ac53a916";
-      sha256 = "1iir2yrx71wg0ab9j4qm70aycym2pxrb043dmbknyzbw9s43cabz";
-    };
-  }
-  {
-    goPackagePath = "github.com/namecoin/btcd";
-    fetch = {
-      type = "git";
-      url = "https://github.com/namecoin/btcd";
-      rev = "69a10543311fa68737d0a77b4cd045b0b0abfb75";
-      sha256 = "1zbfigs3hrjhdwp19877lpgivdcz3k80149nxdmxlmp03xcswcqy";
-    };
-  }
-  {
-    goPackagePath = "github.com/namecoin/ncbtcjson";
-    fetch = {
-      type = "git";
-      url = "https://github.com/namecoin/ncbtcjson";
-      rev = "fa221af062c70f802db6ed66e1546cc4a41ec277";
-      sha256 = "1fmz5aylsji27vj5f3f3gg9xj99735gh5prvcfz0gmk68v1mnr4i";
-    };
-  }
-  {
-    goPackagePath = "github.com/namecoin/ncrpcclient";
-    fetch = {
-      type = "git";
-      url = "https://github.com/namecoin/ncrpcclient";
-      rev = "858e1a5acd8b2da56462f50323633cdf2fe80977";
-      sha256 = "0pj951wm6fdkk2yv4bxaxka52i7rb6w3fs9ah3fy7p8wchr4smjx";
-    };
-  }
-  {
-    goPackagePath = "github.com/namecoin/splicesign";
-    fetch = {
-      type = "git";
-      url = "https://github.com/namecoin/splicesign";
-      rev = "38bb6fb3ec66c72ecb3a14e1e714768cc6e56ed7";
-      sha256 = "0irlbcrarbrvzdnph9kxrf8bkij1lzqpp5mxh8i60n5ii7bj0wsd";
-    };
-  }
-  {
-    goPackagePath = "github.com/namecoin/tlsrestrictnss";
-    fetch = {
-      type = "git";
-      url = "https://github.com/namecoin/tlsrestrictnss";
-      rev = "945a9f3d995fcb175fd0b19549e21a3e87ba8c13";
-      sha256 = "18qphkqnjw3bwflkyyrddyzgwscs37j7y6ynm9g78bqb5skviqqy";
-    };
-  }
-  {
-    goPackagePath = "github.com/ogier/pflag";
-    fetch = {
-      type = "git";
-      url = "https://github.com/ogier/pflag";
-      rev = "73e519546fc0bce0c395610afcf6aa4e5aec88eb";
-      sha256 = "114zpgl6l47gsz0sifpq62hi2i6k0ra9hi8wx7d39giablf9i4ii";
-    };
-  }
-  {
-    goPackagePath = "github.com/rogpeppe/go-internal";
-    fetch = {
-      type = "git";
-      url = "https://github.com/rogpeppe/go-internal";
-      rev = "eea92b9e2c4424af886c8c620efa50fff5a56387";
-      sha256 = "0lf4x32af40ixnysfzfm9r08gpsd3k3x7p3hr2k8q72llsa1zivz";
-    };
-  }
-  {
-    goPackagePath = "github.com/shiena/ansicolor";
-    fetch = {
-      type = "git";
-      url = "https://github.com/shiena/ansicolor";
-      rev = "c7312218db184c554578219828d6c9498d02dcb1";
-      sha256 = "14mhp5ir1vlshja9bam6df5wpbqdwg46qn1ysixjiap535ajhkza";
-    };
-  }
-  {
-    goPackagePath = "golang.org/x/crypto";
-    fetch = {
-      type = "git";
-      url = "https://go.googlesource.com/crypto";
-      rev = "eec23a3978adcfd26c29f4153eaa3e3d9b2cc53a";
-      sha256 = "18cf6vhmx7v83ahyil7j8hkwhwf1012bgixglz7a6nc35qwwqb3r";
-    };
-  }
-  {
-    goPackagePath = "golang.org/x/net";
-    fetch = {
-      type = "git";
-      url = "https://go.googlesource.com/net";
-      rev = "6772e930b67bb09bf22262c7378e7d2f67cf59d1";
-      sha256 = "0zlr39dxbg0fxfdrc20c4x0pw43n9kz749ssml97cdzqy116p5qa";
-    };
-  }
-  {
-    goPackagePath = "golang.org/x/sys";
-    fetch = {
-      type = "git";
-      url = "https://go.googlesource.com/sys";
-      rev = "0d417f6369309be088e227ead8736fb722d759d3";
-      sha256 = "1cn19s7kg91alianr1c1bp6k6p1wccigg19h6fchd84jb2zakkvs";
-    };
-  }
-  {
-    goPackagePath = "gopkg.in/alecthomas/kingpin.v2";
-    fetch = {
-      type = "git";
-      url = "https://gopkg.in/alecthomas/kingpin.v2";
-      rev = "947dcec5ba9c011838740e680966fd7087a71d0d";
-      sha256 = "0mndnv3hdngr3bxp7yxfd47cas4prv98sqw534mx7vp38gd88n5r";
-    };
-  }
-  {
-    goPackagePath = "gopkg.in/hlandau/configurable.v1";
-    fetch = {
-      type = "git";
-      url = "https://gopkg.in/hlandau/configurable.v1";
-      rev = "41496864a1fe3e0fef2973f22372b755d2897402";
-      sha256 = "0i9jbdvi8rz12xsrzzbfxg5lwsqakjcmccsa5a32asmv26k5byqa";
-    };
-  }
-  {
-    goPackagePath = "gopkg.in/hlandau/easyconfig.v1";
-    fetch = {
-      type = "git";
-      url = "https://gopkg.in/hlandau/easyconfig.v1";
-      rev = "c31249162931b4963bbe6e501cccb60d23271a3f";
-      sha256 = "1v8j1pyzcfj1l4pmb1c6mszci6xzc4agdam2kq79kyvbsvbbw9dc";
-    };
-  }
-  {
-    goPackagePath = "gopkg.in/hlandau/madns.v2";
-    fetch = {
-      type = "git";
-      url = "https://gopkg.in/hlandau/madns.v2";
-      rev = "26979b3e4b5aa3e0bd53cf0a014f9eaf43b578e3";
-      sha256 = "09r4m4mqdgd7hvxyvss9m64lq0kk8nylnq2bgnkrclgzpi87fmmb";
-    };
-  }
-  {
-    goPackagePath = "gopkg.in/hlandau/service.v2";
-    fetch = {
-      type = "git";
-      url = "https://gopkg.in/hlandau/service.v2";
-      rev = "b64b3467ebd16f64faec1640c25e318efc0c0d7b";
-      sha256 = "0lpx88f46ylx9lf6jgwcjgklll1pc1mlakrywpa0wzhjj7a4jinc";
-    };
-  }
-  {
-    goPackagePath = "gopkg.in/hlandau/svcutils.v1";
-    fetch = {
-      type = "git";
-      url = "https://gopkg.in/hlandau/svcutils.v1";
-      rev = "c25dac49e50cbbcbef8c81b089f56156f4067729";
-      sha256 = "12b6p71mk33r44d71xizjq82fls0ykfwfl5gnmckbgpxms4bj2xf";
-    };
-  }
-]