Skip to content

Instantly share code, notes, and snippets.

thefloweringash / openssh.nix
Created Nov 25, 2021
openssh module for nix-darwin
View openssh.nix
{ config, lib, pkgs, ... }:
# Puppet style imperative config for setting sshd settings
cfg =;
boolToStr = x: if x then "yes" else "no";
# User config imported from nixpkgs
userOptions = with lib; {
View upgrade-postgres.nix
{ pkgs ? import <nixpkgs> {}
, old ? "postgresql_9_6"
, new ? "postgresql_12"
oldPkg = pkgs."${old}";
newPkg = pkgs."${new}";
thefloweringash / test.nix
Last active Apr 28, 2021
Pre-merge test for #105026
View test.nix
# "Comprehensive" set of tests that nothing is critically broken by the m1
# branch.
# The claim is that:
# x86_64-darwin bootstrap tools can be recreated natively
# aarch64-darwin bootstrap tools can be cross compiled by x86_64-darwin
# This test suite is probably best run on an aarch64-darwin computer with
# x86_64-darwin remote builders. If run with rosetta, there's a chance that
# platform mismatches will be unnoticed.
thefloweringash / Gemfile
Created Jan 22, 2020
bundlerEnv ruby2.7 test case
View Gemfile
# frozen_string_literal: true
source ""
gem "thor"
thefloweringash / Notes
Created Aug 21, 2019
armv7 on aarch64
View Notes
Making armv7l in the cloud
Boot dezgeg’s image with qemu on something fancy:
truncate -s 200g sd-image-armv7l-linux.img
qemu-system-aarch64 -m 120g -smp 32 -enable-kvm -M virt -cpu host,aarch64=off -kernel kernel -initrd initrd -drive if=none,file=sd-image-armv7l-linux.img,format=raw,id=hd0,index=0 -device virtio-blk-device,drive=hd0 -netdev user,id=mynet,hostfwd=tcp::5555-:22 -device virtio-net-device,netdev=mynet -nographic -no-reboot -machine gic-version=3 -append 'systemConfig=/nix/store/s8zghld9hj07vh4w2dvgi9v3q8p6h7ka-nixos-system-nixos-19.03.git.ca2ba44cab4 init=/nix/store/s8zghld9hj07vh4w2dvgi9v3q8p6h7ka-nixos-system-nixos-19.03.git.ca2ba44cab4/init loglevel=7 console=ttyS0,115200n8 console=ttymxc0,115200n8 console=ttyAMA0,115200n8 console=ttyO0,115200n8 console=ttySAC2,115200n8 console=tty0'
Use kpartx to bring up the kernel/initrd and read the extlinux options
thefloweringash / log
Created Jul 22, 2019
nix-build nixos/release.nix -A tests.bittorrent.x86_64-linux
View log
starting VDE switch for network 2
starting VDE switch for network 1
running the VM test script
starting all VMs
tracker: starting vm
tracker# Formatting '/build/vm-state-tracker/tracker.qcow2', fmt=qcow2 size=536870912 cluster_size=65536 lazy_refcounts=off refcount_bits=16
tracker: QEMU running (pid 598)
router: starting vm
router# Formatting '/build/vm-state-router/router.qcow2', fmt=qcow2 size=536870912 cluster_size=65536 lazy_refcounts=off refcount_bits=16
router: QEMU running (pid 610)
#!/usr/bin/env nix-shell
#!nix-shell --pure -p dropbear -p cpio -p gzip -i bash
set -e
set -o pipefail
initrd_dest=/boot/secrets_initramfs.gz # must match nix config
thefloweringash / configuration.nix
Created May 1, 2019
Rock64 Kernel Patches for Mainline (5.0+)
View configuration.nix
boot.kernelPatches =
alarmRev = "2026bde";
alarmPatch = { name, sha256 }: {
inherit name;
patch = pkgs.fetchpatch {
url = "${alarmRev}/core/linux-aarch64/${name}";
inherit sha256;
thefloweringash / dirvish.nix
Last active Feb 9, 2019
dirvish package for nix
View dirvish.nix
{ stdenv, fetchurl, makeWrapper, perl, coreutils, rsync, bzip2, gzip, findutils,
stdenv.mkDerivation {
name = "dirvish";
src = fetchurl {
url = "";
sha256 = "1kbxa1irszp2zw8hd5qzqnrrzb4vxfivs1vn64yxnj0lak1jjzvb";
thefloweringash / gist:1511527c46d22730480c2f2e745ae7ad
Created Oct 24, 2018
What is `nix run`? How is it meant to work?
View gist:1511527c46d22730480c2f2e745ae7ad
$ nix run nixpkgs.rubocop
error: attribute 'nixpkgs' in selection path 'nixpkgs.rubocop' not found
$ nix run -f '<nixpkgs>' rubocop
tourou:~ lorne$ which rubocop
tourou:~ lorne$ exit
$ nix run -f '<nixpkgs>' rubocop -c which rubocop