diff --git a/install.sh b/install.sh index 5ca8df3..34288af 100755 --- a/install.sh +++ b/install.sh @@ -1,3 +1,3 @@ #!/usr/bin/env nix-shell #!nix-shell -i bash -p stow -stow -d `dirname $0` nix git x pentadactyl +stow -d `dirname $0` -t ~ nix git x pentadactyl diff --git a/nix/.nixpkgs/config.nix b/nix/.nixpkgs/config.nix index 0bb9f5e..67f5459 100644 --- a/nix/.nixpkgs/config.nix +++ b/nix/.nixpkgs/config.nix @@ -24,6 +24,7 @@ wine = pkgs.wine.override { wineRelease = "staging"; wineBuild = "wineWow"; }; ftb = pkgs.callPackage ./ftb.nix {}; + pyroscope = pkgs.callPackage ./pyroscope.nix {}; envs = recurseIntoAttrs { @@ -140,6 +141,8 @@ hosts = { ascanius = with envs; [apps code_min de games envs.js pdf nix media gcc misc]; woodhouse = with envs; [de media misc kodi chromium spotify]; + pennyworth = []; + frumar = with envs; [bup git-annex rtorrent pyroscope]; }; pandocdeps = (pkgs.texlive.combine { inherit (pkgs.texlive) diff --git a/nix/.nixpkgs/pyroscope.nix b/nix/.nixpkgs/pyroscope.nix new file mode 100644 index 0000000..637fbdf --- /dev/null +++ b/nix/.nixpkgs/pyroscope.nix @@ -0,0 +1,80 @@ + let + pkgs = import {}; + pypkg = pkgs.python27Packages; + in + { stdenv ? pkgs.stdenv, python27 ? pkgs.python27, fetchFromGitHub ? pkgs.fetchFromGitHub, + virtualenv ? pypkg.virtualenv, lib ? pkgs.lib }: + let + inherit (lib) concatMapStringsSep mapAttrsToList concatStringsSep; + deps = { + # the script fetches two other repos from github + pyrobase = fetchFromGitHub { + owner = "pyroscope"; + repo = "pyrobase"; + rev = "b9253cb4a8a5781a859e3b1bc79d537d76abc326"; + sha256 = "0c2vjjb9bdrd2rx0cys3jzdwr5ljzsh14s18j5np6yg2vdcya35g"; + }; + auvyon = fetchFromGitHub { + owner = "pyroscope"; + repo = "auvyon"; + rev = "5115c26f966df03df92a9934580b66c72e23d4e8"; + sha256 = "1qhig6xjv62gq4mj8rbhx6ifcffg321444j2fm6j8qk3yv8w5v4c"; + }; + }; + depnames = pkgs.lib.attrNames deps; + outputscripts = ["chtor" "hashcheck" "lstor" "mktor" "pyroadmin" "pyrotorque" "rtcontrol" "rtevent" "rtmv" "rtxmlrpc"]; + in + stdenv.mkDerivation { + name = "pyroscope"; + version = "0.1.0.0"; + src = fetchFromGitHub { + owner = "pyroscope"; + repo = "pyrocore"; + rev = "75393631130258d477adf3b4c77b2db085447383"; + sha256 = "02msqy40n41wzph75m5jiwphqj6wl2szp7izjwdlhrwfmr7cpamz"; + }; + buildInputs = [ python27 virtualenv ]; + patchPhase = '' + patchShebangs src/scripts + ''; + # make a virtualenv, install paver in it + # XXX: impure :/ + buildPhase = '' + virtualenv --never-download . + bin/pip --no-cache-dir install "paver==1.2.4" + bin/pip --no-cache-dir install "Tempita>=0.5.1" + bin/pip --no-cache-dir install "APScheduler>=2.0.2,<3" + bin/pip --no-cache-dir install "waitress>=0.8.2" + bin/pip --no-cache-dir install "WebOb>=1.2.3" + '' + + (concatStringsSep "\n" (mapAttrsToList (depname: source: + ''cp -R ${source} ./${depname} + chmod -R +w ./${depname} + (builtin cd ${depname} && ../bin/paver -q develop -U) + '') deps)) + + '' + ./bin/paver -q develop -U + ./bin/paver bootstrap + ''; + # copy the neccesary parts of the virtualenv + installPhase = '' + mkdir -p $out/bin + mkdir -p $out/venv/{lib,bin,src} + cp -R ./lib $out/venv/ + install ./bin/python2.7 $out/venv/bin + cp -R src $out/venv/src/pyrocore + ${concatMapStringsSep "\n" (x: '' + cp -R ${x}/src $out/venv/src/${x} + '') depnames} + ${concatMapStringsSep "\n" (x: "install bin/${x} $out/bin/${x}") outputscripts} + ''; + # patch the bin interpreter into the virtualenv and fix the internal .egg-links + fixupPhase = + (concatMapStringsSep "\n" (x: '' + echo -e "$out/venv/src/${x}\n../" > $out/venv/lib/python2.7/site-packages/${x}.egg-link + '') (depnames ++ ["pyrocore"])) + '' + sed -i -e "1 s|.*|#\!$out/venv/bin/python2.7|" $out/bin/* + ''; + dontPatchShebangs = true; + + }