Skip to content

Instantly share code, notes, and snippets.

View moretea's full-sized avatar

Maarten Hoogendoorn moretea

View GitHub Profile
@moretea
moretea / all-packages-of-a-maintainer.nix
Last active February 23, 2017 09:17
List all packages filtered by some maintainer
#usage:
# nix-instantiate --arg maintainer "\"Matthias Beyer <mail@beyermatthias.de>\"" --strict --json --eval ./all-packages-of-a-maintainer.nix | $(nix-build '<nixpkgs>' -A jq)/bin/jq
with (import <nixpkgs> {});
with lib;
{ maintainer }:
let
filter = k: v:
let
let
myGenerator = stdenv.mkDerivation {
name ="yadda";
phases ="meh";
meh = ''
mkdir $out
generateSomeNix > $out/generated.nix
'';
};
in
with (import <nixpkgs> {});
let
v_old_1 = import (builtins.fetchTarball https://github.com/nixos/nixpkgs/archive/${sha1}.tar.gz) {}.;
v_old_2 = import (builtins.fetchTarball https://github.com/nixos/nixpkgs/archive/${sha1}.tar.gz) {}.;
v_old_3 = import (builtins.fetchTarball https://github.com/nixos/nixpkgs/archive/${sha1}.tar.gz) {}.;
in
{
myPackage = stdenv.mkDerivation rec {
name = "different-editor-versions";
buildInputs = [v_old1.emacs v_old2.vi];
with (import <nixpkgs> {});
with pkgs.lib;
let
getLicense = meta:
if !(meta ? license) then
"not specified"
else
if (meta.license ? fullName)
then meta.license.fullName
else
#!/usr/bin/env ruby
# (C) 2017 Maarten Hoogendoorn <maarten@moretea.nl>
# Released under the GPL3.0
#
# This script finds the runtime closure of programs, and tries to find the correct license for it.
# Given that the mapping of store paths -> nix expressions does not exist, it guesses the package
# name and aborts if this guess is wrong.
require "json"
@moretea
moretea / shell.nix
Created January 31, 2017 23:10
Rust development environment
with import (builtins.fetchTarball "https://github.com/NixOS/nixpkgs/archive/a211c1752ce3f6b017edefda49c1c8102a7ce812.tar.gz") {};
{
env = stdenv.mkDerivation {
name = "env";
buildInputs = with pkgs; [rustcNightlyBin.rustc cargo];
};
}
@moretea
moretea / _readme.md
Last active March 28, 2017 12:11
Habitat demo

How to demo hab on k8s.

  1. Start the ui (see script), open UI window
  2. Download the reset.sh and run it
  3. get the url for the guestbook, open UI window
  4. Show off resiliance by killing pods in the UI, after 5 kills the quorum is lost See this gist for details why
  5. When it inevitably loses quorum, run reset.sh again.
module Fin
-- Defined Vect and Fin datastructures as described in
-- "idris, a general purpose dependently typed programming language:
-- design and implementation"
data Vect: Nat -> Type -> Type where
Nil : Vect Z a
(::) : a -> Vect k a -> Vect (S k) a
data Fin : Nat -> Type where
fZ : Fin (S k)
with (import <nixpkgs> {});
let
buildGlideDeps = { name, glideYaml, glideLock, sha256 }:
stdenv.mkDerivation {
inherit name;
outputHashAlgo = "sha256";
outputHashMode = "recursive";
outputHash = sha256;
@moretea
moretea / errors.txt
Last active July 14, 2017 10:46
portworx + kops
Executing with arguments: -k etcd://100.96.6.3:2380 -c mycluster -a -f -x kubernetes
Fri Jul 14 10:40:51 UTC 2017 : Running on Linux ip-172-20-58-196 4.4.65-k8s #1 SMP Tue May 2 15:48:24 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
size for /dev/shm is 67100672, less than required 293601280
PXD version: 33cafba6c39c862340a8c30b2677849f67bd2d6a
Key Value Store: etcd://100.96.6.3:2380
Using cluster: mycluster
Using scheduler: kubernetes
/docker-entry-point.sh: line 763: /sys/fs/cgroup/cpu/cpu.rt_runtime_us: Permission denied
Failed to enable rt scheduler
Checking sysfs mount...