Compare commits

...

4 Commits

Author SHA1 Message Date
24f44ec093 make scripts and script execution nix compatible 2025-05-19 11:59:12 -07:00
adb7f61436 add missing deps 2025-05-19 11:58:02 -07:00
b18faec312 change to python3.1.2 2025-05-19 11:36:31 -07:00
7432f2e77d update build.sh for nix compat 2025-05-19 11:22:14 -07:00
7 changed files with 20 additions and 13 deletions

View File

@ -11,7 +11,7 @@
with pkgs;
{
devShells.x86_64-linux.default = mkShell {
buildInputs = with python3Packages; [
buildInputs = with python312Packages; [
hy
(buildPythonPackage rec {
pname = "hyrule";
@ -29,6 +29,9 @@
];
})
bleach
pyaml
requests
requests_toolbelt
validators
];
};

View File

@ -1,3 +1,7 @@
hy>=1
hyrule>=1
bleach>=6.2.0
pyaml>=25.1.0
requests>=2.32.3
requests-toolbelt>=1
validators>=0.34.0

View File

@ -6,27 +6,27 @@
(setv (get hy-env "PATH") (+ (get hy-env "PATH") ":./www/site/scripts"))
(defn execute-bash [data]
(sub r"\$\[(.*?)\]" (fn [sequence]
(. (check-output (.group sequence 1) :shell True :executable "/bin/bash" :env hy-env) (decode) (strip)))
(defn execute-bash [data]
(sub r"\$\[(.*?)\]" (fn [sequence]
(. (check-output (.group sequence 1) :shell True :executable "bash" :env hy-env) (decode) (strip)))
data))
(defn parse-html-file [path #** kwargs]
(with [f (open path "r")]
(setv data (.read f)))
(for [[k v] (.items kwargs)]
(setv data (.replace data f"{"{"}{k}{"}"}" (str v))))
(execute-bash data))
(defn send-raw-file [path]
(setv [mime-type _] (guess-type path))
(when (not mime-type)
(setv mime-type "text/plain"))
(with [f (open path "rb")]
(setv data (.read f)))
(return #({"Content-Type" mime-type "Cache-Control" "max-age=300, stale-while-revalidate=3600"} data)))

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
mkdir data
(cd src; hy build.hy)
rm -rf site/html

View File

@ -8,4 +8,4 @@
(setv env hy-env)
(setv (get env "PATH") (+ (get hy-env "PATH") ":./scripts"))
(print (sub r"\$\[(.*?)\]" (fn [sequence] (. (check-output (.group sequence 1) :shell True :executable "/bin/bash" :env env) (decode) (strip))) (with [fp (open (get argv 1) "r")] (.read fp))))
(print (sub r"\$\[(.*?)\]" (fn [sequence] (. (check-output (.group sequence 1) :shell True :executable "bash" :env env) (decode) (strip))) (with [fp (open (get argv 1) "r")] (.read fp))))

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
path=$1
caption=$2

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
tmpfile=$(mktemp)
timeout 0.6s nvim "$1" -c "set nonu | set nornu" -c "autocmd LspAttach * execute 'TOhtml | w! ${tmpfile} | qa!'" >/dev/null || nvim "$1" -c "set nonu | set nornu" -c "TOhtml | w! ${tmpfile} | qa!" >/dev/null