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
|
||||
# 2: install dir (relative to /nixvim/)
|
||||
build() {
|
||||
flake="github:${repo}${1:+/$1}"
|
||||
branch="$1"
|
||||
dir="${2:+/$2}"
|
||||
flakeref="github:${repo}${branch:+/$branch}"
|
||||
baseHref="/${repoName}${dir}/"
|
||||
installDir="${out}${dir}"
|
||||
|
||||
# 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 {
|
||||
baseHref = "'"$baseHref"'";
|
||||
}'
|
||||
nix build --impure \
|
||||
--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
|
||||
mkdir -p "$installDir"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue