Skip to content

Instantly share code, notes, and snippets.

@wiedi
Created June 26, 2020 21:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wiedi/cc17170942c91daf13895d9b0c8fc662 to your computer and use it in GitHub Desktop.
Save wiedi/cc17170942c91daf13895d9b0c8fc662 to your computer and use it in GitHub Desktop.

unprivileged pkgsrc multi envs

First time

mkdir -p ~/.pkg

Create New Env

export VERSION=20200626

cd ~/.pkg
mkdir -p $VERSION/src
cd $VERSION/src
git clone git@github.com:NetBSD/pkgsrc.git .


MK_FRAG() {
cat <<__MKFRAGEOM__
# sw
PKG_DEVELOPER=			yes
PKG_OPTIONS.gnustep+=	fragile
PKG_OPTIONS.cairo+=		quartz
PKG_OPTIONS.pango+=		quartz
X11_TYPE=				native
PYTHON_VERSION_DEFAULT=	38

ACCEPTABLE_LICENSES+=	gnu-agpl-v3
ACCEPTABLE_LICENSES+=	lame-license
ACCEPTABLE_LICENSES+=	shorten-license

ALLOW_VULNERABLE_PACKAGES=	yes
__MKFRAGEOM__
}

./bootstrap/bootstrap --unprivileged --abi 64 --prefix ~/.pkg/$VERSION --workdir ~/.pkg/$VERSION/work --mk-fragment <(MK_FRAG)

Activate

Create activation script:

echo "export PATH=\"/Users/wiedi/.pkg/${VERSION}/bin:/Users/wiedi/.pkg/${VERSION}/sbin:\$PATH\"" >> ~/bin/pkgsrc-${VERSION}

Or set as default (optional):

echo "export PATH=\"/Users/wiedi/.pkg/${VERSION}/bin:/Users/wiedi/.pkg/${VERSION}/sbin:\$PATH\"" >> ~/.bash_profile

Install Packages

WISHLIST="
archivers/gtar-base
audio/flac
audio/lame
audio/mp3splt
audio/py-acoustid
audio/py-beets
audio/py-discogs-client
audio/shntool
audio/shorten
audio/sox
converters/py-cairosvg
converters/qrencode
devel/git-cvs
devel/gtexinfo
devel/jq
devel/py-ipython
devel/py-pip
devel/py-requests
devel/scmcvs
editors/nano
graphics/py-Pillow
ham/cwtext
lang/gawk
lang/nodejs
lang/npm
lang/python38
multimedia/ffmpeg4
net/balance
net/inetutils
net/ipcalc
net/lftp
net/mtr
net/nmap
net/rsync
net/wget
net/youtube-dl
pkgtools/pkg_alternatives
pkgtools/pkgdiff
pkgtools/pkglint
security/gnupg2
security/mozilla-rootcerts
security/py-cryptography
shells/bash
shells/bash-completion
sysutils/b2sum
sysutils/file
sysutils/ncdu
sysutils/pwgen
sysutils/screenbrightness
textproc/gsed
www/curl
"

for pkg in ${WISHLIST}; do echo $pkg; cd $pkg; bmake install; cd -; done

Manual steps

default python

pkg_alternatives manual python38

setup virtualenvwrapper

pip install virtualenvwrapper

add something like this to .bash_profile

export VIRTUALENVWRAPPER_SCRIPT=~/.pkg/20200626/bin/virtualenvwrapper.sh
source ~/.pkg/20200626/bin/virtualenvwrapper_lazy.sh

Setup ipython profile

ipython profile create
echo "c.TerminalInteractiveShell.display_completions = 'readlinelike'" >> ~/.ipython/profile_default/ipython_config.py

SUID for mtr

sudo chown root ~/.pkg/${VERSION}/sbin/mtr-packet
sudo chmod 4511 ~/.pkg/${VERSION}/sbin/mtr-packet

Install CA certs

mozilla-rootcerts install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment