root: Use new format for building self

This commit is contained in:
adisbladis 2022-05-28 21:50:18 +08:00
parent 44bb5b9495
commit 33b65aa13e
3 changed files with 86 additions and 193 deletions

View file

@ -3,7 +3,7 @@ source $stdenv/setup
export HOME=$(mktemp -d) export HOME=$(mktemp -d)
# Call once first outside of subshell for better error reporting # Call once first outside of subshell for better error reporting
go mod download -x "$goPackagePath@$version" go mod download "$goPackagePath@$version"
dir=$(go mod download --json "$goPackagePath@$version" | jq -r .Dir) dir=$(go mod download --json "$goPackagePath@$version" | jq -r .Dir)

View file

@ -1,6 +1,7 @@
{ buildGoApplication, lib, makeWrapper, nix-prefetch-git }: { buildGoApplication, go, nix, lib, makeWrapper, nix-prefetch-git }:
buildGoApplication { buildGoApplication {
inherit go;
pname = "gomod2nix"; pname = "gomod2nix";
version = "0.1"; version = "0.1";
src = lib.cleanSourceWith { src = lib.cleanSourceWith {
@ -9,12 +10,14 @@ buildGoApplication {
}; };
modules = ./gomod2nix.toml; modules = ./gomod2nix.toml;
allowGoReference = true;
subPackages = [ "." ]; subPackages = [ "." ];
nativeBuildInputs = [ makeWrapper ]; nativeBuildInputs = [ makeWrapper ];
postInstall = '' postInstall = ''
wrapProgram $out/bin/gomod2nix --prefix PATH : ${lib.makeBinPath [ nix-prefetch-git ]} wrapProgram $out/bin/gomod2nix --prefix PATH : ${lib.makeBinPath [ go ]}
rm -f $out/bin/builder rm -f $out/bin/builder
''; '';
} }

View file

@ -1,191 +1,81 @@
["github.com/BurntSushi/toml"] schema = 1
sumVersion = "v0.3.1"
["github.com/BurntSushi/toml".fetch]
type = "git"
url = "https://github.com/BurntSushi/toml"
rev = "3012a1dbe2e4bd1391d42b32f0577cb7bbc7f005"
sha256 = "1fjdwwfzyzllgiwydknf1pwjvy49qxfsczqx5gz3y0izs7as99j6"
["github.com/alecthomas/assert"] [mod]
sumVersion = "v0.0.0-20170929043011-405dbfeb8e38" [mod."github.com/BurntSushi/toml"]
["github.com/alecthomas/assert".fetch] version = "v0.3.1"
type = "git" hash = "sha256-Rqak1dE/Aj/+Kx1/pl3Hifgt+Q3OzuZ5fJR+/x3nTbo="
url = "https://github.com/alecthomas/assert" [mod."github.com/alecthomas/kong"]
rev = "405dbfeb8e38effee6e723317226e93fff912d06" version = "v0.5.0"
sha256 = "1l567pi17k593nrd1qlbmiq8z9jy3qs60px2a16fdpzjsizwqx8l" hash = "sha256-6OtTXBnZSVvbdgkAfah2EuX20Fg/2v3JRSnKq1QoJbA="
[mod."github.com/alecthomas/participle/v2"]
["github.com/alecthomas/colour"] version = "v2.0.0-alpha7"
sumVersion = "v0.0.0-20160524082231-60882d9e2721" hash = "sha256-Iy3/FxQ9kb0rp7N7olD/FuMNEja3OtPce61uGKjWReE="
["github.com/alecthomas/colour".fetch] [mod."github.com/alecthomas/repr"]
type = "git" version = "v0.0.0-20210801044451-80ca428c5142"
url = "https://github.com/alecthomas/colour" hash = "sha256-XUx+sN0wtc1j4t83sa5Z2MOBHxYQUUfsFfgfBeZqCUQ="
rev = "60882d9e27213e8552dcff6328914fe4c2b44bc9" [mod."github.com/davecgh/go-spew"]
sha256 = "0iq566534gbzkd16ixg7fk298wd766821vvs80838yifx9yml5vs" version = "v1.1.1"
hash = "sha256-nhzSUrE1fCkN0+RL04N4h8jWmRFPPPWbCuDc7Ss0akI="
["github.com/alecthomas/kingpin"] [mod."github.com/google/go-cmp"]
sumVersion = "v2.2.6+incompatible" version = "v0.5.5"
["github.com/alecthomas/kingpin".fetch] hash = "sha256-pyfTIu1fx6cGYHhm+yi8YP2TgERnnqKRjqSV7WGb1Yk="
type = "git" [mod."github.com/kr/pretty"]
url = "https://github.com/alecthomas/kingpin" version = "v0.1.0"
rev = "947dcec5ba9c011838740e680966fd7087a71d0d" hash = "sha256-Fx+TaNrxW0VfzonT2jnd5MU09RRz7GJZkqAtJR6/pKI="
sha256 = "0mndnv3hdngr3bxp7yxfd47cas4prv98sqw534mx7vp38gd88n5r" [mod."github.com/kr/pty"]
version = "v1.1.1"
["github.com/alecthomas/repr"] hash = "sha256-AVeS+ivwNzIrgWQaLtsmO2f2MYGpxIVqdac/EzaYI1Q="
sumVersion = "v0.0.0-20180818092828-117648cd9897" [mod."github.com/kr/text"]
["github.com/alecthomas/repr".fetch] version = "v0.1.0"
type = "git" hash = "sha256-QT65kTrNypS5GPWGvgnCpGLPlVbQAL4IYvuqAKhepb4="
url = "https://github.com/alecthomas/repr" [mod."github.com/nix-community/go-nix"]
rev = "117648cd9897bc621d6d52cd05727b9abdd5528a" version = "v0.0.0-20220528121639-b940fb0a12d8"
sha256 = "05v1rgzdqc8razf702laagrvhvx68xd9yxxmzd3dyz0d6425pdrp" hash = "sha256-r6fq1mu0gRFqdI6msuAZp3ZoncAw5L16oBFPUA9vPYk="
[mod."github.com/pkg/errors"]
["github.com/alecthomas/template"] version = "v0.9.1"
sumVersion = "v0.0.0-20160405071501-a0175ee3bccc" hash = "sha256-mNfQtcrQmu3sNg/7IwiieKWOgFQOVVe2yXgKBpe/wZw="
["github.com/alecthomas/template".fetch] [mod."github.com/pmezard/go-difflib"]
type = "git" version = "v1.0.0"
url = "https://github.com/alecthomas/template" hash = "sha256-/FtmHnaGjdvEIKAJtrUfEhV7EVo5A/eYrtdnUkuxLDA="
rev = "a0175ee3bccc567396460bf5acd36800cb10c49c" [mod."github.com/sirupsen/logrus"]
sha256 = "0qjgvvh26vk1cyfq9fadyhfgdj36f1iapbmr5xp6zqipldz8ffxj" version = "v1.7.0"
hash = "sha256-VClDP4DJDdMFTMGWR7I8L4hQRMU7cOphLRyUfxCvnNY="
["github.com/alecthomas/units"] [mod."github.com/stretchr/objx"]
sumVersion = "v0.0.0-20151022065526-2efee857e7cf" version = "v0.1.0"
["github.com/alecthomas/units".fetch] hash = "sha256-az0Vd4MG3JXfaYbj0Q6AOmNkrXgmXDeQm8+BBiDXmdA="
type = "git" [mod."github.com/stretchr/testify"]
url = "https://github.com/alecthomas/units" version = "v1.7.0"
rev = "2efee857e7cfd4f3d0138cc3cbb1b4966962b93a" hash = "sha256-t1I9uCrn9vSUu/z5IZuNyGShmbOcJ6UGc2f75ZBrHzE="
sha256 = "1j65b91qb9sbrml9cpabfrcf07wmgzzghrl7809hjjhrmbzri5bl" [mod."golang.org/x/crypto"]
version = "v0.0.0-20191011191535-87dc89f01550"
["github.com/davecgh/go-spew"] hash = "sha256-T0CaT5ri68osnd9VdNTZ0Ys+exaVbX4iC8MN60UNkXw="
sumVersion = "v1.1.1" [mod."golang.org/x/mod"]
["github.com/davecgh/go-spew".fetch] version = "v0.3.0"
type = "git" hash = "sha256-c+KKzeDUDxrKIx8un1DpETlTK+DmHP+zUjRZrgs0ejo="
url = "https://github.com/davecgh/go-spew" [mod."golang.org/x/net"]
rev = "8991bc29aa16c548c550c7ff78260e27b9ab7c73" version = "v0.0.0-20190620200207-3b0461eec859"
sha256 = "0hka6hmyvp701adzag2g26cxdj47g21x6jz4sc6jjz1mn59d474y" hash = "sha256-lVNbp7zOBVbvzA1fFR4SkUskYfAMt2eILoWuDgk0oS4="
[mod."golang.org/x/sync"]
["github.com/mattn/go-isatty"] version = "v0.0.0-20190423024810-112230192c58"
sumVersion = "v0.0.3" hash = "sha256-1lGQ6frW6gwuLzwomu530IsFh7vlQWQOphQ0IQeZIhY="
["github.com/mattn/go-isatty".fetch] [mod."golang.org/x/sys"]
type = "git" version = "v0.0.0-20220519141025-dcacdad47464"
url = "https://github.com/mattn/go-isatty" hash = "sha256-N4P3QkaeRf05dFMadS1IvhkNV4VS6cf/zkTBY1zwWv4="
rev = "0360b2af4f38e8d38c7fce2a9f4e702702d73a39" [mod."golang.org/x/text"]
sha256 = "06w45aqz2a6yrk25axbly2k5wmsccv8cspb94bfmz4izvw8h927n" version = "v0.3.0"
hash = "sha256-0FFbaxF1ZuAQF3sCcA85e8MO6prFeHint36inija4NY="
["github.com/orivej/e"] [mod."golang.org/x/tools"]
sumVersion = "v0.0.0-20180728214217-ac3492690fda" version = "v0.0.0-20191119224855-298f0cb1881e"
["github.com/orivej/e".fetch] hash = "sha256-xhp3MWK3dr+PJgfOGaFAURPdw/ar+GRb+wHBnCG8Tg0="
type = "git" [mod."golang.org/x/xerrors"]
url = "https://github.com/orivej/e" version = "v0.0.0-20191204190536-9bdfabe68543"
rev = "ac3492690fda471c5eab817efd86badf5c3ac158" hash = "sha256-DCyizuMVp9AhKGv0vL/iRZz/R6jWFmQxDWj1NFeITvo="
sha256 = "11jizr28kfkr6zscjxg95pqi6cjp08aqnhs41sdhc98nww78ilkr" [mod."gopkg.in/check.v1"]
version = "v1.0.0-20180628173108-788fd7840127"
["github.com/orivej/go-nix"] hash = "sha256-KsRJNTprd1UijnJusbHwQGM7Bdm45Jt/QL+cIUGNa2w="
sumVersion = "v0.0.0-20180830055821-dae45d921a44" [mod."gopkg.in/yaml.v2"]
["github.com/orivej/go-nix".fetch] version = "v2.2.2"
type = "git" hash = "sha256-SjNLmGSxoYabOi/zdjymW3mSgaxaS39btBQ3/aUIkgc="
url = "https://github.com/orivej/go-nix" [mod."gopkg.in/yaml.v3"]
rev = "dae45d921a44e6ec05b4ea2b00d8e9efadf770c3" version = "v3.0.0-20210107192922-496545a6307b"
sha256 = "17hfmsz8hs3h2d5c06j1bvbw8ijrhzm3iz911z5zydsl4x7y0cgy" hash = "sha256-j8yDji+vqsitpRZirpb4w/Em8nstgf28wpwkcrOlxBk="
["github.com/pkg/profile"]
sumVersion = "v1.2.1"
["github.com/pkg/profile".fetch]
type = "git"
url = "https://github.com/pkg/profile"
rev = "5b67d428864e92711fcbd2f8629456121a56d91f"
sha256 = "0blqmvgqvdbqmh3fp9pfdxc9w1qfshrr0zy9whj0sn372bw64qnr"
["github.com/pmezard/go-difflib"]
sumVersion = "v1.0.0"
["github.com/pmezard/go-difflib".fetch]
type = "git"
url = "https://github.com/pmezard/go-difflib"
rev = "792786c7400a136282c1664665ae0a8db921c6c2"
sha256 = "0c1cn55m4rypmscgf0rrb88pn58j3ysvc2d0432dp3c6fqg6cnzw"
["github.com/sergi/go-diff"]
sumVersion = "v1.0.0"
["github.com/sergi/go-diff".fetch]
type = "git"
url = "https://github.com/sergi/go-diff"
rev = "1744e2970ca51c86172c8190fadad617561ed6e7"
sha256 = "0swiazj8wphs2zmk1qgq75xza6m19snif94h2m6fi8dqkwqdl7c7"
["github.com/sirupsen/logrus"]
sumVersion = "v1.7.0"
["github.com/sirupsen/logrus".fetch]
type = "git"
url = "https://github.com/sirupsen/logrus"
rev = "6699a89a232f3db797f2e280639854bbc4b89725"
sha256 = "1a59pw7zimvm8k423iq9l4f4qjj1ia1xc6pkmhwl2mxc46y2n442"
["github.com/stretchr/testify"]
sumVersion = "v1.2.2"
["github.com/stretchr/testify".fetch]
type = "git"
url = "https://github.com/stretchr/testify"
rev = "f35b8ab0b5a2cef36673838d662e249dd9c94686"
sha256 = "0dlszlshlxbmmfxj5hlwgv3r22x0y1af45gn1vd198nvvs3pnvfs"
["golang.org/x/crypto"]
sumVersion = "v0.0.0-20191011191535-87dc89f01550"
["golang.org/x/crypto".fetch]
type = "git"
url = "https://go.googlesource.com/crypto"
rev = "87dc89f01550277dc22b74ffcf4cd89fa2f40f4c"
sha256 = "0z4i1m2yn3f31ci7wvcm2rxkx2yiv7a78mfzklncmsz2k97rlh2g"
["golang.org/x/mod"]
sumVersion = "v0.3.0"
["golang.org/x/mod".fetch]
type = "git"
url = "https://go.googlesource.com/mod"
rev = "859b3ef565e237f9f1a0fb6b55385c497545680d"
sha256 = "0ldgbx2zpprbsfn6p8pfgs4nn87gwbfcv2z0fa7n8alwsq2yw78q"
["golang.org/x/net"]
sumVersion = "v0.0.0-20190620200207-3b0461eec859"
["golang.org/x/net".fetch]
type = "git"
url = "https://go.googlesource.com/net"
rev = "3b0461eec859c4b73bb64fdc8285971fd33e3938"
sha256 = "0l00c8l0a8xnv6qdpwfzxxsr58jggacgzdrwiprrfx2xqm37b6d5"
["golang.org/x/sync"]
sumVersion = "v0.0.0-20190423024810-112230192c58"
["golang.org/x/sync".fetch]
type = "git"
url = "https://go.googlesource.com/sync"
rev = "112230192c580c3556b8cee6403af37a4fc5f28c"
sha256 = "05i2k43j2d0llq768hg5pf3hb2yhfzp9la1w5wp0rsnnzblr0lfn"
["golang.org/x/sys"]
sumVersion = "v0.0.0-20191026070338-33540a1f6037"
["golang.org/x/sys".fetch]
type = "git"
url = "https://go.googlesource.com/sys"
rev = "33540a1f603772f9d4b761f416f5c10dade23e96"
sha256 = "0fjcv0vzvi6za0b4xmnk3932pr9f9gczzf03y0kgq3ry9rqg169y"
["golang.org/x/text"]
sumVersion = "v0.3.0"
["golang.org/x/text".fetch]
type = "git"
url = "https://go.googlesource.com/text"
rev = "f21a4dfb5e38f5895301dc265a8def02365cc3d0"
sha256 = "0r6x6zjzhr8ksqlpiwm5gdd7s209kwk5p4lw54xjvz10cs3qlq19"
["golang.org/x/tools"]
sumVersion = "v0.0.0-20191119224855-298f0cb1881e"
["golang.org/x/tools".fetch]
type = "git"
url = "https://go.googlesource.com/tools"
rev = "298f0cb1881e71e68bc5bc17757fabe78a426460"
sha256 = "0l4pqwib2wnfnix6nvxl0yrq87ipi7ff1rz6z5bxfzy9dki1nzmv"
["golang.org/x/xerrors"]
sumVersion = "v0.0.0-20191011141410-1b5146add898"
["golang.org/x/xerrors".fetch]
type = "git"
url = "https://go.googlesource.com/xerrors"
rev = "1b5146add8981d58be77b16229c0ff0f8bebd8c1"
sha256 = "0w2akj91krxjag0xdhsg78470888nicc5ismc2ap9jqpss6v1zih"