Skip to content

Instantly share code, notes, and snippets.

@Mic92
Mic92 / README.md
Last active March 27, 2026 09:56
flake.nix vs shell.nix adoption survey on GitHub (2026-03)

flake.nix vs shell.nix on GitHub — Adoption Report

Generated by: nix-flake-survey.py Sample size: 300 / 300 repos

Raw Totals (root-level)

File Count
shell.nix 14,032
@Mic92
Mic92 / commit-visualization.html
Last active March 12, 2026 19:21
Visualization of commit 47d2d18: Make computeClosure async (Nix)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>computeClosure async — State Machine & Sequence Diagrams</title>
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; background: #0d1117; color: #c9d1d9; padding: 32px 48px; }
h1 { color: #58a6ff; font-size: 1.4em; margin-bottom: 4px; }
@Mic92
Mic92 / bench-copy-README.md
Last active March 12, 2026 16:38
Benchmark: nix copy to local store — base (sequential) vs new (parallel addMultipleToStore)

Benchmark: parallel addMultipleToStore for nix copy

Measures the performance impact of parallelizing LocalStore::addMultipleToStore (writing store paths to disk in parallel via a thread pool, then registering in a single SQLite transaction) vs the base sequential implementation.

Test closure: Firefox — ~372 paths, ~1.6GB total.

Setup

@Mic92
Mic92 / flake.lock
Created March 5, 2026 09:43
Reproducer for numtide/llm-agents.nix#2979 - works fine, cannot reproduce the electron_40 error
{
"nodes": {
"blueprint": {
"inputs": {
"nixpkgs": [
"llm-agents",
"nixpkgs"
],
"systems": "systems"
},
@Mic92
Mic92 / .envrc
Last active February 19, 2026 11:47
Run Phi-3 Mini on a local CUDA GPU with NixOS + direnv
use nix
@Mic92
Mic92 / authelia-declarative-users.nix
Last active December 30, 2025 20:33
Declarative Authelia users for NixOS - secrets resolved at runtime
# Declarative Authelia users with secret file references
# Secrets are resolved at service start, never stored in the Nix store
{
config,
lib,
pkgs,
...
}:
let
cfg = config.services.authelia.instances.main.declarativeUsers;
parallel_map() {
local func="$1"
local num_cores
num_cores=$(nproc 2>/dev/null || echo 4)
local pipe_buf_size
pipe_buf_size=$(getconf PIPE_BUF / 2>/dev/null || echo 4096)
local tmpdir
tmpdir=$(mktemp -d)
trap 'rm -rf "$tmpdir"' EXIT
From 3ceb739b696ac712dddfc6acf1f88e492d6f07d3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= <joerg@thalheim.io>
Date: Sat, 20 Jul 2024 10:23:57 +0200
Subject: [PATCH] detect systemd by name rather than relying on
SYSTEMD_BINARY_PATH
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This allows us in NixOS to run systemd binaries from the nix store
#!/bin/bash
set -eux -o pipefail
# Create mount point if it doesn't exist
mkdir -p /run/testmount
# Clean up on exit
trap 'umount /run/testmount; rmdir /run/testmount' EXIT
{ pkgs, config, ... }:
{
nixpkgs.config.allowUnfree = true;
nixpkgs.config.nvidia.acceptLicense = true;
# enable the nvidia driver
services.xserver.videoDrivers = [ "nvidia" ];
hardware.opengl.enable = true;
hardware.nvidia.datacenter.enable = true;
hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.dc_535;