Skip to content
This repository has been archived by the owner on Aug 26, 2021. It is now read-only.

Add support for sub-packages #22

Open
rushmorem opened this issue Aug 24, 2016 · 3 comments
Open

Add support for sub-packages #22

rushmorem opened this issue Aug 24, 2016 · 3 comments

Comments

@rushmorem
Copy link
Contributor

If you have a number of sub-packages that share a common repo, it can be very inconvenient to have to run go2nix save in each package separately.

@kamilchm kamilchm added this to the release-1.2 milestone Dec 13, 2016
@kamilchm kamilchm modified the milestones: release-1.3, release-1.2 Mar 15, 2017
@qknight
Copy link
Contributor

qknight commented Nov 28, 2017

i've hacked together this script and it is a helper in getting the deps together.

using https://github.com/nixcloud/nix-beautify we can now generate nice and unique deps.nix files:

uniqueDeps.sh

#!/usr/bin/env bash

#https://groups.google.com/forum/#!topic/golang-nuts/611QEJqkDKw
#deps=$(go list -f {{.Deps}})
pushd nixcloud.io/auth-server/
deps=$(go list -f '{{join .Deps "\n"}}' |  xargs go list -f '{{if not .Standard}}{{.ImportPath}}{{end}} ' | sort | uniq)
popd
  
rm -Rf mydeps
mkdir mydeps

for i in $deps; do
  echo $i
  pushd $i
  go2nix save
  popd
  d=$(echo $i | base64)
  cp $i/deps.nix mydeps/$d.nix
done

pushd mydeps
cat * | grep -v '\[' | grep -v '\]' | grep -v "This file was generated" > deps.nix
echo '[' > deps.nix_
cat deps.nix >> deps.nix_
echo ']' >> deps.nix_
mv deps.nix_ deps.nix
nix-instantiate --eval --strict -E 'let pkgs=import <nixpkgs>{}; in pkgs.lib.unique (import ./deps.nix)' | sed -e 's/};/};\n/g' | sed -e 's/} /}\n/g' | sed -e 's/{/{\n/g' | sed -e 's/; /;\n/g' > deps.nix_
popd

cat deps.nix_ | nix-beautify > deps.nix

@kamilchm kamilchm removed this from the release-1.3 milestone Dec 28, 2017
@qknight
Copy link
Contributor

qknight commented Feb 16, 2018

@kamilchm might interest you, i've hacked https://github.com/nixcloud/dep2nix together

@kamilchm
Copy link
Owner

I'm less in Go now and I couldn't find time to complete my dep branch. I'm glad someone did it 👍

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants