Skip to content

Instantly share code, notes, and snippets.

View zombiezen's full-sized avatar

Ross Light zombiezen

View GitHub Profile
@zombiezen
zombiezen / flake.lock
Last active December 15, 2023 17:03
Source code for my blog post "Bundling Scripts with Nix"
{
"nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1701680307,
"narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=",
"owner": "numtide",
@zombiezen
zombiezen / default.nix
Created August 26, 2023 17:03
Fixed up Bear Nix derivation
{ lib, stdenv
, fetchFromGitHub
, cmake
, ninja
, pkg-config
, grpc
, protobuf
, openssl
, nlohmann_json
, gtest
@zombiezen
zombiezen / flake.lock
Created August 15, 2023 17:30
Tester for foreign keys PRAGMA evaluating during prep
{
"nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1689068808,
"narHash": "sha256-6ixXo3wt24N/melDWjq70UuHQLxGV8jZvooRanIHXw0=",
"owner": "numtide",
@zombiezen
zombiezen / connecting-bash-to-nix.md
Created March 18, 2023 15:52
Connecting Bash to Nix blog post as Markdown

Julia Evans wrote a toot asking:

are there any guides to nix that start from the bottom up (for example starting with this bash script https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/generic/setup.sh) and then working up the layers of abstraction) instead of from the top down?

I realized that despite the title, my blog post Nix From the Ground Up misses the mark on providing this type of explanation. While I do think the Nix language is the lowest abstraction layer to learn Nix, I wanted to zoom in on the core derivation abstraction through a tutorial. This way, we can better understand how Nix derivations relate to Bash scripts.

@zombiezen
zombiezen / go.mod
Created May 22, 2021 04:46
sqliteops: a program for tracing what operations occur in a SQL script
module zombiezen.com/go/sqlite/internal/sqliteops
go 1.16
require zombiezen.com/go/sqlite v0.4.1-0.20210522044231-dbb157b27333
@zombiezen
zombiezen / Makefile
Created June 14, 2020 18:09
SQLite-loadable RE2 function
re2.so: re2.c++
g++ \
-I../sqlite-amalgamation-3320200 \
$(shell pkg-config --libs --cflags re2) \
-g -fPIC -shared \
re2.c++ \
-o re2.so
@zombiezen
zombiezen / go.mod
Created April 3, 2019 22:44
go mod tidy repro case
module example.com/foo
go 1.12
require (
cloud.google.com/go v0.34.0
github.com/google/martian v2.1.0+incompatible // indirect
github.com/googleapis/gax-go v0.0.0-20170321005343-9af46dd5a171 // indirect
github.com/mattn/go-sqlite3 v1.2.1-0.20170407154627-cf7286f069c3
github.com/philhofer/fwd v1.0.0 // indirect
@zombiezen
zombiezen / Dockerfile
Last active April 3, 2019 22:16
Go Modules Dockerfile
FROM golang:1.12 AS build
COPY go.mod go.sum m/
RUN cd m && go mod download
COPY . srcroot
RUN cd srcroot && go install -mod=readonly ./cmd/foo \
&& go clean -modcache -cache std
FROM debian:stretch-slim
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
@zombiezen
zombiezen / schema2go.go
Last active August 18, 2018 17:37
schema2go
// Copyright 2018 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
@zombiezen
zombiezen / log.txt
Created April 14, 2018 23:31
ev3dev boot log failure
Apr 14 13:43:37 ev3dev systemd[1]: Starting File System Check on /dev/mmcblk0p1...
Apr 14 13:43:37 ev3dev kernel: brcmfmac: brcmf_fw_map_chip_to_name: using brcm/brcmfmac43455-sdio.bin for chip 0x004345(17221) rev 0x000006
Apr 14 13:43:37 ev3dev kernel: usbcore: registered new interface driver brcmfmac
Apr 14 13:43:37 ev3dev kernel: brcmfmac mmc1:0001:1: Direct firmware load for brcm/brcmfmac43455-sdio.bin failed with error -2
Apr 14 13:43:37 ev3dev kernel: tacho-motor motor0: Registered 'lego-nxt-motor' on 'spi0.1:MA'.
Apr 14 13:43:37 ev3dev kernel: tacho-motor motor1: Registered 'lego-nxt-motor' on 'spi0.1:MB'.
Apr 14 13:43:37 ev3dev kernel: tacho-motor motor2: Registered 'lego-nxt-motor' on 'spi0.1:MC'.
Apr 14 13:43:37 ev3dev kernel: tacho-motor motor3: Registered 'lego-nxt-motor' on 'spi0.1:MD'.
Apr 14 13:43:37 ev3dev systemd-fsck[226]: fsck.fat 4.1 (2017-01-24)
Apr 14 13:43:37 ev3dev systemd-fsck[226]: /dev/mmcblk0p1: 155 files, 8833/24519 clusters