mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 00:25:42 +02:00
docs/ci: use nix build --argstr
to safely supply input
Rather than interpolating input (flakeref & baseHref) into the build expression, take advantage of `--argstr`. See "Common evaluation options" in `nix build --help` for more detail.
This commit is contained in:
parent
ed30fd8588
commit
9416bc9018
1 changed files with 19 additions and 4 deletions
23
.github/workflows/build_documentation.yml
vendored
23
.github/workflows/build_documentation.yml
vendored
|
@ -53,15 +53,30 @@ jobs:
|
||||||
# 1: branch
|
# 1: branch
|
||||||
# 2: install dir (relative to /nixvim/)
|
# 2: install dir (relative to /nixvim/)
|
||||||
build() {
|
build() {
|
||||||
flake="github:${repo}${1:+/$1}"
|
branch="$1"
|
||||||
dir="${2:+/$2}"
|
dir="${2:+/$2}"
|
||||||
|
flakeref="github:${repo}${branch:+/$branch}"
|
||||||
baseHref="/${repoName}${dir}/"
|
baseHref="/${repoName}${dir}/"
|
||||||
installDir="${out}${dir}"
|
installDir="${out}${dir}"
|
||||||
|
|
||||||
# Build docs for the given flake ref, overriding baseHref in the derivation args
|
# Build docs for the given flake ref, overriding baseHref in the derivation args
|
||||||
nix build --impure --expr '(builtins.getFlake "'"$flake"'").outputs.packages.${builtins.currentSystem}.docs.override {
|
nix build --impure \
|
||||||
baseHref = "'"$baseHref"'";
|
--argstr flakeref "$flakeref" \
|
||||||
}'
|
--argstr baseHref "$baseHref" \
|
||||||
|
--expr '
|
||||||
|
{
|
||||||
|
flakeref,
|
||||||
|
baseHref,
|
||||||
|
system ? builtins.currentSystem,
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
flake = builtins.getFlake flakeref;
|
||||||
|
packages = flake.outputs.packages.${system};
|
||||||
|
in
|
||||||
|
packages.docs.override {
|
||||||
|
inherit baseHref;
|
||||||
|
}
|
||||||
|
'
|
||||||
|
|
||||||
# Copy the result to the install dir
|
# Copy the result to the install dir
|
||||||
mkdir -p "$installDir"
|
mkdir -p "$installDir"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue