Skip to content

Instantly share code, notes, and snippets.

@lmb
lmb / README.md
Last active November 14, 2023 13:45
macOS: use ssh-agent from nix-env

This recipe allows you to use the ssh-agent from nix-env with the auto generated SSH_AUTH_SOCK in /private/tmp. It works because disabling com.openssh.ssh-agent doesn't stop launchd from allocating SSH_AUTH_SOCK. com.nix.ssh-agent spawns a shell to remove the socket and then execute the homebrew ssh-agent.

  1. Install openssh from nix: nix-env --install --attr nikpkgs.openssh
  2. Disable the built in macOS agent: launchctl disable gui/$UID/com.openssh.ssh-agent
  3. Copy com.nix.ssh-agent.plist into ~/Library/LaunchAgents
  4. Enable the new agent: launchctl bootstrap gui/$UID ~/Library/LaunchAgents/com.nix.ssh-agent.plist
  5. Ensure that the correct agent is running:
@Gabriella439
Gabriella439 / default.nix
Created January 7, 2022 16:14
Nix build of vscode with haskell-language-server
let
nixpkgs = builtins.fetchTarball {
url = "https://github.com/NixOS/nixpkgs/archive/c473cc8714710179df205b153f4e9fa007107ff9.tar.gz";
sha256 = "0q7rnlp1djxc9ikj89c0ifzihl4wfvri3q1bvi75d2wrz844b4lq";
};
config = {
allowUnfree = true;
};
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).
{ config, pkgs, ... }:
{
################################################################################
# System
@dysinger
dysinger / configuration.nix
Last active December 28, 2022 18:39
Basic Full-Disk Encrypted ZFS Thinkpad (w/ 512 sector SSD) booted from USB key
# Basic Full-Disk Encrypted ZFS Thinkpad (w/ 512 sector SSD) booted from USB key
# EFI/BOOT:
# export BOOT=/dev/disk/by-id/usb-SanDisk_Ultra_Fit_4C530001011030101042-0\:0
# parted --script $BOOT -- \
# mklabel gpt \
# mkpart esp fat32 1MiB 512MiB \
# mkpart primary 512MiB 100% \
# set 1 boot on
# mkfs.vfat -n BOOT $BOOT-part1
@mattem
mattem / es_build.bzl
Created September 5, 2020 23:01
bazel rule for using esbuild to generate a single bundle. Include quick repo rule for fetching the esbuild binary (not complete)
load("@build_bazel_rules_nodejs//:providers.bzl", "JSEcmaScriptModuleInfo", "JSModuleInfo", "NpmPackageInfo", "node_modules_aspect")
load("@build_bazel_rules_nodejs//internal/linker:link_node_modules.bzl", "module_mappings_aspect")
def _strip_ext(f):
return f.short_path[:-len(f.extension) - 1]
def _resolve_js_input(f, inputs):
if f.extension == "js" or f.extension == "mjs":
return f
@misuzu
misuzu / oracle-cloud-nixos-install.md
Last active December 10, 2023 17:53
Install NixOS on Oracle Cloud over Ubuntu 18.04

Install NixOS on Oracle Cloud over Ubuntu 18.04 (make sure to use Ubuntu 18.04 or this may not work)

# install useful tools
sudo apt-get update
sudo apt-get install --no-install-recommends -y nano mc git

# prepare /boot
sudo umount /boot/efi
sudo mv /boot /boot.bak
@whoisryosuke
whoisryosuke / useMousePosition.md
Created November 5, 2018 19:22
React Hooks - Track user mouse position - via: https://twitter.com/JoshWComeau

Hook

import { useState, useEffect } from "react";

const useMousePosition = () => {
  const [mousePosition, setMousePosition] = useState({ x: null, y: null });

  const updateMousePosition = ev => {
 setMousePosition({ x: ev.clientX, y: ev.clientY });
@ldesgoui
ldesgoui / NixOS-on-T100TAF.sh
Created September 8, 2018 08:07
NixOS on ASUS Transformer T100TAF
# This is a "literal" shell script, you only should grab commands, it's not meant to be run.
# First, grab an i686 iso from https://nixos.org/nixos/download.html, flash it on an USB
# Reboot the T100TAF and mash F2 when the backlight is lit up, this should get you to BIOS
# In there, make sure EFI boot is enabled and disable secure boot, save then boot from USB
# Follow UEFI instructions from https://nixos.org/nixos/manual/index.html#sec-installation
# The WiFi card won't be detected, you'll need to run
mkdir -p /lib/firmware/brcm
cp /sys/firmware/efi/efivars/nvram-* /lib/firmware/brcm/brcmfmac43340-sdio.txt
rmmod brcmfmac
modprobe brcmfmac
@ddevault
ddevault / Makefile
Last active February 20, 2024 14:17
Tiny Wayland compositor
WAYLAND_PROTOCOLS=/usr/share/wayland-protocols
# wayland-scanner is a tool which generates C headers and rigging for Wayland
# protocols, which are specified in XML. wlroots requires you to rig these up
# to your build system yourself and provide them in the include path.
xdg-shell-protocol.h:
wayland-scanner server-header \
$(WAYLAND_PROTOCOLS)/stable/xdg-shell/xdg-shell.xml $@
xdg-shell-protocol.c: xdg-shell-protocol.h
@AkdM
AkdM / Edit_Repack_ISO_tutorial.md
Last active April 25, 2024 11:34
Edit and repack .iso bootable image

On Linux

Installing mkisofs

apt-get install mkisofs

Editing ISO image

mkdir /tmp/custom_iso