Skip to content

Instantly share code, notes, and snippets.

View nh2's full-sized avatar

Niklas Hambüchen nh2

View GitHub Profile
@nh2
nh2 / Cabal-2.4.1.0-9MZFDeNrcJI10bcroa6pq8.conf
Created May 29, 2019 01:17
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
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 19:54
Example for controlling ghci interactively with conduit's process module
-- 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 17:17
Linux vs Darwin gst-plugins-good dev build outputs problem
$ env | grep -i --color prop
propagatedBuildInputs=
propagatedNativeBuildInputs=
__propagatedImpureHostDeps=
depsHostHostPropagated=
__propagatedSandboxProfile=
depsBuildBuildPropagated=
depsBuildTargetPropagated=
depsTargetTargetPropagated=
@nh2
nh2 / Makefile
Last active April 26, 2019 21:17
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.)
# Let's assume COMPILER was for some accidental reason not set.
# COMPILER=gcc
CFLAGS = -O2 -Wall
all:
$(COMPILER) $(CFLAGS) --version
@nh2
nh2 / error-output.txt
Created April 20, 2019 15:45
Error compiling kernel on NixOS as shown on https://nixos.wiki/wiki/Linux_Kernel#make_menuconfig
[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 April 19, 2019 23:07
Looking for kernel config options that make ChromiumOS's config boot and NixOS's not
% ./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 April 19, 2019 18:47
Shows my custom hack to ensure deployed NixOps machines use my custom substitutor already for the first `nixops deploy`
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 March 27, 2024 14:34
Example of how to build a NixOS root file system
# 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;
@nh2
nh2 / chromebook-samsung-linux-boot-discussion.txt
Created April 13, 2019 21:28
IRC discussion on #chromium-os on picked kernel bug and how to put newer kernels on the Samsung 500C like ChrUbuntu
→ nh2 joined • Channel mode: +cgnrt
02:41 <nh2> I think I found a bug in ChromiumOS's custom Linux kernel patches. How do I find the exact git commit of the kernel that my Chromebook is running?
03:30 <nh2> also, why is the `Version Lookup` box on https://cros-omahaproxy.appspot.com returning (in red bold text):
03:30 <nh2> <html> <head> <title>500 Internal Server Error</title> </head> <body> <h1>500 Internal Server Error</h1> The server has either erred or is incapable of performing the requested operation.<br /><br /> </body> </html>
05:50 → CEnnis91 joined ⇐ flyback quit ↔ seventh popped in ↔ bashfulshell, sibis and phh nipped out
Tuesday, March 19th, 2019
00:20
<+amstan> nh2: hey
00:20 <nh2> amstan: hey
00:21
@nh2
nh2 / ffunction-sections-xmonad.diff
Created April 4, 2019 03:57
Effect of -ffunction-sections on xmonad
% diff <(nm /nix/store/nz921f60s8bgjwfkd9h2g0dilj16yz4q-xmonad-0.14.2/bin/xmonad | cut '-d ' -f3) <(nm /nix/store/qk5v882jg6s8jzzbnir4mbyh10mqjqrc-xmonad-0.14.2/bin/xmonad | cut '-d ' -f3)
40,41d39
< AppendLEntry
< AppendLooseLEntry.isra.1
3155,3158d3152
< been_here.7889
< been_here.7898
< been_here.7906
< been_here.7918
4626d4619