Skip to content

Instantly share code, notes, and snippets.

Niklas Hambüchen nh2

Block or report user

Report or block nh2

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@nh2
nh2 / ovh-dedicated-wipe-and-install-nixos.sh
Created Jun 3, 2019
Example script to install NixOS on an OVH dedicated server via the OVH rescue mode
View ovh-dedicated-wipe-and-install-nixos.sh
#!/usr/bin/env bash
# Installs NixOS on an OVH server in its rescue mode, wiping the server.
#
# This is for a specific server configuration; adjust where needed.
# Originally written for an OVH STOR-1 server.
#
# Prerequisites:
# * Create a LUKS key file at /root/datafs-luks-key
# e.g. by copying it up.
@nh2
nh2 / install-grub-errors.txt
Last active Jun 1, 2019
install-grub.pl errors with nixos-install when / is on an LVM LV on top of mdadm RA
View install-grub-errors.txt
# EDIT: Solution was that I had accidentally given grub a config where / is on LVM on LUKS, which can obviously not work.
# Still unclear why GRUB "memory leaks" in that case.
installing the GRUB 2 boot loader on /dev/sda...
Installing for i386-pc platform.
You have a memory leak (not released memory pool):
[0x56c1e0] dtree
[0x571e10] dtree
Internal error: Unreleased memory pool(s) found.
You have a memory leak (not released memory pool):
@nh2
nh2 / Cabal-2.4.1.0-9MZFDeNrcJI10bcroa6pq8.conf
Created May 29, 2019
Problem with GHC saying `<command line>: unknown package: integer-gmp` when Cabal built with an integer-gmp GHC is used in a build of a GHC with integer-simple
View Cabal-2.4.1.0-9MZFDeNrcJI10bcroa6pq8.conf
name: Cabal
version: 2.4.1.0
id: Cabal-2.4.1.0-9MZFDeNrcJI10bcroa6pq8
key: Cabal-2.4.1.0-9MZFDeNrcJI10bcroa6pq8
license: BSD-3-Clause
copyright: 2003-2018, Cabal Development Team (see AUTHORS file)
maintainer: cabal-devel@haskell.org
author: Cabal Development Team <cabal-devel@haskell.org>
homepage: http://www.haskell.org/cabal/
synopsis: A framework for packaging Haskell software
@nh2
nh2 / ProcessConduitGhciExample.hs
Created May 8, 2019
Example for controlling ghci interactively with conduit's process module
View ProcessConduitGhciExample.hs
-- Example for controlling ghci interactively with conduit's process module.
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
import Conduit
import Control.Concurrent.Async
import Control.Concurrent.MVar
import Control.Monad
import Data.Conduit (runConduit, (.|))
@nh2
nh2 / grep-darwin.txt
Last active May 3, 2019
Linux vs Darwin gst-plugins-good dev build outputs problem
View grep-darwin.txt
$ env | grep -i --color prop
propagatedBuildInputs=
propagatedNativeBuildInputs=
__propagatedImpureHostDeps=
depsHostHostPropagated=
__propagatedSandboxProfile=
depsBuildBuildPropagated=
depsBuildTargetPropagated=
depsTargetTargetPropagated=
@nh2
nh2 / Makefile
Last active Apr 26, 2019
Another make horror example. Guess what this does. (Don't use Make, unless you really know how it works, by which time you probably decide against it.)
View Makefile
# Let's assume COMPILER was for some accidental reason not set.
# COMPILER=gcc
CFLAGS = -O2 -Wall
all:
$(COMPILER) $(CFLAGS) --version
View error-output.txt
[root@builder:~/kernel]# mkdir tmpdir
[root@builder:~/kernel]# cd tmpdir
[root@builder:~/kernel/tmpdir]# NIX_PATH=nixpkgs=$HOME/kernel/nixpkgs nix-shell -E 'with import <nixpkgs> {}; linux.overrideAttrs (o: {nativeBuildInputs=o.nativeBuildInputs ++ [ pkgconfig ncurses ];})'
[nix-shell:~/kernel/tmpdir]# unpackPhase
unpacking source archive /nix/store/z7wzk01hjfgdcbnbzpkq040v7k9hw427-linux-4.19.36.tar.xz
source root is linux-4.19.36
setting SOURCE_DATE_EPOCH to timestamp 1555744565 of file linux-4.19.36/virt/lib/irqbypass.c
@nh2
nh2 / chromiumos-kernel.config
Created Apr 19, 2019
Looking for kernel config options that make ChromiumOS's config boot and NixOS's not
View chromiumos-kernel.config
% ./extract-ikconfig $(NIX_PATH=nixpkgs=$HOME/src/nixpkgs nix-build '<nixpkgs/nixos>' -A config.system.build.unsigned-chromiumos-kernel -I nixos-config=nixos-rootfs.nix --option builders-use-substitutes true --builders @$HOME/nix-remote-builders)/bzImage
#
# Automatically generated file; DO NOT EDIT.
# Linux/x86_64 4.4.178 Kernel Configuration
#
CONFIG_64BIT=y
CONFIG_X86_64=y
CONFIG_X86=y
CONFIG_INSTRUCTION_DECODER=y
CONFIG_PERF_EVENTS_INTEL_UNCORE=y
@nh2
nh2 / nixops-custom-subsitutor-hack.diff
Created Apr 19, 2019
Shows my custom hack to ensure deployed NixOps machines use my custom substitutor already for the first `nixops deploy`
View nixops-custom-subsitutor-hack.diff
diff --git a/nixops/deployment.py b/nixops/deployment.py
index 1341a27..6df2fd6 100644
--- a/nixops/deployment.py
+++ b/nixops/deployment.py
@@ -2,7 +2,7 @@
import sys
import os.path
-import subprocess
+import subprocess32 as subprocess
@nh2
nh2 / nixos-rootfs.nix
Last active Apr 19, 2019
Example of how to build a NixOS root file system
View nixos-rootfs.nix
# Build with:
# NIX_PATH=nixpkgs=$HOME/src/nixpkgs nix-build --no-link '<nixpkgs/nixos>' -A config.system.build.tarball -I nixos-config=thisfile.nix
# You can also use
# -A config.system.build.toplevel
# to build something you can browse locally (that uses symlinks into your nix store).
{config, pkgs, ...}:
{
# We need no bootloader, because the Chromebook can't use that anyway.
boot.loader.grub.enable = false;
You can’t perform that action at this time.