Skip to content

Instantly share code, notes, and snippets.


Casey Ransom cransom

View GitHub Profile
View buildthis
#!/usr/bin/env bash
nix-build -E "with import <nixpkgs> { }; callPackage ./$file {}" $*
View mosquitto.nix
services.mosquitto = {
host = "";
enable = true;
ssl = {
certfile = "/var/lib/acme/";
cafile = "/var/lib/acme/";
keyfile = "/var/lib/acme/";
users = {
View gist:3fe0f550adadb07736806e2b9f0ec338
system: "x86_64-darwin", multi-user?: no, version: nix-env (Nix) 2.2.2, channels(cransom): "darwin, nixpkgs-19.09.809.5000b1478a1", nixpkgs: /Users/cransom/.nix-defexpr/channels/nixpkgs
these derivations will be built:
building '/nix/store/55062cq3agq3z896p3nzjj0xxcdfpy96-password-store-1.7.3.drv'...
unpacking sources
unpacking source archive /nix/store/36dqisv8vdb1dryplh4zxsqif9bsqhl2-password-store-1.7.3.tar.xz
source root is password-store-1.7.3
setting SOURCE_DATE_EPOCH to timestamp 1533267168 of file password-store-1.7.3/tests/
patching sources
applying patch /nix/store/k4mklq09ga6jqqjh8ivzcbna42yjwq7k-set-correct-program-name-for-sleep.patch
#!/usr/bin/env bash
set -e -o pipefail
if [ "${1:-}" = "-h" ]; then
echo "This prepares a system for macOS Catalina. It takes no options."
exit 1
if [ $(id -u) -ne 0 ]; then
View gist:27ceb144af415b6a8708bf87739a57bd
1ogre:~% p=$(nix-build -E '(import <nixpkgs> {}).writeScriptBin "temprootmagic" "sleep 5"' --no-out-link)
these derivations will be built:
building '/nix/store/yyqa3qpyzlix54sl04l7w5cxl4brn0jy-temprootmagic.drv'...
0ogre:~% $p/bin/temprootmagic & nix-store --delete $p; sleep 6; nix-store --delete $p
[1] 28423
finding garbage collector roots...
removing stale link from '/nix/var/nix/gcroots/auto/aq6gwzvblglasi3znn83pf4mj39fmhr3' to '/tmp/nix-build-26603-0/result'
0 store paths deleted, 0.00 MiB freed
cransom /
Created Sep 27, 2019
If i were to IOT a garage door now...

My implementation 4 (or more?) years ago was:

  • wemos d1 mini module
  • hc-sr04 ultrasonic distance sensor
  • photo resistor (measure light level from the automatic light or ambient if open)
  • wemos 1ch relay. could have used a transistor, but i am iffy on what kind of voltage the garage button is using. electrical isolation is nice. my button does have couple modes like turning a light on as well if you let some amount of voltage through, but i didn't go there
  • hacked up arduino code using mqtt and some very fiddly json parsing that's frafile if you glance at it weird. the software didn't exist when i hacked mine how i wanted it.
  • homeassistant doing all the home automation things. It hooked into Homeassistant via MQTT sending messages back and forth. The distance sensor could only really tell if you the door is nearly all the way open due to how it was mounted. Knowing closed would be nicer but i would have had to mount it farther away and it's been fine so far.

I 3d printed a case/mount for it to dangle a

View gist:6cf1076e15ab2ac42dd6feac596b945c
[76/440] Linking target src/libpulsecommon-12.99.dylib.
FAILED: src/libpulsecommon-12.99.dylib
/nix/store/hi40vi42w2rnf9pflyhmsalcj5jf2bsv-clang-wrapper-7.1.0/bin/cc -o src/libpulsecommon-12.99.dylib 'src/25a6634@@pulsecommon-12.99@sha/pulse_client-conf.c.o' 'src/25a6634@@pulsecommon-12.99@sha/pulse_fork-detect.c.o' 'src/25a6634@@pulsecommon-12.99@sha/pulse_format.c.o' 'src/25a6634@@pulsecommon-12.99@sha/pulse_json.c.o' 'src/25a6634@@pulsecommon-12.99@sha/pulse_xmalloc.c.o' 'src/25a6634@@pulsecommon-12.99@sha/pulse_proplist.c.o' 'src/25a6634@@pulsecommon-12.99@sha/pulse_utf8.c.o' 'src/25a6634@@pulsecommon-12.99@sha/pulse_channelmap.c.o' 'src/25a6634@@pulsecommon-12.99@sha/pulse_sample.c.o' 'src/25a6634@@pulsecommon-12.99@sha/pulse_util.c.o' 'src/25a6634@@pulsecommon-12.99@sha/pulse_timeval.c.o' 'src/25a6634@@pulsecommon-12.99@sha/pulse_rtclock.c.o' 'src/25a6634@@pulsecommon-12.99@sha/pulse_volume.c.o' 'src/25a6634@@pulsecommon-12.99@sha/pulsecore_authkey.c.o' 'src/25a6634@@pulsecommon-12.99@sha/pulsecore_con
View configuration.nix
#eno1.10 is outside, eno1.20 is inside.
services.dnsmasq = {
enable = true;
resolveLocalQueries = true;
extraConfig = ''
#and other stuff
View downloader
if [ -n "$1" ]; then
View irda
killall ircomm >/dev/null
ircomm -d /dev/cuaa1 -y /dev/ptypv -v2
You can’t perform that action at this time.