diff --git a/.envrc b/.envrc index bf3c4ec..0f4a9b8 100644 --- a/.envrc +++ b/.envrc @@ -13,12 +13,13 @@ fi use_aether_guix() { watch_file guix-dev.scm + watch_file guix/channels.scm + watch_file guix/guix-dev watch_file .pre-commit-config.yaml watch_file scripts/plugin - watch_file "$HOME/guix-tribes/tribes/packages/devtools.scm" - watch_file "$HOME/guix-tribes/tribes/packages/node.scm" - use guix -L "$HOME/guix-tribes" -m guix-dev.scm + export GUIX_DEV_ROOT="$PWD" + eval "$(guix time-machine -C guix/channels.scm -- shell -m guix-dev.scm --search-paths)" if [ -f .env ]; then set -a; . ./.env; set +a; fi export MIX_OS_DEPS_COMPILE_PARTITION_COUNT=8 diff --git a/guix-dev.scm b/guix-dev.scm index 3215add..5263fef 100644 --- a/guix-dev.scm +++ b/guix-dev.scm @@ -1,11 +1,11 @@ ;; Guix development manifest for the Aether plugin. ;; ;; Usage: -;; guix shell -L ~/guix-tribes -m guix-dev.scm +;; ./guix/guix-dev ;; ;; This intentionally keeps the repo-specific development package list here, ;; similar to devenv.nix. Shared custom packages such as node-24, prek, and -;; prettier come from the local guix-tribes channel. +;; prettier come from the pinned guix-tribes channel. (use-modules (gnu packages bash) (gnu packages base) @@ -14,11 +14,47 @@ (gnu packages gnome) (gnu packages linux) (gnu packages nss) + (gnu packages package-management) (gnu packages version-control) + (guix build-system trivial) + (guix gexp) + ((guix licenses) #:prefix license:) + (guix packages) (guix profiles) (tribes packages devtools) ((tribes packages node) #:select (node-24))) +(define guix-dev-script + (local-file "guix/guix-dev" "guix-dev-script")) + +(define guix-dev-command-package + (package + (name "guix-dev-command") + (version "0.1") + (source #f) + (build-system trivial-build-system) + (arguments + (list + #:modules '((guix build utils)) + #:builder + #~(begin + (use-modules (guix build utils)) + (let* ((bin (string-append #$output "/bin")) + (target (string-append bin "/guix-dev"))) + (mkdir-p bin) + (copy-file #$guix-dev-script target) + (substitute* target + (("^#!/usr/bin/env bash") + (string-append "#!" #$(file-append bash-minimal "/bin/bash")))) + (chmod target #o555))))) + (inputs (list bash-minimal)) + (home-page "https://git.teralink.net/tribes/tribes-plugin-aether.git") + (synopsis "Pinned Guix development shell helper") + (description + "guix-dev re-enters this checkout's Guix development shell through its +repo-local guix/channels.scm time-machine pin and guix-dev.scm manifest.") + (license license:asl2.0))) + (packages->manifest (list bash coreutils @@ -27,6 +63,8 @@ sed nss-certs git + guix + guix-dev-command-package pre-commit prek prettier diff --git a/guix/channels.scm b/guix/channels.scm new file mode 100644 index 0000000..cd390d5 --- /dev/null +++ b/guix/channels.scm @@ -0,0 +1,24 @@ +(list + (channel + (name 'guix) + (url "https://git.teralink.net/tribes/guix-fork.git") + (branch "refactor/substituter-trace-framing") + ;; guix-fork refactor/substituter-trace-framing + (commit + "83b0e7d44546968002fb0c0043004da4e9bedc0d") + (introduction + (make-channel-introduction + "093f27dde01cdbda68f2ec4b81e5a34ae180aab9" + (openpgp-fingerprint + "6688 9153 C51C 4613 A493 A525 2F0D FD14 EF99 DAC3")))) + (channel + (name 'tribes) + (url "https://git.teralink.net/tribes/guix-tribes.git") + (branch "master") + (commit + "99789706834d678fb37f2c6a972b78803d2a2cf2") + (introduction + (make-channel-introduction + "607c69a5c1662acca07ad72c3e18646c73500856" + (openpgp-fingerprint + "6688 9153 C51C 4613 A493 A525 2F0D FD14 EF99 DAC3"))))) diff --git a/guix/guix-dev b/guix/guix-dev new file mode 100755 index 0000000..c4112d2 --- /dev/null +++ b/guix/guix-dev @@ -0,0 +1,20 @@ +#!/usr/bin/env bash +set -euo pipefail + +script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +root="$(cd "$script_dir/.." && pwd)" + +if [ ! -f "$root/guix-dev.scm" ]; then + root="$(git rev-parse --show-toplevel 2>/dev/null || pwd)" +fi + +channels="$root/guix/channels.scm" +manifest="$root/guix-dev.scm" + +if [ ! -f "$channels" ] || [ ! -f "$manifest" ]; then + echo "guix-dev: expected guix/channels.scm and guix-dev.scm in the project root" >&2 + exit 1 +fi + +exec guix time-machine -C "$channels" -- \ + shell -m "$manifest" "$@"