Skip to content

Instantly share code, notes, and snippets.

View cransom's full-sized avatar

Casey Ransom cransom

View GitHub Profile
@cransom
cransom / irda
Created February 25, 2019 18:37
#!/bin/sh
killall ircomm >/dev/null
ircomm -d /dev/cuaa1 -y /dev/ptypv -v2
systemd.services.somemachine-rsync = {
after = [
"zfs-import-tank.service"
];
path = [ pkgs.rsync ];
#this notifies another unit in case it fails, i get a text to my phone.
onFailure = [
"unit-status@%n"
];
script = ''
#10 is wan interface, 20 is lan, 25 is my bench/thing i want to keep away from internal.
#let established flows from bench to lan work
iptables -A FORWARD -i eno1.25 -o eno1.20 -m state --state ESTABLISHED,RELATED -j ACCEPT
#let bench to internet work
iptables -A FORWARD -i eno1.25 -o eno1.10 -j ACCEPT
#let established flows from internet to bench go
iptables -A FORWARD -i eno1.10 -o eno1.25 -m state --state ESTABLISHED,RELATED -j ACCEPT
#drop everything else.
[nix-shell:~]$ echo "(import ./default.nix).bar" | hnix -
import ./default.nix.bar
nix-repl> builtins.fetchGit { url = "https://github.com/dailykos/nixpkgs.git"; ref = "master"; }
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
error: program 'git' failed with exit code 1
0ogre:~% buildthis ./m6YaTZaL.txt
these derivations will be built:
/nix/store/xfazdy12k9bbnby3y1n77snmy073gnkc-rocketchat_2.10.5_amd64.deb.drv
/nix/store/ig4z35cb0y3v3wncyxh5iqq12nxspp8b-rocketchat-2.10.5.drv
these paths will be fetched (2.35 MiB download, 14.98 MiB unpacked):
/nix/store/2mjsfm0c4hkxamsn7rr6x2iabj95dak1-gconf-3.2.6
/nix/store/3isyxdp6wmz7kabxqld8fky2ci51ql0s-libxkbfile-1.0.9
/nix/store/amcjwgn9jchlpwr33d4gyk7qr3smqpss-ORBit2-2.14.19
/nix/store/jlvwk1ijr4z3zq0nw34kkd88bjwrp7zi-dpkg-1.19.0.5
/nix/store/wl5cg4fa3jj7jgnwxq7h5dbkrjc62iaw-libnotify-0.7.7
0ogre:~/t% nix-shell -p bundix
these paths will be fetched (0.01 MiB download, 0.03 MiB unpacked):
/nix/store/prirzp3f5gwl3k2lcnbr317gb7g6sfxb-bundix-2.3.1
copying path '/nix/store/prirzp3f5gwl3k2lcnbr317gb7g6sfxb-bundix-2.3.1' from 'https://cache.nixos.org'...
[nix-shell:~/t]$ cat Gemfile
source 'https://rubygems.org'
gem 'nokogiri'
[nix-shell:~/t]$ bundix -l; bundix -i
{ configuration ? import ./lib/from-env.nix "NIXOS_CONFIG" <nixos-config>
, system ? builtins.currentSystem
}:
let
eval = import ./lib/eval-config.nix {
inherit system;
modules = [ configuration ];
};

Keybase proof

I hereby claim:

  • I am cransom on github.
  • I am cransom (https://keybase.io/cransom) on keybase.
  • I have a public key ASA3C1YF14LYSGeeA_IKuzvgXm4VSJRx34toKeHHkN5nKQo

To claim this, I am signing this object:

services.openvpn.servers.example = {
config = someconfighere;
autoStart = true;
up = ''
echo nameserver $nameserver | ${pkgs.openresolv}/bin/resolvconf -a $dev
'';
down = ''
echo nameserver $nameserver | ${pkgs.openresolv}/bin/resolvconf -d $dev
'';
};