This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# | |
# Add binaries to PATH at runtime | |
import subprocess | |
import nix | |
import os | |
def realise_path(store_path: str): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
with import <nixpkgs> {}; | |
mkShell { | |
buildInputs = [ | |
(python3.withPackages(ps: [ | |
ps.nixpkgs | |
])) | |
]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
with import <nixpkgs> { }; | |
let | |
cutPoints = builtins.map (drv: drv.outPath) [ | |
nodejs | |
python2 | |
python3 | |
coreutils | |
openssl.out | |
glibc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
with import <nixpkgs> {}; | |
let | |
# An example of how to get xwidgets rather than gtk | |
# overridenEmacs = emacs26.override { withXwidgets = true; }; | |
overridenEmacs = emacs26; | |
emacsPkgs = pkgs.emacsPackagesNgGen overridenEmacs; | |
emacsWithPackages = emacsPkgs.emacsWithPackages; | |
in emacsWithPackages(epkgs: with epkgs; [ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use_nix() { | |
local shell_file=$(test -f shell.nix && echo shell.nix || echo default.nix) | |
local cache_key=$(nix-instantiate "$shell_file" 2> /dev/null | shasum -a 1 | cut -d ' ' -f 1) | |
# Use ram as virtualenv storage | |
local tmpdir | |
case $(uname -s) in | |
Linux*) tmpdir=$XDG_RUNTIME_DIR;; | |
Darwin*) tmpdir_SDK=$TMPDIR;; | |
*) tmpdir=/tmp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use nix |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
with (import <nixpkgs> {}); | |
let | |
# Extract license from a Linux box | |
# It's in ~/Android/Sdk/licenses/android-sdk-license | |
sdkLicense = "d56f5187479451eabf01fb78af6dfcb131a6481e"; | |
in pkgs.mkShell { | |
buildInputs = with pkgs; [ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import contextlib | |
import functools | |
import paramiko | |
import select | |
import sys | |
import os | |
if __name__ == '__main__': |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
const ChildProcess = require('child_process') | |
function findChildren(pid) { | |
const pgrep = ChildProcess.spawnSync('pgrep', ['-P', pid]) | |
// Probably segfault.. | |
// Happens on linux at least when there is no child | |
if(pgrep.status === null) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In this moment of year NixPkgs already close to half of the umber of commits from previous year. | |
commits=12747/26374=0.483 | |
velocity_last_year=26374/365=72.258 commits/day | |
velocity_this_time=12747/109=116.945 commits/day | |
velocity_times=velocity_this_year/velocity_last_year=1.618 times | |
accel=(velocity_this_time-velocity_last_year)/current_day=0.410 commits/day^2 | |
velocity_end_of_year_extrapolated=velocity_last_year+365*accel=221.899 commits/day |