Skip to content

Instantly share code, notes, and snippets.

@thefloweringash
thefloweringash / Dockerfile
Last active June 8, 2023 07:34
Rails group/count key type bug test case
FROM ruby:3.2
COPY group-by-test.rb /
CMD "ruby" "/group-by-test.rb"
@thefloweringash
thefloweringash / openssh.nix
Created November 25, 2021 04:16
openssh module for nix-darwin
{ config, lib, pkgs, ... }:
# Puppet style imperative config for setting sshd settings
let
cfg = config.services.openssh;
boolToStr = x: if x then "yes" else "no";
# User config imported from nixpkgs
userOptions = with lib; {
@thefloweringash
thefloweringash / upgrade-postgres.nix
Created May 26, 2021 14:46
upgrade-postgres.nix
{ pkgs ? import <nixpkgs> {}
, old ? "postgresql_9_6"
, new ? "postgresql_12"
}:
let
oldPkg = pkgs."${old}";
newPkg = pkgs."${new}";
in
@thefloweringash
thefloweringash / test.nix
Last active April 28, 2021 04:56
Pre-merge test for #105026
# "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
thefloweringash / Gemfile
Created January 22, 2020 06:02
bundlerEnv ruby2.7 test case
# frozen_string_literal: true
source "https://rubygems.org"
gem "thor"
@thefloweringash
thefloweringash / Notes
Created August 21, 2019 12:14
armv7 on aarch64
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
thefloweringash / log
Created July 22, 2019 04:48
nix-build nixos/release.nix -A tests.bittorrent.x86_64-linux
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
key_location=/etc/nixos/dropbear_ecda_host_key
target_path=/etc/dropbear/dropbear_ecdsa_host_key
initrd_dest=/boot/secrets_initramfs.gz # must match nix config
@thefloweringash
thefloweringash / configuration.nix
Created May 1, 2019 04:26
Rock64 Kernel Patches for Mainline (5.0+)
{
boot.kernelPatches =
let
alarmRev = "2026bde";
alarmPatch = { name, sha256 }: {
inherit name;
patch = pkgs.fetchpatch {
url = "https://raw.githubusercontent.com/archlinuxarm/PKGBUILDs/${alarmRev}/core/linux-aarch64/${name}";
inherit sha256;
};
@thefloweringash
thefloweringash / dirvish.nix
Last active February 9, 2019 21:13
dirvish package for nix
{ stdenv, fetchurl, makeWrapper, perl, coreutils, rsync, bzip2, gzip, findutils,
perlPackages
}:
stdenv.mkDerivation {
name = "dirvish";
src = fetchurl {
url = "http://dirvish.org/dirvish-1.2.1.tgz";
sha256 = "1kbxa1irszp2zw8hd5qzqnrrzb4vxfivs1vn64yxnj0lak1jjzvb";