Skip to content

Instantly share code, notes, and snippets.

View noflcl's full-sized avatar

Stephen McNamara noflcl

View GitHub Profile
@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
@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 / 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 / convert-docx-to-md.sh
Created July 6, 2025 15:11
Watch directory for new .docx files, convert to markdown and delete source file if successful
#!/bin/bash
# Set the source and destination directories
SRC_DIR=/path/to/source
DST_DIR=/path/to/destination
# Create the destination directory if it doesn't exist
mkdir -p "$DST_DIR"
# Watch the source directory for new .docx files
@noflcl
noflcl / optional-nix-code.md
Created June 21, 2025 02:34
Two ways you can have optional nix code apply to a system based on the hostname

Hostname based nix code

You will use hostname = config.networking.hostName; to gather the hostname of the device you are running the nixos-rebuild switch command on

{ config, pkgs, ... }:

let
  hostname = config.networking.hostName;
@noflcl
noflcl / pihole-v6.md
Last active February 19, 2025 15:42
PiHole V6 podman container using Nix oci-containers

PiHole V6

Are you using Nix? Have you been using oci-containers turing your Docker compose files into systemd podman services?

Probably should check it out, it's sweet!

Note: You must create your mapped volumes locally before the container will start.

Since they have dropped .php the new dashboard URL is http's'://server-ip/admin/login

  virtualisation = {
@noflcl
noflcl / Win11-Pro-Force.md
Last active January 19, 2025 15:10
Two files required to force Windows 11 to install Professional

Lenovo embedded a PreAuthroized OS License for Windows Home edition inside the BIOS. Windows11 tries really hard to force Home edition within a fresh install. How do you bypass this?

Create Windows11 USB, mount and place the following two files under the sources folder inside the root of the live USB.

Note: If creating ei.cfg within notepad, Save-as and "Filetype" set to All Files so the text file saves as a proper .cfg

Otherwise notepad will set the header to plaintext and the installer won't recognize it.

ei.cfg

@noflcl
noflcl / tmux-launch.sh
Created November 3, 2024 14:47
tmux launch new windows under "trunk" session starting at branch0
if ! [ "$(tmux ls | cut -d: -f1)" = "trunk" ]; then
tmux new-session -d -s trunk -n branch0
tmux attach-session -t trunk:branch0
elif [[ -z "${TMUX}" ]]; then
branch_id="$(tmux ls | cut -d ' ' -f2)"
tmux new-window -d -n branch$branch_id -t trunk:
tmux attach-session -t trunk:$branch_id
else
branch_id="$(tmux ls | cut -d ' ' -f2)"
tmux new-window -n branch$branch_id -t trunk:
@noflcl
noflcl / mkdocs-runner.yaml
Last active February 19, 2025 15:27
Builds and pushes signed commits - base image is Ubuntu 22.04 for build env
name: Forgejo local runner building mkdocs and deploying to pages
on:
push:
branches:
- 'main'
paths:
- 'mkdocs.yaml'
- 'docs/*'
- 'README.md'
@noflcl
noflcl / systemdBusEnv
Created October 14, 2024 14:44
Rocky no desktop install is missing user environment variable for local systemd control
export DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/$UID/bus"