<commit_before>#!/usr/bin/env sh

if [ "$#" -lt 1 ]; then
    cat <<EOF

Usage: $0 TARGET

Create a closure from the nixpkgs attribute "TARGET".
EOF

    exit 1
fi

target="$1"

expr="with import <nixpkgs> {}; with import ./. {}; closure { targets = [$target]; }"

out=$(nix-store --no-gc-warning -r $(nix-instantiate --no-gc-warning -E "$expr"))

if [ -z "$out" ]; then
  echo "$0 failed. Exiting."
  exit 1
else
  rm -f result
  ln -sf $out result
  echo "Dir created at result"
fi<commit_msg>Fix closure.sh<commit_after>#!/usr/bin/env sh

target="$1"

expr="with import <nixpkgs> {}; with import ./. {}; closure { targets = [$target]; }"

nix-store --no-gc-warning -r $(nix-instantiate --no-gc-warning -E "$expr")
{'fraction_non_alphanumeric': 0.1941340782122905, 'fraction_numerical': 0.009776536312849162, 'mean_word_length': 3.192982456140351, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3332076', 'n_tokens_mistral': 277, 'n_tokens_neox': 259, 'n_words': 81}