Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000| # IE is still braindead so still use favicon.ico | |
| convert -resize x16 -gravity center -crop 16x16+0+0 -flatten -colors 256 input.png output-16x16.ico | |
| convert -resize x32 -gravity center -crop 32x32+0+0 -flatten -colors 256 input.png output-32x32.ico | |
| convert output-16x16.ico output-32x32.ico favicon.ico | |
| # Then, HTML needs to specify size="XxY" as largest size due to browser bugs | |
| <link rel="shortcut icon" href="/favicon.ico" sizes="32x32"> |
| #!/bin/sh | |
| sudo mount -o remount,exec /tmp | |
| if [ -x /usr/local/nixstrap/proot-x86_64 ] && [ -h ~/.nix-profile ]; then | |
| echo "Launching shell with nix-* tools!" | |
| exec /usr/local/nixstrap/proot-x86_64 -b /usr/local/nixstrap/nix-1.8-x86_64-linux:/nix bash --init-file ~/.nix-profile/etc/profile.d/nix.sh | |
| fi | |
| set -e |
NOTE: a more up-to-date version of this can be found on my blog
A few days ago, version 1.9 of the Nix package manager was released. From the release notes:
nix-shell can now be used as a #!-interpreter. This allows you to write scripts that dynamically fetch their own dependencies.
| Actually, that's a feature | |
| Don't worry, that value is only wrong half of the time | |
| Even though it doesn't work, how does it feel? | |
| Everything looks fine my end | |
| How is that possible? | |
| I broke that deliberately to do some testing | |
| I can have a look but there's a lot of if statements in that code! | |
| I can't make that a priority right now | |
| I can't test everything | |
| I couldn't find any examples of how that can be done anywhere else in the project |
| #!/bin/bash | |
| # if spotify is started | |
| if [ "$(pidof spotify)" ]; then | |
| # status can be: Playing, Paused or Stopped | |
| status=`dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'PlaybackStatus'|egrep -A 1 "string"|cut -b 26-|cut -d '"' -f 1|egrep -v ^$` | |
| artist=`dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'Metadata'|egrep -A 2 "artist"|egrep -v "artist"|egrep -v "array"|cut -b 27-|cut -d '"' -f 1|egrep -v ^$` | |
| album=`dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'Metadata'|egrep -A 1 "album"|egrep -v "album"|cut -b 44-|cut -d '"' -f 1|egrep -v ^$` | |
| title=`dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 o |
nix-channel and ~/.nix-defexpr are gone. We'll use $NIX_PATH (or user environment specific overrides configured via nix set-path) to look up packages. Since $NIX_PATH supports URLs nowadays, this removes the need for channels: you can just set $NIX_PATH to e.g. https://nixos.org/channels/nixos-15.09/nixexprs.tar.xz and stay up to date automatically.
By default, packages are selected by attribute name, rather than the name attribute. Thus nix install hello is basically equivalent to nix-env -iA hello. The attribute name is recorded in the user environment manifest and used in upgrades. Thus (at least by default) hello won't be upgraded to helloVariant.
@vcunat suggested making this an arbitrary Nix expression rather than an attrpath, e.g. firefox.override { enableFoo = true; }. However, such an expression would not have a key in the user environment, unlike an attrpath. Better to require an explicit flag for this.
TBD: How to deal with search path clashes.