Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/build-helpers/images/appimagetools.section.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ let
version = "0.6.30";

src = fetchurl {
url = "https://github.com/nukeop/nuclear/releases/download/v${version}/${pname}-v${version}.AppImage";
url = "https://github.com/nukeop/nuclear/releases/download/v${version}/nuclear-v${version}.AppImage";
hash = "sha256-he1uGC1M/nFcKpMM9JKY4oeexJcnzV0ZRxhTjtJz6xw=";
};
in
Expand Down
8 changes: 8 additions & 0 deletions doc/doc-support/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ stdenvNoCC.mkDerivation (
'';

buildPhase = ''
runHook preBuild

substituteInPlace ./languages-frameworks/python.section.md \
--subst-var-by python-interpreter-table "$(<"${pythonInterpreterTable}")"

Expand Down Expand Up @@ -84,9 +86,13 @@ stdenvNoCC.mkDerivation (
--section-toc-depth 1 \
manual.md \
out/index.html

runHook postBuild
'';

installPhase = ''
runHook preInstall

dest="$out/share/doc/nixpkgs"
mkdir -p "$(dirname "$dest")"
mv out "$dest"
Expand All @@ -97,6 +103,8 @@ stdenvNoCC.mkDerivation (
mkdir -p $out/nix-support/
echo "doc manual $dest manual.html" >> $out/nix-support/hydra-build-products
echo "doc manual $dest nixpkgs-manual.epub" >> $out/nix-support/hydra-build-products

runHook postInstall
'';

passthru = {
Expand Down
2 changes: 1 addition & 1 deletion doc/functions/generators.section.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ let
} ":";
};

# the INI file can now be given as plain old nix values
in
# the INI file can now be given as plain old nix values
customToINI {
main = {
pushinfo = true;
Expand Down
10 changes: 5 additions & 5 deletions doc/hooks/tauri.section.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ In Nixpkgs, `cargo-tauri.hook` overrides the default build and install phases.
wrapGAppsHook4,
}:

rustPlatform.buildRustPackage rec {
# . . .
rustPlatform.buildRustPackage (finalAttrs: {
# ...

useFetchCargoVendor = true;
cargoHash = "...";

# Assuming our app's frontend uses `npm` as a package manager
npmDeps = fetchNpmDeps {
name = "${pname}-npm-deps-${version}";
name = "${finalAttrs.pname}-npm-deps-${finalAttrs.version}";
inherit src;
hash = "...";
};
Expand Down Expand Up @@ -61,8 +61,8 @@ rustPlatform.buildRustPackage rec {
# And make sure we build there too
buildAndTestSubdir = cargoRoot;

# . . .
}
# ...
})
```

## Variables controlling cargo-tauri {#tauri-hook-variables-controlling}
Expand Down
4 changes: 4 additions & 0 deletions doc/languages-frameworks/agda.section.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,12 @@ mkDerivation {
libraryName = "IAL-1.3";

buildPhase = ''
runHook preBuild

patchShebangs find-deps.sh
make

runHook postBuild
'';
}
```
Expand Down
9 changes: 8 additions & 1 deletion doc/languages-frameworks/bower.section.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,17 @@ pkgs.stdenv.mkDerivation {
src = myWebApp;
};

nativeBuildInputs = [
writableTmpDirAsHomeHook # note 3
];

buildPhase = ''
runHook preBuild

cp --reflink=auto --no-preserve=mode -R $bowerComponents/bower_components . # note 2
export HOME=$PWD # note 3
${pkgs.nodePackages.gulp}/bin/gulp build # note 4

runHook postBuild
'';

installPhase = "mv gulpdist $out";
Expand Down
4 changes: 2 additions & 2 deletions doc/languages-frameworks/dart.section.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ buildDartApplication rec {

src = fetchFromGitHub {
owner = "sass";
repo = pname;
rev = version;
repo = "dart-sass";
tag = version;
hash = "sha256-U6enz8yJcc4Wf8m54eYIAnVg/jsGi247Wy8lp1r1wg4=";
};

Expand Down
2 changes: 1 addition & 1 deletion doc/languages-frameworks/dlang.section.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ buildDubPackage rec {
src = fetchFromGitHub {
owner = "CyberShadow";
repo = "btdu";
rev = "v${version}";
tag = "v${version}";
hash = "sha256-3sSZq+5UJH02IO0Y1yL3BLHDb4lk8k6awb5ZysBQciE=";
};

Expand Down
41 changes: 37 additions & 4 deletions doc/languages-frameworks/emscripten.section.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,13 @@ One advantage is that when `pkgs.zlib` is updated, it will automatically update
(pkgs.zlib.override {
stdenv = pkgs.emscriptenStdenv;
}).overrideAttrs
(old: rec {
(old: {
buildInputs = old.buildInputs ++ [ pkg-config ];
# we need to reset this setting!
env = (old.env or { }) // {
NIX_CFLAGS_COMPILE = "";
};

configurePhase = ''
# FIXME: Some tests require writing at $HOME
HOME=$TMPDIR
Expand All @@ -57,15 +58,29 @@ One advantage is that when `pkgs.zlib` is updated, it will automatically update

runHook postConfigure
'';

dontStrip = true;
outputs = [ "out" ];

buildPhase = ''
runHook preBuild

emmake make

runHook postBuild
'';

installPhase = ''
runHook preInstall

emmake make install

runHook postInstall
'';

checkPhase = ''
runHook preCheck

echo "================= testing zlib using node ================="

echo "Compiling a custom test"
Expand All @@ -84,6 +99,8 @@ One advantage is that when `pkgs.zlib` is updated, it will automatically update
echo "it seems to work! very good."
fi
echo "================= /testing zlib using node ================="

runHook postCheck
'';

postPatch = pkgs.lib.optionalString pkgs.stdenv.hostPlatform.isDarwin ''
Expand All @@ -102,8 +119,9 @@ One advantage is that when `pkgs.zlib` is updated, it will automatically update
This `xmlmirror` example features an Emscripten package that is defined completely from this context and no `pkgs.zlib.override` is used.

```nix
pkgs.buildEmscriptenPackage rec {
name = "xmlmirror";
pkgs.buildEmscriptenPackage {
pname = "xmlmirror";
version = "1.2.3";

buildInputs = [
pkg-config
Expand All @@ -116,8 +134,10 @@ pkgs.buildEmscriptenPackage rec {
openjdk
json_c
];

nativeBuildInputs = [
pkg-config
writableTmpDirAsHomeHook
zlib
];

Expand All @@ -128,6 +148,8 @@ pkgs.buildEmscriptenPackage rec {
};

configurePhase = ''
runHook preConfigure

rm -f fastXmlLint.js*
# a fix for ERROR:root:For asm.js, TOTAL_MEMORY must be a multiple of 16MB, was 234217728
# https://gitlab.com/odfplugfest/xmlmirror/issues/8
Expand All @@ -137,11 +159,16 @@ pkgs.buildEmscriptenPackage rec {
sed -e "s/\$(JSONC_LDFLAGS) \$(ZLIB_LDFLAGS) \$(LIBXML20_LDFLAGS)/\$(JSONC_LDFLAGS) \$(LIBXML20_LDFLAGS) \$(ZLIB_LDFLAGS) /g" -i Makefile.emEnv
# https://gitlab.com/odfplugfest/xmlmirror/issues/11
sed -e "s/-o fastXmlLint.js/-s EXTRA_EXPORTED_RUNTIME_METHODS='[\"ccall\", \"cwrap\"]' -o fastXmlLint.js/g" -i Makefile.emEnv

runHook postConfigure
'';

buildPhase = ''
HOME=$TMPDIR
runHook preBuild

make -f Makefile.emEnv

runHook postBuild
'';

outputs = [
Expand All @@ -150,6 +177,8 @@ pkgs.buildEmscriptenPackage rec {
];

installPhase = ''
runHook preInstall

mkdir -p $out/share
mkdir -p $doc/share/${name}

Expand All @@ -163,9 +192,13 @@ pkgs.buildEmscriptenPackage rec {
cp *.json $out/share
cp *.rng $out/share
cp README.md $doc/share/${name}
runHook postInstall
'';

checkPhase = ''
runHook preCheck

runHook postCheck
'';
}
```
Expand Down
6 changes: 3 additions & 3 deletions doc/languages-frameworks/go.section.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ The following is an example expression using `buildGoModule`:

```nix
{
pet = buildGoModule rec {
pet = buildGoModule (finalAttrs: {
pname = "pet";
version = "0.3.4";

src = fetchFromGitHub {
owner = "knqyf263";
repo = "pet";
rev = "v${version}";
tag = "v${finalAttrs.version}";
hash = "sha256-Gjw1dRrgM8D3G7v6WIM2+50r4HmTXvx0Xxme2fH9TlQ=";
};

Expand All @@ -32,7 +32,7 @@ The following is an example expression using `buildGoModule`:
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ kalbasit ];
};
};
});
}
```

Expand Down
17 changes: 12 additions & 5 deletions doc/languages-frameworks/javascript.section.md
Original file line number Diff line number Diff line change
Expand Up @@ -198,14 +198,14 @@ Here's an example:
fetchFromGitHub,
}:

buildNpmPackage rec {
buildNpmPackage (finalAttrs: {
pname = "flood";
version = "4.7.0";

src = fetchFromGitHub {
owner = "jesec";
repo = pname;
rev = "v${version}";
repo = "flood";
tag = "v${finalAttrs.version}";
hash = "sha256-BR+ZGkBBfd0dSQqAvujsbgsEPFYw/ThrylxUbOksYxM=";
};

Expand All @@ -222,7 +222,7 @@ buildNpmPackage rec {
license = lib.licenses.gpl3Only;
maintainers = with lib.maintainers; [ winter ];
};
}
})
```

In the default `installPhase` set by `buildNpmPackage`, it uses `npm pack --json --dry-run` to decide what files to install in `$out/lib/node_modules/$name/`, where `$name` is the `name` string defined in the package's `package.json`.
Expand Down Expand Up @@ -646,9 +646,16 @@ It's important to use the `--offline` flag. For example if you script is `"build

```nix
{
nativeBuildInputs = [
writableTmpDirAsHomeHook
];

buildPhase = ''
export HOME=$(mktemp -d)
runHook preBuild

yarn --offline build

runHook postBuild
'';
}
```
Expand Down
5 changes: 2 additions & 3 deletions doc/languages-frameworks/lisp.section.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ During Quicklisp import:
- names starting with a number have a `_` prepended (`3d-vectors`->`_3d-vectors`)
- `_` in names is converted to `__` for reversibility


## Defining packages manually inside Nixpkgs {#lisp-defining-packages-inside}

Packages that for some reason are not in Quicklisp, and so cannot be
Expand Down Expand Up @@ -185,7 +184,7 @@ let
domain = "gitlab.common-lisp.net";
owner = "alexandria";
repo = "alexandria";
rev = "v${version}";
tag = "v${version}";
hash = "sha256-1Hzxt65dZvgOFIljjjlSGgKYkj+YBLwJCACi5DZsKmQ=";
};
};
Expand All @@ -212,7 +211,7 @@ sbcl.pkgs.alexandria.overrideLispAttrs (oldAttrs: rec {
domain = "gitlab.common-lisp.net";
owner = "alexandria";
repo = "alexandria";
rev = "v${version}";
tag = "v${version}";
hash = "sha256-1Hzxt65dZvgOFIljjjlSGgKYkj+YBLwJCACi5DZsKmQ=";
};
})
Expand Down
Loading