Skip to content

Instantly share code, notes, and snippets.

{ config, lib, pkgs, ... }:
with lib;
let
cfg = attrByPath [ "services" "local-modules" "nix-darwin" "keyboard" ] { } config;
globalKeyMappings = { }
// (if cfg.remapCapsLockToControl then { "Keyboard Caps Lock" = "Keyboard Left Control"; } else { })
// (if cfg.remapCapsLockToEscape then { "Keyboard Caps Lock" = "Keyboard Escape"; } else { })
// (if cfg.nonUS.remapTilde then { "Keyboard Non-US # and ~" = "Keyboard Grave Accent and Tilde"; } else { });
@eqyiel
eqyiel / Use Yubikey (GPG key) for SSH.md
Created August 2, 2020 11:49 — forked from jacquesbh/Use Yubikey (GPG key) for SSH.md
Use my Yubikey with GPG keys to SSH with a guest computer (OSX or Windows)
@eqyiel
eqyiel / nix-serve.md
Last active October 8, 2021 00:28
How to use nix-serve with an alternative store location

This is something you might want to do if you have an existing store directory on another dataset but don't want to overlay mount it onto /nix/store.

~/shell.nix is

{
  pkgs ? import <nixpkgs> {
    overlays = [
      (self: super: {
        nix = super.nix.override {
@eqyiel
eqyiel / apache-json-log-format
Created May 4, 2020 03:26 — forked from vmadman/apache-json-log-format
An apache log format that allow access logs (but not error logs) to be output in JSON format. I found this here: http://untergeek.com/2012/10/11/getting-apache-to-output-json-for-logstash/ -- but modified it for my purposes a good bit.
# Access Logs
LogFormat "{ \
\"@vips\":[\"%v\"], \
\"@source\":\"%v%U%q\", \
\"@source_host\": \"%v\", \
\"@source_path\": \"%f\", \
\"@tags\":[\"Apache\",\"Access\"], \
\"@message\": \"%h %l %u %t \\\"%r\\\" %>s %b\", \
\"@fields\": { \
\"timestamp\": \"%{%Y-%m-%dT%H:%M:%S%z}t\", \
@eqyiel
eqyiel / nixos-encrypted-zfs.sh
Created May 4, 2020 01:15 — forked from dysinger/nixos-encrypted-zfs.sh
How I installed Encrypted ZFS root on NixOS
#!/bin/sh
# FIRST STOP THE zfs-zed SERVICE
systemctl stop zfs-zed
# FORCE UNLOAD ZFS KERNEL MODULES
lsmod | grep zfs | cut -d' ' -f1 | xargs rmmod -f
# NOW ADD THE FOLLOWING TO /etc/nixos/configuration.nix
#
#!/usr/bin/env jq --raw-output --from-file --stream
. as $in
| select(length > 1)
| (
.[0] | map(
if type == "number"
then "[" + @json + "]"
else "." + .
end
~/sync/git/blue-moon-games/blue-moon-games master* 7s
❯ omnisharp-roslyn
Failed to launch '/bin/bash' with args, '-c 'uname -s -m''
{"Event":"log","Body":{"LogLevel":"INFORMATION","Name":"OmniSharp.Stdio.Host","Message":"Starting OmniSharp on Unknown 0.0 (Unknown)"},"Seq":1,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"INFORMATION","Name":"OmniSharp.Services.DotNetCliService","Message":"DotNetPath set to dotnet"},"Seq":2,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"INFORMATION","Name":"OmniSharp.MSBuild.Discovery.MSBuildLocator","Message":"Located 1 MSBuild instance(s)\n 1: StandAlone 15.0 - \"/nix/store/yjqp3591f77mgki0i2bqxcbja0ad557b-omnisharp-linux/omnisharp/msbuild/15.0/Bin\""},"Seq":3,"Type":"event"}
{"Event":"log","Body":{"LogLevel":"INFORMATION","Name":"OmniSharp.MSBuild.Discovery.MSBuildLocator","Message":"MSBUILD_EXE_PATH environment variable set to '/nix/store/yjqp3591f77mgki0i2bqxcbja0ad557b-omnisharp-linux/omnisharp/msbuild/15.0/Bin/MSBuild.dll'"},"Seq":4,"Type":"event"}
{"E
#!/bin/sh
# Sample usage:
# ❯ nix-grep-propagated-build-inputs /nix/store/0bvp7g95i5p7m3s0is1acikhwjhv1vr9-nextcloud-client-2.5.0git.drv openssl
# /nix/store/0jd1gsnmsdg8zrzy4an1cdhj1cfrmaj3-qtbase-5.11.1-dev/nix-support/propagated-build-inputs:/nix/store/zsb7fpy9k61kbdg3h3dqcqfk3wrxwfpr-libxml2-2.9.8-dev /nix/store/b8kyvsj5xfbxafgb0acp8gsr6wr200b1-libxslt-1.1.32-dev /nix/store/pvwihqljhxd4zv5g5l3qxkqfzz2d0d0q-openssl-1.0.2o-dev /nix/store/awplqhpipm0cq28k6sgr2dcryhb650cg-sqlite-3.24.0-dev /nix/store/wm92zyin0gjjvha3kxg2x7xg19wbj686-zlib-1.2.11-dev /nix/store/miq37wrkg7n23i3164vm6dwbxn9k2rq5-harfbuzz-icu-1.8.2-dev /nix/store/mpayk2qxxnjzg9imiixbfg7zcqjjpy9m-icu4c-59.1-dev /nix/store/pvfyhd8s4zsr0x8avwb59kr971vrqn4b-libjpeg-turbo-1.5.3-dev /nix/store/9zfcc0m4byss40ynixsgnryyq3p0lv3k-libpng-apng-1.6.34-dev /nix/store/1954i1yvaqww5l05v84ds3lrxf6kw15a-libtiff-4.0.9-dev /nix/store/7c2v0bwdjjw5zzjlrk05cpj31rj6zfzf-pcre2-10.31-dev /nix/store/wxqkkhir16ki7m5hx8pzzj15m9jkdr00-dbus-1.12.8-dev /nix/store/qvxkvwhbsmvz72s
{ nixpkgs ? <nixpkgs> }:
# note that importing ./nix/node is equivalent to importing ./nix/node/default.nix
with import nixpkgs {}; (import ./nix/node { nodejs = pkgs.nodejs; }).shell
@eqyiel
eqyiel / configure.sh
Created February 22, 2018 23:20 — forked from LnL7/configure.sh
darwin nix-daemon distributed builds
#!/usr/bin/env bash
sudo mkdir -p /run/nix/current-load
sudo launchctl unload /Library/LaunchDaemons/org.nixos.nix-daemon.plist
sudo rm /Library/LaunchDaemons/org.nixos.nix-daemon.plist
sudo curl -fsSL -o /Library/LaunchDaemons/org.nixos.nix-daemon.plist https://gist.github.com/LnL7/ba2eac19e77cd6b4bb02c8de03bf5f4e/raw/69722c2b13c4eb022a1312cd6891838b413e1f96/org.nixos.nix-daemon.plist
sudo launchctl load /Library/LaunchDaemons/org.nixos.nix-daemon.plist
# Configure /etc/nix/machines
# Make sure root can ssh to the builder (known_hosts etc.)