From 950daf7fc384606605cafca1617bf12676485bed Mon Sep 17 00:00:00 2001 From: ยท๐‘‘๐‘ด๐‘•๐‘‘๐‘ฉ๐‘ค Date: Tue, 23 Dec 2025 06:22:23 +0000 Subject: mark-darcs-weak-hash: move to Nix --- README.rst | 7 +++---- nix/overlay/development.nix | 2 ++ nix/package/dev-shell.nix | 2 ++ nix/package/mark-darcs-weak-hash.nix | 26 ++++++++++++++++++++++++++ script/mk-darcs-weak-hash | 4 ---- 5 files changed, 33 insertions(+), 8 deletions(-) create mode 100644 nix/package/mark-darcs-weak-hash.nix delete mode 100644 script/mk-darcs-weak-hash diff --git a/README.rst b/README.rst index b8c2062..334e138 100644 --- a/README.rst +++ b/README.rst @@ -206,14 +206,13 @@ Darcs hooks (can skip) .. code:: console - $ chmod +x script/mk-darcs-weak-hash $ $EDITOR _darcs/prefs/defaults .. code:: - apply posthook script/mk-darcs-weak-hash && nix-build --no-out-link release.nix - obliterate posthook script/mk-darcs-weak-hash - record posthook script/mk-darcs-weak-hash + apply posthook nix-shell --run mk-darcs-weak-hash && nix-build --no-out-link release.nix + obliterate posthook nix-shell --run mk-darcs-weak-hash + record posthook nix-shell --run mk-darcs-weak-hash Hooks here can: โ€ข Build the entire project before applying patches to make sure it works. diff --git a/nix/overlay/development.nix b/nix/overlay/development.nix index b414597..c956556 100644 --- a/nix/overlay/development.nix +++ b/nix/overlay/development.nix @@ -7,6 +7,8 @@ final: prev: { final': prev': { dev-shell = final'.callPackage ../package/dev-shell.nix { }; + mark-darcs-weak-hash = final'.callPackage ../package/mark-darcs-weak-hash.nix { }; + nixfmt-3-space = final'.callPackage ../package/nixfmt-3-space.nix { }; ocamlformat-rpc-bin = final'.callPackage ../package/ocamlformat-rpc-bin.nix { }; diff --git a/nix/package/dev-shell.nix b/nix/package/dev-shell.nix index 77a9ac1..3cfec5c 100644 --- a/nix/package/dev-shell.nix +++ b/nix/package/dev-shell.nix @@ -7,6 +7,7 @@ kdlfmt, topiary, ocamlPackages, + mark-darcs-weak-hash, nixtamal, nixfmt-3-space, ocamlformat-rpc-bin, @@ -19,6 +20,7 @@ mkShell { ]; packages = [ kdlfmt + mark-darcs-weak-hash nixfmt-3-space topiary diff --git a/nix/package/mark-darcs-weak-hash.nix b/nix/package/mark-darcs-weak-hash.nix new file mode 100644 index 0000000..7f644e1 --- /dev/null +++ b/nix/package/mark-darcs-weak-hash.nix @@ -0,0 +1,26 @@ +#โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” +# SPDX-FileCopyrightText: 2025 toastal โ”‚ +# SPDX-License-Identifier: LGPL-2.1-or-later โ”‚ +#โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ +{ + lib, + writeDashBinScript, + darcs, + gawk, +}: + +let + path = lib.makeBinPath [ + darcs + gawk + ]; +in +writeDashBinScript { + name = "mark-darcs-weak-hash"; + text = /* sh */ '' + export PATH="${path}:$PATH" + + darcs show repo \ + | awk '/^[[:space:]]*Weak Hash:/ { sub(/^[[:space:]]*Weak Hash:[[:space:]]*/, "", $0); printf $0 }' > "$PWD/_darcs/weak_hash" + ''; +} diff --git a/script/mk-darcs-weak-hash b/script/mk-darcs-weak-hash deleted file mode 100644 index 0836354..0000000 --- a/script/mk-darcs-weak-hash +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env dash -base_dir=$(cd -- "$(dirname -- "$0")/.." && pwd) -darcs show repo \ - | awk '/^[[:space:]]*Weak Hash:/ { sub(/^[[:space:]]*Weak Hash:[[:space:]]*/, "", $0); printf $0 }' > "$base_dir/_darcs/weak_hash" -- cgit v1.2.3