Skip to content

Instantly share code, notes, and snippets.

@subtleGradient
Last active April 29, 2026 18:58
Show Gist options
  • Select an option

  • Save subtleGradient/f42fe1093e7b6b7cde8644f1db2f496f to your computer and use it in GitHub Desktop.

Select an option

Save subtleGradient/f42fe1093e7b6b7cde8644f1db2f496f to your computer and use it in GitHub Desktop.

note-gist executable probe

This Gist is a flat-file probe for executable content-document runners.

Gists reject directories, so every executable file must live at the Gist root.

Nix

Works unpinned:

nix run "git+https://gist.github.com/f42fe1093e7b6b7cde8644f1db2f496f.git" -- hello

Works pinned:

nix run "git+https://gist.github.com/f42fe1093e7b6b7cde8644f1db2f496f.git?ref=main&rev=<commit>" -- hello

Works as a document shebang:

#!/usr/bin/env -S nix run git+https://gist.github.com/f42fe1093e7b6b7cde8644f1db2f496f.git --

In shebang mode, the executable receives the document path as the first argument.

See nix-run-shebang-example.html for an executable static document example.

Bun

bun add can install this Gist as a git dependency:

bun add --no-save "git+https://gist.github.com/f42fe1093e7b6b7cde8644f1db2f496f.git"
bunx --bun --no-install note-gist hello

Direct bunx -p "git+https://..." note-gist does not work in Bun 1.3.13. bunx is documented as an npm package runner, while bun add is the command that supports git dependencies.

{
description = "Executable note gist probe";
outputs = { self }:
let
systems = [
"aarch64-darwin"
"x86_64-darwin"
"aarch64-linux"
"x86_64-linux"
];
forAllSystems = f:
builtins.listToAttrs (map (system: {
name = system;
value = f system;
}) systems);
in {
apps = forAllSystems (_system: {
default = {
type = "app";
program = "${self}/note-gist-nix";
};
});
};
}
#!/usr/bin/env -S nix run git+https://gist.github.com/f42fe1093e7b6b7cde8644f1db2f496f.git --
<!doctype html>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Nix Run Shebang Example</title>
<link
rel="stylesheet"
href="https://gistcdn.githack.com/subtleGradient/f42fe1093e7b6b7cde8644f1db2f496f/raw/note.css"
>
<main>
<h1>Nix run shebang example</h1>
<p>
This is a normal static HTML-ish content document for previewers, with a
first-line executable shebang for shells.
</p>
<p>
Run it with <code>./nix-run-shebang-example.html</code>. The remote Nix app
receives this document path as its first argument.
</p>
</main>
#!/bin/sh
set -eu
printf '%s\n' 'note-gist nix flake gist works'
printf 'argv=%s\n' "$*"
printf '%s\n' 'css=https://gistcdn.githack.com/subtleGradient/f42fe1093e7b6b7cde8644f1db2f496f/raw/note.css'
#!/usr/bin/env bun
const args = process.argv.slice(2);
const runtime = globalThis.Bun ? `bun ${Bun.version}` : `node ${process.version}`;
console.log("note-gist executable gist works");
console.log(`runtime=${runtime}`);
console.log(`argv=${JSON.stringify(args)}`);
console.log(
"css=https://gistcdn.githack.com/subtleGradient/f42fe1093e7b6b7cde8644f1db2f496f/raw/note.css",
);
* {color:lime !important}
{
"name": "note-gist",
"version": "0.0.0",
"type": "module",
"bin": {
"note-gist": "./note-gist.js"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment