From d7cf95ad851e2966702f570c5038ae0ed1204e97 Mon Sep 17 00:00:00 2001 From: Andre Medeiros Date: Wed, 15 Jul 2020 19:26:47 -0400 Subject: [PATCH 1/5] build nix packages --- .github/workflows/populate-cache.yml | 31 +++++++++++++++ internal/catalog/bindata.go | 12 +++--- internal/catalog/data/ruby/2.6.6.nix | 9 +++-- internal/catalog/data/ruby/2.7.1.nix | 9 +++-- internal/cli/nix.go | 56 ++++++++++++++++++++++++++++ internal/nix/derivation.go | 4 +- internal/nix/package.go | 37 ++++++++++++++++++ 7 files changed, 144 insertions(+), 14 deletions(-) create mode 100644 .github/workflows/populate-cache.yml create mode 100644 internal/cli/nix.go diff --git a/.github/workflows/populate-cache.yml b/.github/workflows/populate-cache.yml new file mode 100644 index 0000000..c207c82 --- /dev/null +++ b/.github/workflows/populate-cache.yml @@ -0,0 +1,31 @@ +on: [push, pull_request] +name: Populate Cache +jobs: + populate: + name: "${{ matrix.dependency }} (${{ matrix.platform }})" + strategy: + fail-fast: false + matrix: + platform: [ubuntu-latest, macos-latest] + dependency: [crystal, golang, memcached, mysql, node, postgres, redis, ruby] + runs-on: ${{ matrix.platform }} + steps: + - name: Install Go + uses: actions/setup-go@v2 + with: + go-version: 1.14.x + - name: Install Nix + uses: cachix/install-nix-action@v10 + with: + nix_path: nixpkgs=channel:nixos-unstable + - name: Install Cachix + uses: cachix/cachix-action@v6 + with: + name: loon + signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}' + - name: Checkout code + uses: actions/checkout@v2 + - name: Build Loon + run: go build + - name: Build dependencies + run: ./loon nix build --all ${{ matrix.dependency }} diff --git a/internal/catalog/bindata.go b/internal/catalog/bindata.go index 682f6de..98865a3 100644 --- a/internal/catalog/bindata.go +++ b/internal/catalog/bindata.go @@ -604,7 +604,7 @@ func redisDefaultNix() (*asset, error) { return a, nil } -var _ruby266Nix = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x6c\x90\xcd\x8a\xc3\x20\x14\x85\xf7\x3e\xc5\x25\xb3\x99\x59\xd4\x44\x93\x18\xda\xd2\xc5\x3c\x49\xf1\xe7\x26\x91\x8a\x06\xb5\x81\x69\xc9\xbb\x0f\xa6\x0c\x74\x31\x1b\xf1\x1e\xf4\xf3\xf8\x7d\x3c\x9f\x60\x70\xb4\x1e\xa1\x32\x18\xed\x2a\xb3\x0d\xbe\x82\x6d\x23\x2e\x04\x7f\x88\x77\xf5\x73\xe0\x57\x71\x15\x70\x81\xe5\x36\x25\x5a\x12\x1a\x56\x8c\xd1\x1a\xfc\xce\x39\xa6\x4f\x59\xd6\x13\x3c\x09\xc0\x8a\x31\xd9\xe0\xe1\x02\x15\xa7\x82\x8a\xea\x4c\x00\x52\xd4\x7f\xb7\x47\xcc\x7a\xbe\x47\xb7\x1f\x06\x28\xbb\x0b\x54\x73\xce\x4b\x3a\xd5\xb5\x96\x7a\xc6\xfd\x85\x83\x93\x7e\xa2\x21\x4e\xf5\x72\x57\x75\x49\x6a\x4e\x45\xfd\xaa\x53\xc0\x34\xcb\x48\xa7\xc7\xce\x07\x48\xb3\xe4\x7d\xa9\x58\xb5\xa2\x53\xac\x6b\x0d\x8e\xad\x68\x94\xd4\x4c\x0d\x1d\xaa\x5e\xa0\x11\x8d\x62\xb2\x31\x5a\x8a\xae\x3d\xaa\xa6\x61\xfd\x20\x91\xb1\x71\x1c\x06\xd3\x6b\xc3\xf1\xc8\xf9\x91\xed\xc0\xed\x4c\xb6\xaf\x33\x29\x72\xd0\x9b\x22\x83\xbc\x8b\x5a\xa4\xbe\xc9\x09\xd3\x7f\x9a\xc8\xfe\x4d\x67\x95\xd5\xc1\xaf\xaf\x29\x2c\xe8\x53\x72\xaf\xe1\xe1\xac\x7a\x27\xff\x06\x00\x00\xff\xff\x96\x95\xca\x3a\x82\x01\x00\x00") +var _ruby266Nix = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x6c\x91\x4d\x6a\xc3\x30\x10\x85\xf7\x3a\xc5\xe0\x6e\x5a\x42\xe4\x7f\x99\xc4\x78\xd1\x65\xcf\x50\x4a\xd0\xcf\xd8\x16\x31\x92\x91\x64\x43\x13\x7c\xf7\x22\x97\x92\x2c\xba\x11\xe2\x63\xe6\xcd\xcc\x7b\x2f\xf7\x3b\x28\xec\xb5\x41\x48\x14\x3a\xbd\xf2\xa0\xad\x49\x60\xdb\xc8\x64\xad\x39\xba\x45\x7c\x1f\x8b\x0b\xbb\x30\xe8\x60\xbe\x0e\x9e\x46\x42\xed\x8a\xce\x69\x85\xef\x21\x38\xff\xca\xe3\x7b\x86\x3b\x01\x58\xd1\x79\x6d\x0d\x74\x90\x14\x94\x51\x96\xb4\x04\xc0\x3b\xf9\xd7\xdd\x63\x90\xe3\xe2\xa6\xbd\x18\x20\xfe\x3a\x48\xc6\x10\x66\x7f\x4e\x53\xc9\xe5\x88\xfb\x84\xe3\xc4\xcd\x40\xad\x1b\xd2\x79\x11\x69\x24\x69\x41\x59\xfa\xbb\x4e\x14\xa6\x81\x3b\x3a\xdc\x76\x7d\x00\x3f\xf2\xa2\x8e\x2b\x26\x25\xab\x44\x5e\x95\x0a\xfb\x92\x65\x82\xcb\x5c\x34\x15\x8a\x9a\xa1\x62\x99\xc8\x79\xa6\x24\x67\x55\x79\x12\x59\x96\xd7\x0d\xc7\x3c\xef\xfb\xa6\x51\xb5\x54\x05\x9e\x8a\xe2\x94\xef\x82\x5b\x4b\x08\x80\x58\xf4\xa4\x3e\xcc\xbc\x04\x0f\x1d\xec\x47\xd2\x67\x76\x38\xc0\xe7\x3e\x7d\xbf\x6c\xd2\x42\x4b\x6b\xd6\x07\xb1\x33\x1a\xef\xa7\x07\xb8\x4d\x5a\x10\x80\xaf\x96\x6c\x6f\x2d\x89\xd6\xa3\x51\xd1\x6a\xf2\x1c\xc3\xcc\xe5\x95\x0f\xe8\xff\x0b\xe1\xb9\xe9\x27\x00\x00\xff\xff\x81\xb3\x52\x51\xbb\x01\x00\x00") func ruby266NixBytes() ([]byte, error) { return bindataRead( @@ -619,12 +619,12 @@ func ruby266Nix() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "ruby/2.6.6.nix", size: 386, mode: os.FileMode(420), modTime: time.Unix(1594085619, 0)} + info := bindataFileInfo{name: "ruby/2.6.6.nix", size: 443, mode: os.FileMode(420), modTime: time.Unix(1594853860, 0)} a := &asset{bytes: bytes, info: info} return a, nil } -var _ruby271Nix = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x6c\x90\xcd\x8a\xf3\x20\x14\x86\xf7\x5e\xc5\x21\xdf\xe6\x9b\x45\x8d\xda\x24\x66\x5a\xba\x98\x2b\x09\xfe\x9c\x26\xd2\xa0\x41\x6d\x60\x5a\x72\xef\x83\x29\x03\x5d\xcc\x46\x7c\x5f\xe4\xf1\x9c\xe7\xdf\xf3\x09\x16\xaf\xce\x23\x54\x16\xa3\x5b\x55\x76\xc1\x57\xb0\x6d\x64\x0e\xc1\x1f\xe2\x5d\x7f\x1f\xc4\x20\x07\x0e\x17\x58\x6e\x63\xa2\xa5\x19\xc4\x20\x69\x58\x31\x46\x67\xf1\x2b\xe7\x98\xfe\xab\x72\x9e\xe0\x49\x00\x56\x8c\xc9\x05\x0f\x17\xa8\x04\x95\x94\x57\x67\x02\x90\xa2\xf9\x25\x5c\x31\x9b\xe9\x1e\xe7\xfd\x31\x40\xb9\x5d\xa0\x9a\x72\x5e\xd2\xa9\xae\x8d\x32\x13\xee\xbf\x1c\x66\xe5\x47\x1a\xe2\x58\x2f\x77\x5d\x97\xa6\x16\x54\xd6\xaf\x91\x0a\x98\x66\x15\xe9\xf8\xd8\xf9\x00\x69\x52\xa2\xed\x0a\xca\x36\xbc\x6f\xfa\xa3\xb6\x96\x31\xc6\x5a\xd9\x19\x7e\x94\xac\x95\x9c\x0b\xae\x3a\xd4\xa2\x69\x7b\xc1\x79\x67\x35\xd3\x52\x6b\xc1\x58\x8b\x9f\x0c\x45\xcb\x50\x61\xc3\xfb\x1d\xb8\x9d\xc9\xf6\x71\x26\x45\x10\x7a\x5b\x84\x90\x77\x59\x8b\x32\x37\x35\x62\xfa\x4b\x15\xd9\xd7\x9c\x9d\x76\x26\xf8\xf5\x95\xc2\x82\x3e\xa5\xf9\x15\x1e\xb3\xd3\xef\xe4\x9f\x00\x00\x00\xff\xff\xf4\xd4\xac\xa0\x86\x01\x00\x00") +var _ruby271Nix = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x6c\x91\xcf\xaa\xdc\x20\x14\x87\xf7\x3e\xc5\x21\xdd\xb4\x5c\xc6\xa8\x37\x89\xe9\x0d\x59\x74\xd9\x67\x28\x25\x68\x3c\x93\xc8\x04\x0d\x6a\x02\x9d\x21\xef\x5e\x4c\x29\x33\x8b\xbb\x11\xf9\xd0\xef\xfc\xf9\x7d\x79\x3c\xc0\xe0\xd5\x3a\x84\xc2\x60\xb0\xbb\x4a\xd6\xbb\x02\x8e\x83\x2c\xde\xbb\x4b\xd8\xf4\x9f\x8b\x18\xe4\xc0\xa1\x87\xf5\x36\x45\x9a\xc9\x20\x06\x49\xfd\x8e\x21\x58\x83\x3f\x52\x0a\xf1\xab\xca\xe7\x07\x3c\x08\xc0\x8e\x21\x5a\xef\xa0\x87\x42\x50\x49\x79\xd1\x11\x80\x18\xc6\xff\x86\x2b\xa6\x71\xde\xc2\x72\x3e\x06\xc8\xb7\x1e\x8a\x39\xa5\x35\x7e\x94\xe5\xa8\xc6\x19\xcf\x2a\x97\x45\xb9\x89\xfa\x30\x95\xeb\xa6\xcb\x4c\x4a\x41\x65\xf9\xaf\xa5\x2c\xa6\x49\x05\x3a\xdd\x4f\x3f\x40\x9c\x95\xa8\x9b\xac\x32\x15\x6f\xab\xf6\x5d\x1b\xc3\x18\x63\xb5\x6c\x46\xfe\x2e\x59\x2d\x39\x17\x5c\x35\xa8\x45\x55\xb7\x82\xf3\xc6\x68\xa6\xa5\xd6\x82\xb1\x1a\xbf\x33\x14\x35\x43\x85\x15\x6f\x4f\xe1\xd1\x11\x02\xa0\x37\xbb\x98\x9f\x6e\xdd\x52\x84\x1e\xce\x21\xe9\x2b\x7b\x7b\x83\x5f\x67\xf5\x73\xb2\xc5\x6a\x3b\x7a\xb7\x3f\x89\x5f\xd1\xc5\xb8\x3c\xc1\x7d\xb1\x9a\x00\xfc\xee\xc8\xf1\xad\x23\x79\xfd\xe8\x4c\x5e\x37\x79\x8d\x62\x55\xe3\x4d\x4d\x18\x3f\x0b\xe2\xf5\xd3\xdf\x00\x00\x00\xff\xff\x23\xd8\x01\x3e\xbf\x01\x00\x00") func ruby271NixBytes() ([]byte, error) { return bindataRead( @@ -639,12 +639,12 @@ func ruby271Nix() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "ruby/2.7.1.nix", size: 390, mode: os.FileMode(420), modTime: time.Unix(1594085611, 0)} + info := bindataFileInfo{name: "ruby/2.7.1.nix", size: 447, mode: os.FileMode(420), modTime: time.Unix(1594853037, 0)} a := &asset{bytes: bytes, info: info} return a, nil } -var _rubyDefaultNix = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x6c\x90\xcd\x8a\xf3\x20\x14\x86\xf7\x5e\xc5\x21\xdf\xe6\x9b\x45\x8d\xda\x24\x66\x5a\xba\x98\x2b\x09\xfe\x9c\x26\xd2\xa0\x41\x6d\x60\x5a\x72\xef\x83\x29\x03\x5d\xcc\x46\x7c\x5f\xe4\xf1\x9c\xe7\xdf\xf3\x09\x16\xaf\xce\x23\x54\x16\xa3\x5b\x55\x76\xc1\x57\xb0\x6d\x64\x0e\xc1\x1f\xe2\x5d\x7f\x1f\xc4\x20\x07\x0e\x17\x58\x6e\x63\xa2\xa5\x19\xc4\x20\x69\x58\x31\x46\x67\xf1\x2b\xe7\x98\xfe\xab\x72\x9e\xe0\x49\x00\x56\x8c\xc9\x05\x0f\x17\xa8\x04\x95\x94\x57\x67\x02\x90\xa2\xf9\x25\x5c\x31\x9b\xe9\x1e\xe7\xfd\x31\x40\xb9\x5d\xa0\x9a\x72\x5e\xd2\xa9\xae\x8d\x32\x13\xee\xbf\x1c\x66\xe5\x47\x1a\xe2\x58\x2f\x77\x5d\x97\xa6\x16\x54\xd6\xaf\x91\x0a\x98\x66\x15\xe9\xf8\xd8\xf9\x00\x69\x52\xa2\xed\x0a\xca\x36\xbc\x6f\xfa\xa3\xb6\x96\x31\xc6\x5a\xd9\x19\x7e\x94\xac\x95\x9c\x0b\xae\x3a\xd4\xa2\x69\x7b\xc1\x79\x67\x35\xd3\x52\x6b\xc1\x58\x8b\x9f\x0c\x45\xcb\x50\x61\xc3\xfb\x1d\xb8\x9d\xc9\xf6\x71\x26\x45\x10\x7a\x5b\x84\x90\x77\x59\x8b\x32\x37\x35\x62\xfa\x4b\x15\xd9\xd7\x9c\x9d\x76\x26\xf8\xf5\x95\xc2\x82\x3e\xa5\xf9\x15\x1e\xb3\xd3\xef\xe4\x9f\x00\x00\x00\xff\xff\xf4\xd4\xac\xa0\x86\x01\x00\x00") +var _rubyDefaultNix = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x6c\x91\xcf\xaa\xdc\x20\x14\x87\xf7\x3e\xc5\x21\xdd\xb4\x5c\xc6\xa8\x37\x89\xe9\x0d\x59\x74\xd9\x67\x28\x25\x68\x3c\x93\xc8\x04\x0d\x6a\x02\x9d\x21\xef\x5e\x4c\x29\x33\x8b\xbb\x11\xf9\xd0\xef\xfc\xf9\x7d\x79\x3c\xc0\xe0\xd5\x3a\x84\xc2\x60\xb0\xbb\x4a\xd6\xbb\x02\x8e\x83\x2c\xde\xbb\x4b\xd8\xf4\x9f\x8b\x18\xe4\xc0\xa1\x87\xf5\x36\x45\x9a\xc9\x20\x06\x49\xfd\x8e\x21\x58\x83\x3f\x52\x0a\xf1\xab\xca\xe7\x07\x3c\x08\xc0\x8e\x21\x5a\xef\xa0\x87\x42\x50\x49\x79\xd1\x11\x80\x18\xc6\xff\x86\x2b\xa6\x71\xde\xc2\x72\x3e\x06\xc8\xb7\x1e\x8a\x39\xa5\x35\x7e\x94\xe5\xa8\xc6\x19\xcf\x2a\x97\x45\xb9\x89\xfa\x30\x95\xeb\xa6\xcb\x4c\x4a\x41\x65\xf9\xaf\xa5\x2c\xa6\x49\x05\x3a\xdd\x4f\x3f\x40\x9c\x95\xa8\x9b\xac\x32\x15\x6f\xab\xf6\x5d\x1b\xc3\x18\x63\xb5\x6c\x46\xfe\x2e\x59\x2d\x39\x17\x5c\x35\xa8\x45\x55\xb7\x82\xf3\xc6\x68\xa6\xa5\xd6\x82\xb1\x1a\xbf\x33\x14\x35\x43\x85\x15\x6f\x4f\xe1\xd1\x11\x02\xa0\x37\xbb\x98\x9f\x6e\xdd\x52\x84\x1e\xce\x21\xe9\x2b\x7b\x7b\x83\x5f\x67\xf5\x73\xb2\xc5\x6a\x3b\x7a\xb7\x3f\x89\x5f\xd1\xc5\xb8\x3c\xc1\x7d\xb1\x9a\x00\xfc\xee\xc8\xf1\xad\x23\x79\xfd\xe8\x4c\x5e\x37\x79\x8d\x62\x55\xe3\x4d\x4d\x18\x3f\x0b\xe2\xf5\xd3\xdf\x00\x00\x00\xff\xff\x23\xd8\x01\x3e\xbf\x01\x00\x00") func rubyDefaultNixBytes() ([]byte, error) { return bindataRead( @@ -659,7 +659,7 @@ func rubyDefaultNix() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "ruby/default.nix", size: 390, mode: os.FileMode(420), modTime: time.Unix(1594085611, 0)} + info := bindataFileInfo{name: "ruby/default.nix", size: 447, mode: os.FileMode(420), modTime: time.Unix(1594853037, 0)} a := &asset{bytes: bytes, info: info} return a, nil } diff --git a/internal/catalog/data/ruby/2.6.6.nix b/internal/catalog/data/ruby/2.6.6.nix index e839d76..7546ec9 100644 --- a/internal/catalog/data/ruby/2.6.6.nix +++ b/internal/catalog/data/ruby/2.6.6.nix @@ -5,12 +5,15 @@ loon-ruby-2_6_6 = pkgs.ruby.overrideAttrs(attrs: { url = "https://cache.ruby-lang.org/pub/ruby/2.6/ruby-2.6.6.tar.gz"; sha256 = "364b143def360bac1b74eb56ed60b1a0dca6439b00157ae11ff77d5cd2e92291"; }; + + buildInputs = attrs.buildInputs ++ [ + pkgs.libiconv + pkgs.openssl + pkgs.zlib + ]; }); #{{ end }} #{{ define "packages" }} loon-ruby-2_6_6 -pkgs.libiconv -pkgs.openssl -pkgs.zlib #{{ end }} diff --git a/internal/catalog/data/ruby/2.7.1.nix b/internal/catalog/data/ruby/2.7.1.nix index 1508939..1c3640a 100644 --- a/internal/catalog/data/ruby/2.7.1.nix +++ b/internal/catalog/data/ruby/2.7.1.nix @@ -5,12 +5,15 @@ loon-ruby-2_7_1 = pkgs.ruby_2_7.overrideAttrs(attrs: { url = "https://cache.ruby-lang.org/pub/ruby/2.7/ruby-2.7.1.tar.gz"; sha256 = "d418483bdd0000576c1370571121a6eb24582116db0b7bb2005e90e250eae418"; }; + + buildInputs = attrs.buildInputs ++ [ + pkgs.libiconv + pkgs.openssl + pkgs.zlib + ]; }); #{{ end }} #{{ define "packages" }} loon-ruby-2_7_1 -pkgs.libiconv -pkgs.openssl -pkgs.zlib #{{ end }} diff --git a/internal/cli/nix.go b/internal/cli/nix.go new file mode 100644 index 0000000..dc8da47 --- /dev/null +++ b/internal/cli/nix.go @@ -0,0 +1,56 @@ +package cli + +import ( + "errors" + + "github.com/andremedeiros/loon/internal/nix" + "github.com/urfave/cli/v2" +) + +var buildCmd = &cli.Command{ + Name: "build", + Usage: "Builds a dependency", + Flags: []cli.Flag{ + &cli.BoolFlag{Name: "all", Usage: "Builds all versions of a dependency"}, + }, + Action: func(c *cli.Context) error { + all := c.Bool("all") + if c.NArg() == 0 { + return errors.New("specify a dependency name") + } + dep := c.Args().Get(0) + + if all { + for _, pkg := range nix.Packages() { + if pkg.Name != dep { + continue + } + + if err := pkg.Build(); err != nil { + return err + } + } + } else { + ver := c.Args().Get(1) + if ver == "" { + ver = "default" + } + pkg, err := nix.PackageFor(dep, ver) + if err != nil { + return err + } + return pkg.Build() + } + return nil + }, +} + +var nixCmd = &cli.Command{ + Name: "nix", + Usage: "Nix toolbox", + Subcommands: []*cli.Command{buildCmd}, +} + +func init() { + appendCommand(nixCmd) +} diff --git a/internal/nix/derivation.go b/internal/nix/derivation.go index 6b65fe0..38b02ca 100644 --- a/internal/nix/derivation.go +++ b/internal/nix/derivation.go @@ -33,7 +33,7 @@ func (d *Derivation) Execute(args []string, opts ...executor.Option) error { return executor.Execute(cmd, opts...) } -func (d *Derivation) generate() { +func (d *Derivation) generateShell() { tmpl := ` { pkgs ? import { } }: let @@ -72,7 +72,7 @@ func (d *Derivation) NeedsUpdate(payloadModified time.Time) bool { } func (d *Derivation) Install() error { - d.generate() + d.generateShell() if err := executor.Execute([]string{"nix-instantiate", d.NixPath, "--indirect", "--add-root", d.DrvPath}); err != nil { return err } diff --git a/internal/nix/package.go b/internal/nix/package.go index dbd0249..3babdb7 100644 --- a/internal/nix/package.go +++ b/internal/nix/package.go @@ -3,11 +3,14 @@ package nix import ( "bytes" "fmt" + "io/ioutil" + "os" "path/filepath" "strings" "text/template" "github.com/andremedeiros/loon/internal/catalog" + "github.com/andremedeiros/loon/internal/executor" ) type Package struct { @@ -32,6 +35,40 @@ func (p Package) DerivationPackages() string { return buf.String() } +func (p Package) Build() error { + tmpl := ` +{ pkgs ? import { } }: +let + inherit (pkgs) stdenv fetchurl mkShell; + {{ .Derivation }} +in rec { + package = + {{ .DerivationPackages }} + ; +}` + buf := bytes.NewBuffer([]byte{}) + t, err := template.New("nix").Parse(tmpl) + if err != nil { + // TODO(andremedeiros): figure out a better way + panic(err) + } + t.Execute(buf, p) + f, _ := ioutil.TempFile("", "default.nix") + f.Write(buf.Bytes()) + f.Close() + + return executor.Execute([]string{ + "nix-build", + f.Name(), + "-A", + "package", + "--no-out-link", + }, + executor.WithStdout(os.Stdout), + executor.WithStderr(os.Stderr), + ) +} + func PackageFor(name string, version string) (Package, error) { for _, p := range Packages() { if p.Name == name && p.Version == version { From 65eaa8cb8625ea79651443417d6962f485262ea3 Mon Sep 17 00:00:00 2001 From: Andre Medeiros Date: Wed, 15 Jul 2020 19:27:19 -0400 Subject: [PATCH 2/5] it's postgresql --- .github/workflows/populate-cache.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/populate-cache.yml b/.github/workflows/populate-cache.yml index c207c82..bf73e49 100644 --- a/.github/workflows/populate-cache.yml +++ b/.github/workflows/populate-cache.yml @@ -7,7 +7,7 @@ jobs: fail-fast: false matrix: platform: [ubuntu-latest, macos-latest] - dependency: [crystal, golang, memcached, mysql, node, postgres, redis, ruby] + dependency: [crystal, golang, memcached, mysql, node, postgresql, redis, ruby] runs-on: ${{ matrix.platform }} steps: - name: Install Go From e1fa2f495fbf73e495af918cf83fe85afaffd504 Mon Sep 17 00:00:00 2001 From: Andre Medeiros Date: Wed, 15 Jul 2020 19:46:07 -0400 Subject: [PATCH 3/5] Fix mysql --- internal/catalog/bindata.go | 8 ++++---- internal/catalog/data/mysql/8.0.21.nix | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/internal/catalog/bindata.go b/internal/catalog/bindata.go index 98865a3..c3b0958 100644 --- a/internal/catalog/bindata.go +++ b/internal/catalog/bindata.go @@ -284,7 +284,7 @@ func mysql8017Nix() (*asset, error) { return a, nil } -var _mysql8021Nix = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x6c\x90\x4f\x6b\xb4\x30\x10\x87\xef\xf9\x14\x83\xef\xe5\xed\x61\x93\xac\x12\x91\x15\x0f\x85\x1e\xdb\x43\xe9\x07\x58\x82\x89\xd1\x8d\x26\x6e\x92\xfa\x17\xbf\x7b\xd1\xb6\xb0\x87\x5e\x86\x61\x98\x79\x7e\xc3\xf3\x6f\x5d\x41\xc8\xaa\x31\x12\x22\x21\x5d\x33\xf0\xd0\x58\x13\xc1\xb6\xa1\xd6\x5a\x73\xea\x66\x7f\x6f\x4f\xd9\x95\x5e\xe3\x33\x14\xd0\x6b\xe5\xf1\x31\xcb\x28\xb6\x83\x74\xae\x11\xf2\x39\x04\xe7\xff\xf3\xbd\x5e\x60\x45\x00\x83\x74\xbe\xb1\x06\x0a\x88\x32\x4c\x71\x7c\x8e\x72\x04\xe0\x5d\xf9\x4b\xa8\x64\x28\xeb\x4f\xd7\x1e\xdb\x00\x7b\x57\x40\x54\x87\xd0\xfb\x0b\x21\xa5\x30\xdf\x19\xb8\xb4\x1d\x21\x2f\x76\x34\xad\xe5\xc2\x93\xb7\xf9\xe3\xfd\xf5\x94\x61\x4a\x7e\xde\x3a\xe0\x38\x70\x87\xd5\x72\x64\x00\xf8\x9a\xc7\x2c\xdd\x71\x54\x50\xaa\x19\x73\x7a\x11\xca\xb0\xf1\x96\xc4\xc3\xc4\x8d\xbe\x69\x36\x25\xf3\x58\xdd\xc7\x34\x5e\xa6\x45\x25\x1d\xa3\xc9\xe4\x14\x4b\xbb\x4e\x1c\x90\x2d\x47\xdb\x53\x8e\x76\x35\xd2\x88\x5d\x05\x7a\xd4\xd4\xf3\x52\x73\x25\xfd\xdf\x92\x1e\xcf\xbe\x02\x00\x00\xff\xff\x52\x56\xc8\x76\x5d\x01\x00\x00") +var _mysql8021Nix = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x6c\x90\x31\x6b\xf3\x30\x10\x86\x77\xff\x8a\xc3\xdf\xf2\x95\x10\x59\xb1\x51\x6a\x12\x3c\x14\xba\x14\xda\xa1\x74\x2c\x21\x28\x96\x62\x2b\xb2\x25\x47\x52\x6c\xc7\xc1\xff\xbd\x48\x6d\x21\x43\x97\x43\x3a\x4e\xcf\xe9\x7d\xfe\xdd\x6e\xc0\xf8\x51\x28\x0e\x31\xe3\x46\xf4\xd4\x09\xad\x62\x98\xe7\xa8\xd1\x5a\x2d\xdb\xab\x3d\x37\xcb\x7c\x8f\xf7\xe9\x0a\x0a\xe8\x64\x65\x51\xe8\xe5\x18\xe9\x9e\x1b\x23\x18\x7f\x72\xce\xd8\xff\xd4\xd7\x0d\xdc\x22\x80\x9e\x1b\x2b\xb4\x82\x02\xe2\x1c\x61\x94\xae\xe2\x6d\x04\x60\x4d\xf9\x4b\x38\x72\x57\xd6\x17\xd3\x84\x69\x00\x7f\x2a\x20\xae\x9d\xeb\xec\x26\x49\x4a\xa6\xbe\x77\xa0\x52\xb7\x49\xf2\xac\x07\xd5\x68\xca\x6c\xf2\x76\xfd\x78\x7f\x5d\xe6\x08\x27\x3f\xdf\x0a\x70\xe4\xa8\x41\xd5\x14\x76\x00\xd8\x9a\xa6\x64\xed\x71\x98\x61\x2c\x09\x31\x72\x62\x95\x22\xc3\x29\x4b\xfb\x91\x2a\x79\x92\x64\xcc\xae\xc3\xf1\x3c\xac\xd3\x69\x9c\xaa\xac\x25\x38\x1b\x4d\x45\xd6\x6d\xcb\x02\x64\xf6\xa5\xa3\xae\xac\xb9\x85\x02\x3e\x77\xfe\x7e\xb8\x88\x86\xbd\xa8\xee\xe2\x42\x2f\xc4\x38\x68\x6d\xdd\xea\x31\xdd\xc1\x62\x01\x21\x3f\xba\x1b\xdb\x46\xf3\xc3\x36\xf2\x82\xb9\x62\x5e\x68\x74\x2f\xbb\xa3\xa5\xa4\x15\xb7\x7f\xab\xbe\x7f\xf6\x15\x00\x00\xff\xff\xd3\x25\x10\x4f\xa3\x01\x00\x00") func mysql8021NixBytes() ([]byte, error) { return bindataRead( @@ -299,12 +299,12 @@ func mysql8021Nix() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "mysql/8.0.21.nix", size: 349, mode: os.FileMode(420), modTime: time.Unix(1594689474, 0)} + info := bindataFileInfo{name: "mysql/8.0.21.nix", size: 419, mode: os.FileMode(420), modTime: time.Unix(1594856610, 0)} a := &asset{bytes: bytes, info: info} return a, nil } -var _mysqlDefaultNix = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x6c\x90\x4f\x6b\xb4\x30\x10\x87\xef\xf9\x14\x83\xef\xe5\xed\x61\x93\xac\x12\x91\x15\x0f\x85\x1e\xdb\x43\xe9\x07\x58\x82\x89\xd1\x8d\x26\x6e\x92\xfa\x17\xbf\x7b\xd1\xb6\xb0\x87\x5e\x86\x61\x98\x79\x7e\xc3\xf3\x6f\x5d\x41\xc8\xaa\x31\x12\x22\x21\x5d\x33\xf0\xd0\x58\x13\xc1\xb6\xa1\xd6\x5a\x73\xea\x66\x7f\x6f\x4f\xd9\x95\x5e\xe3\x33\x14\xd0\x6b\xe5\xf1\x31\xcb\x28\xb6\x83\x74\xae\x11\xf2\x39\x04\xe7\xff\xf3\xbd\x5e\x60\x45\x00\x83\x74\xbe\xb1\x06\x0a\x88\x32\x4c\x71\x7c\x8e\x72\x04\xe0\x5d\xf9\x4b\xa8\x64\x28\xeb\x4f\xd7\x1e\xdb\x00\x7b\x57\x40\x54\x87\xd0\xfb\x0b\x21\xa5\x30\xdf\x19\xb8\xb4\x1d\x21\x2f\x76\x34\xad\xe5\xc2\x93\xb7\xf9\xe3\xfd\xf5\x94\x61\x4a\x7e\xde\x3a\xe0\x38\x70\x87\xd5\x72\x64\x00\xf8\x9a\xc7\x2c\xdd\x71\x54\x50\xaa\x19\x73\x7a\x11\xca\xb0\xf1\x96\xc4\xc3\xc4\x8d\xbe\x69\x36\x25\xf3\x58\xdd\xc7\x34\x5e\xa6\x45\x25\x1d\xa3\xc9\xe4\x14\x4b\xbb\x4e\x1c\x90\x2d\x47\xdb\x53\x8e\x76\x35\xd2\x88\x5d\x05\x7a\xd4\xd4\xf3\x52\x73\x25\xfd\xdf\x92\x1e\xcf\xbe\x02\x00\x00\xff\xff\x52\x56\xc8\x76\x5d\x01\x00\x00") +var _mysqlDefaultNix = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x6c\x90\x31\x6b\xf3\x30\x10\x86\x77\xff\x8a\xc3\xdf\xf2\x95\x10\x59\xb1\x51\x6a\x12\x3c\x14\xba\x14\xda\xa1\x74\x2c\x21\x28\x96\x62\x2b\xb2\x25\x47\x52\x6c\xc7\xc1\xff\xbd\x48\x6d\x21\x43\x97\x43\x3a\x4e\xcf\xe9\x7d\xfe\xdd\x6e\xc0\xf8\x51\x28\x0e\x31\xe3\x46\xf4\xd4\x09\xad\x62\x98\xe7\xa8\xd1\x5a\x2d\xdb\xab\x3d\x37\xcb\x7c\x8f\xf7\xe9\x0a\x0a\xe8\x64\x65\x51\xe8\xe5\x18\xe9\x9e\x1b\x23\x18\x7f\x72\xce\xd8\xff\xd4\xd7\x0d\xdc\x22\x80\x9e\x1b\x2b\xb4\x82\x02\xe2\x1c\x61\x94\xae\xe2\x6d\x04\x60\x4d\xf9\x4b\x38\x72\x57\xd6\x17\xd3\x84\x69\x00\x7f\x2a\x20\xae\x9d\xeb\xec\x26\x49\x4a\xa6\xbe\x77\xa0\x52\xb7\x49\xf2\xac\x07\xd5\x68\xca\x6c\xf2\x76\xfd\x78\x7f\x5d\xe6\x08\x27\x3f\xdf\x0a\x70\xe4\xa8\x41\xd5\x14\x76\x00\xd8\x9a\xa6\x64\xed\x71\x98\x61\x2c\x09\x31\x72\x62\x95\x22\xc3\x29\x4b\xfb\x91\x2a\x79\x92\x64\xcc\xae\xc3\xf1\x3c\xac\xd3\x69\x9c\xaa\xac\x25\x38\x1b\x4d\x45\xd6\x6d\xcb\x02\x64\xf6\xa5\xa3\xae\xac\xb9\x85\x02\x3e\x77\xfe\x7e\xb8\x88\x86\xbd\xa8\xee\xe2\x42\x2f\xc4\x38\x68\x6d\xdd\xea\x31\xdd\xc1\x62\x01\x21\x3f\xba\x1b\xdb\x46\xf3\xc3\x36\xf2\x82\xb9\x62\x5e\x68\x74\x2f\xbb\xa3\xa5\xa4\x15\xb7\x7f\xab\xbe\x7f\xf6\x15\x00\x00\xff\xff\xd3\x25\x10\x4f\xa3\x01\x00\x00") func mysqlDefaultNixBytes() ([]byte, error) { return bindataRead( @@ -319,7 +319,7 @@ func mysqlDefaultNix() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "mysql/default.nix", size: 349, mode: os.FileMode(420), modTime: time.Unix(1594689474, 0)} + info := bindataFileInfo{name: "mysql/default.nix", size: 419, mode: os.FileMode(420), modTime: time.Unix(1594856610, 0)} a := &asset{bytes: bytes, info: info} return a, nil } diff --git a/internal/catalog/data/mysql/8.0.21.nix b/internal/catalog/data/mysql/8.0.21.nix index 0f8c85d..177bf46 100644 --- a/internal/catalog/data/mysql/8.0.21.nix +++ b/internal/catalog/data/mysql/8.0.21.nix @@ -5,6 +5,8 @@ loon-mysql-8_0_21 = pkgs.mysql80.overrideAttrs(attrs: { url = "https://cdn.mysql.com//Downloads/MySQL-8.0/mysql-8.0.21.tar.gz"; sha256 = "0d00k55rkzdgn5wj32vxankjk5x3ywfqw62zxzg3m503xrg56mmd"; }; + patches = []; + buildInputs = [pkgs.boost172] ++ attrs.buildInputs; }); #{{ end }} From 1470688abad724c32683e2b5acc568d33c4d3a89 Mon Sep 17 00:00:00 2001 From: Andre Medeiros Date: Wed, 15 Jul 2020 19:49:25 -0400 Subject: [PATCH 4/5] integration installs the cache --- .github/workflows/integration.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 564e679..be7d66c 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -23,6 +23,10 @@ jobs: uses: cachix/install-nix-action@v10 with: nix_path: nixpkgs=channel:nixos-unstable + - name: Install Cachix + uses: cachix/cachix-action@v6 + with: + name: loon - name: Checkout code uses: actions/checkout@v2 - name: Build Loon From f9947355944a77dcfe087c07bbaa7302ce907c8f Mon Sep 17 00:00:00 2001 From: Andre Medeiros Date: Wed, 15 Jul 2020 19:55:33 -0400 Subject: [PATCH 5/5] quit early when package name not supported with --all --- internal/cli/nix.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/internal/cli/nix.go b/internal/cli/nix.go index dc8da47..5cdfef4 100644 --- a/internal/cli/nix.go +++ b/internal/cli/nix.go @@ -21,6 +21,9 @@ var buildCmd = &cli.Command{ dep := c.Args().Get(0) if all { + if _, err := nix.PackageFor(dep, "default"); err != nil { + return err + } for _, pkg := range nix.Packages() { if pkg.Name != dep { continue