Skip to content

Instantly share code, notes, and snippets.

View noflcl's full-sized avatar

Stephen McNamara noflcl

View GitHub Profile
@noflcl
noflcl / nixos-rebuild-zfs-snapshot.nix
Created July 27, 2025 20:18
A wrapper script that takes ZFS snapshots prior to nixos-rebuild creating a new system
This wrapper script creates a shell script named `nixos-rebuild-hooked` that reads your `sanoid` config for which datasets are being managed, snapshots them prior to `nixos-rebuild` running. If you are suing `flakes` like I am you can execute rebuild with these features: `nixos-rebuild-hooked switch --flake .`
```nix
{ config, pkgs, ... }:
{
environment.systemPackages = with pkgs; [
(pkgs.writeShellScriptBin "nixos-rebuild-hooked" ''
echo "Running pre-rebuild hook..."
@noflcl
noflcl / seafile.md
Created August 16, 2025 21:16
Seafile Docker example

Here is a simple example for Seafile hosted with Docker in a Compose stack.

For your database network I create it as an --internal network: docker network create --internal your-name-here

Note: Update your email address, volume locations, and password fields

services:
  seafile-db:
    image: mariadb:10.11
@noflcl
noflcl / vscode-pinning.md
Created September 8, 2025 13:40
Pinning software with Nix home-manager

Pinning home-manager Packages

Are you using home-manager to install and configure software? Do you have a need to pin specific software versions?

First step is to select the build version of the software. You can go directly to GitHub or any site that distributes the archive of the build. I typically use https://lazamar.co.uk/nix-versions/?channel=nixos-25.05 to search for package URLs. Once you identify the build version you require, use nix-prefetch-url --type sha256 to retrieve and hash the software package.

{ pkgs, ... }:

let