Skip to content

Instantly share code, notes, and snippets.

View andir's full-sized avatar

Andreas Rammhold andir

View GitHub Profile
{ attrPaths ? [
"cargo-download"
# "cargo-vendor"
"carnix"
] }:
let
pkgs = import ../../../default.nix { };
getSource = pkg: pkg.overrideAttrs (_: {
with import <nixpkgs> {}; # FIXME: pin the revision
let
# there is no stable or content adressable URL for this file :(
url = https://riotgamespatcher-a.akamaihd.net/releases/live/installer/deploy/League%20of%20Legends%20installer%20NA.exe;
registry = pkgs.writeText "registry.reg" ''
REGEDIT4
[HKEY_CURRENT_USER\Software\Wine\X11 Driver]
@andir
andir / configuration.nix
Created September 14, 2018 23:25
nixos vm qcow2
{
imports = [
# configure the mountpoint of the root device
({
fileSystems."/".device = "/dev/disk/by-label/nixos";
})
# configure the bootloader
({
boot.loader.grub.extraConfig = ''
@andir
andir / debian.nix
Last active May 2, 2020 14:19
debian stretch
{ pkgs ? import <nixpkgs> {}}:
let
lib = pkgs.lib;
makeImageFromDebDist =
{ name, fullName, size ? 4096, urlPrefix
, packagesList ? "", packagesLists ? [packagesList]
, packages, extraPackages ? [], postInstall ? ""
, extraDebs ? []
, QEMU_OPTS ? "", memSize ? 512
, createRootFS }:
@andir
andir / default.nix
Created September 12, 2018 11:41
nixos build virtualbox image for dummies
# This file describes how to build custom virtualbox instances. This examples ignores things like cross compiling etc..
# this defines the function signature of our expression, pkgs is defaulted to the systems packages,
# you could also overrides that if you need a specific release / channel.
{ pkgs ? import <nixpkgs> {}}:
# "let" expressions are just there to introduce scoped variables and functions,
# in this case it is declaring just a helper function
let
# this creates a helper function that abstracts a bit of the boilerplate away
# `mkVM` takes one argument, a list of `modules` to include in the image.
@andir
andir / enp0s31f6.network
Created October 9, 2016 13:12
enp0s31f6.network with vrf
[Match]
Name=enp0s31f6
[Network]
Address=192.168.0.1/24
VRF=vrf-customer1
@andir
andir / vrf-customer1.netdev
Created October 9, 2016 13:05
systemd networkd example
[NetDev]
Name=vrf-customer1
Kind=vrf
[VRF]
TableId=42
@andir
andir / tasks_to_ical.py
Created August 18, 2016 14:46
convert taskwarrior tasks to ical entries when they have a scheduled date
#!/usr/bin/env python3
import os.path
from ics import Calendar, Event
import subprocess
import json
def read_tasks():
output = subprocess.check_output(['task', 'export'])
for task in json.loads(output.decode('utf-8')):
if task['status'] == 'completed':
@andir
andir / postgresql-docker-container.service
Last active September 13, 2017 10:37
postgresql-tmpfs via socket activation
[Service]
ExecStartPre=-/usr/bin/docker rm psql-tmpfs
ExecStart=/usr/bin/docker run --rm --shm-size=2g --name psql-tmpfs -p 127.0.0.1:5434:5432 -t andir/postgresql-tmpfs
ExecStartPost=/bin/sleep 15
ExecStop=/usr/bin/docker stop psql-tmpfs
@andir
andir / parse_relayed_msg.pl
Last active March 2, 2016 00:26
patched parse_relayed_msg.pl to work for flexget with gitter
#
# Copyright (c) 2011-2013 by w8rabbit (w8rabbit[at]mail[dot]i2p)
# or from outside i2p: w8rabbit[at]i2pmail[dot]org
#
# Script is under GPL3.
#
# Script is inspired by NullPointerException's xchat script
#
# thanks to darrob for hard beta-testing
#