Loading doc/hooks/zig.section.md +15 −11 Original line number Diff line number Diff line # zig.hook {#zig-hook} # Zig {#zig} [Zig](https://ziglang.org/) is a general-purpose programming language and toolchain for maintaining robust, optimal and reusable software. In Nixpkgs, `zig.hook` overrides the default build, check and install phases. In Nixpkgs, `zig` overrides the default build, check and install phases. ## Example code snippet {#zig-hook-example-code-snippet} ## Example code snippet {#zig-example-code-snippet} ```nix { Loading @@ -16,7 +16,7 @@ In Nixpkgs, `zig.hook` overrides the default build, check and install phases. stdenv.mkDerivation { # . . . nativeBuildInputs = [ zig.hook ]; nativeBuildInputs = [ zig ]; zigBuildFlags = [ "-Dman-pages=true" ]; Loading @@ -26,11 +26,11 @@ stdenv.mkDerivation { } ``` ## Variables controlling zig.hook {#zig-hook-variables-controlling} ## Variables controlling zig {#zig-variables-controlling} ### `zig.hook` Exclusive Variables {#zig-hook-exclusive-variables} ### `zig` Exclusive Variables {#zig-exclusive-variables} The variables below are exclusive to `zig.hook`. The variables below are exclusive to `zig`. #### `dontUseZigBuild` {#dont-use-zig-build} Loading @@ -44,19 +44,23 @@ Disables using `zigCheckPhase`. Disables using `zigInstallPhase`. ### Similar variables {#zig-hook-similar-variables} #### `dontSetZigDefaultFlags` {#dont-set-zig-default-flags} Disables using a set of default flags when performing zig builds. ### Similar variables {#zig-similar-variables} The following variables are similar to their `stdenv.mkDerivation` counterparts. | `zig.hook` Variable | `stdenv.mkDerivation` Counterpart | | `zig` Variable | `stdenv.mkDerivation` Counterpart | |---------------------|-----------------------------------| | `zigBuildFlags` | `buildFlags` | | `zigCheckFlags` | `checkFlags` | | `zigInstallFlags` | `installFlags` | ### Variables honored by zig.hook {#zig-hook-variables-honored} ### Variables honored by zig {#zig-variables-honored} The following variables commonly used by `stdenv.mkDerivation` are honored by `zig.hook`. The following variables commonly used by `stdenv.mkDerivation` are honored by `zig`. - `prefixKey` - `dontAddPrefix` doc/redirects.json +15 −6 Original line number Diff line number Diff line Loading @@ -2713,16 +2713,20 @@ "waf-hook-honored-variables": [ "index.html#waf-hook-honored-variables" ], "zig-hook": [ "zig": [ "index.html#zig", "index.html#zig-hook" ], "zig-hook-example-code-snippet": [ "zig-example-code-snippet": [ "index.html#zig-example-code-snippet", "index.html#zig-hook-example-code-snippet" ], "zig-hook-variables-controlling": [ "zig-variables-controlling": [ "index.html#zig-variables-controlling", "index.html#zig-hook-variables-controlling" ], "zig-hook-exclusive-variables": [ "zig-exclusive-variables": [ "index.html#zig-exclusive-variables", "index.html#zig-hook-exclusive-variables" ], "dont-use-zig-build": [ Loading @@ -2734,10 +2738,15 @@ "dont-use-zig-install": [ "index.html#dont-use-zig-install" ], "zig-hook-similar-variables": [ "dont-set-zig-default-flags": [ "index.html#dont-set-zig-default-flags" ], "zig-similar-variables": [ "index.html#zig-similar-variables", "index.html#zig-hook-similar-variables" ], "zig-hook-variables-honored": [ "zig-variables-honored": [ "index.html#zig-variables-honored", "index.html#zig-hook-variables-honored" ], "xcbuildhook": [ Loading pkgs/by-name/fl/flow-control/package.nix +7 −8 Original line number Diff line number Diff line Loading @@ -6,11 +6,6 @@ callPackage, }: let zig_hook = zig_0_15.hook.overrideAttrs { zig_default_flags = "-Dcpu=baseline -Doptimize=ReleaseSafe --color off"; }; in stdenv.mkDerivation (finalAttrs: { pname = "flow-control"; version = "0.6.0"; Loading @@ -29,12 +24,16 @@ stdenv.mkDerivation (finalAttrs: { } $ZIG_GLOBAL_CACHE_DIR/p ''; nativeBuildInputs = [ zig_hook ]; nativeBuildInputs = [ zig_0_15 ]; passthru.updateScript = ./update.sh; dontSetZigDefaultFlags = true; zigBuildFlags = [ "-Dcpu=baseline" "-Doptimize=ReleaseSafe" ]; env.VERSION = finalAttrs.version; meta = { Loading pkgs/by-name/gh/ghostty/package.nix +5 −7 Original line number Diff line number Diff line Loading @@ -29,13 +29,7 @@ # https://github.com/ghostty-org/ghostty/blob/4b4d4062dfed7b37424c7210d1230242c709e990/PACKAGING.md#build-options optimizeLevel ? "ReleaseFast", }: let zig = zig_0_14; zig_hook = zig.hook.overrideAttrs { zig_default_flags = "-Dcpu=baseline -Doptimize=${optimizeLevel} --color off"; }; in stdenv.mkDerivation (finalAttrs: { pname = "ghostty"; version = "1.2.3"; Loading Loading @@ -66,7 +60,7 @@ stdenv.mkDerivation (finalAttrs: { pandoc pkg-config removeReferencesTo zig_hook zig_0_14 # GTK frontend glib # Required for `glib-compile-schemas` Loading @@ -93,10 +87,14 @@ stdenv.mkDerivation (finalAttrs: { harfbuzz ]; dontSetZigDefaultFlags = true; zigBuildFlags = [ "--system" "${finalAttrs.deps}" "-Dversion-string=${finalAttrs.version}" "-Dcpu=baseline" "-Doptimize=${optimizeLevel}" ] ++ lib.mapAttrsToList (name: package: "-fsys=${name} --search-prefix ${lib.getLib package}") { inherit glslang; Loading pkgs/by-name/ro/roc/package.nix +4 −3 Original line number Diff line number Diff line Loading @@ -31,6 +31,10 @@ rustPlatform.buildRustPackage { hash = "sha256-pPnOM4hpbAkGCV47aw5eHbpOujjFtJa3v/3/D8gybO8="; }; dontUseZigBuild = true; dontUseZigCheck = true; dontUseZigInstall = true; nativeBuildInputs = [ cmake zig_0_13 Loading @@ -53,9 +57,6 @@ rustPlatform.buildRustPackage { cargoHash = "sha256-wJViSHcezoIchWe4Py9j+9U+YJUA5ja/x94UipuWO2g="; # prevents zig AccessDenied error github.com/ziglang/zig/issues/6810 XDG_CACHE_HOME = "xdg_cache"; preBuild = let llvmVersion = builtins.splitVersion llvmPackages.release_version; Loading Loading
doc/hooks/zig.section.md +15 −11 Original line number Diff line number Diff line # zig.hook {#zig-hook} # Zig {#zig} [Zig](https://ziglang.org/) is a general-purpose programming language and toolchain for maintaining robust, optimal and reusable software. In Nixpkgs, `zig.hook` overrides the default build, check and install phases. In Nixpkgs, `zig` overrides the default build, check and install phases. ## Example code snippet {#zig-hook-example-code-snippet} ## Example code snippet {#zig-example-code-snippet} ```nix { Loading @@ -16,7 +16,7 @@ In Nixpkgs, `zig.hook` overrides the default build, check and install phases. stdenv.mkDerivation { # . . . nativeBuildInputs = [ zig.hook ]; nativeBuildInputs = [ zig ]; zigBuildFlags = [ "-Dman-pages=true" ]; Loading @@ -26,11 +26,11 @@ stdenv.mkDerivation { } ``` ## Variables controlling zig.hook {#zig-hook-variables-controlling} ## Variables controlling zig {#zig-variables-controlling} ### `zig.hook` Exclusive Variables {#zig-hook-exclusive-variables} ### `zig` Exclusive Variables {#zig-exclusive-variables} The variables below are exclusive to `zig.hook`. The variables below are exclusive to `zig`. #### `dontUseZigBuild` {#dont-use-zig-build} Loading @@ -44,19 +44,23 @@ Disables using `zigCheckPhase`. Disables using `zigInstallPhase`. ### Similar variables {#zig-hook-similar-variables} #### `dontSetZigDefaultFlags` {#dont-set-zig-default-flags} Disables using a set of default flags when performing zig builds. ### Similar variables {#zig-similar-variables} The following variables are similar to their `stdenv.mkDerivation` counterparts. | `zig.hook` Variable | `stdenv.mkDerivation` Counterpart | | `zig` Variable | `stdenv.mkDerivation` Counterpart | |---------------------|-----------------------------------| | `zigBuildFlags` | `buildFlags` | | `zigCheckFlags` | `checkFlags` | | `zigInstallFlags` | `installFlags` | ### Variables honored by zig.hook {#zig-hook-variables-honored} ### Variables honored by zig {#zig-variables-honored} The following variables commonly used by `stdenv.mkDerivation` are honored by `zig.hook`. The following variables commonly used by `stdenv.mkDerivation` are honored by `zig`. - `prefixKey` - `dontAddPrefix`
doc/redirects.json +15 −6 Original line number Diff line number Diff line Loading @@ -2713,16 +2713,20 @@ "waf-hook-honored-variables": [ "index.html#waf-hook-honored-variables" ], "zig-hook": [ "zig": [ "index.html#zig", "index.html#zig-hook" ], "zig-hook-example-code-snippet": [ "zig-example-code-snippet": [ "index.html#zig-example-code-snippet", "index.html#zig-hook-example-code-snippet" ], "zig-hook-variables-controlling": [ "zig-variables-controlling": [ "index.html#zig-variables-controlling", "index.html#zig-hook-variables-controlling" ], "zig-hook-exclusive-variables": [ "zig-exclusive-variables": [ "index.html#zig-exclusive-variables", "index.html#zig-hook-exclusive-variables" ], "dont-use-zig-build": [ Loading @@ -2734,10 +2738,15 @@ "dont-use-zig-install": [ "index.html#dont-use-zig-install" ], "zig-hook-similar-variables": [ "dont-set-zig-default-flags": [ "index.html#dont-set-zig-default-flags" ], "zig-similar-variables": [ "index.html#zig-similar-variables", "index.html#zig-hook-similar-variables" ], "zig-hook-variables-honored": [ "zig-variables-honored": [ "index.html#zig-variables-honored", "index.html#zig-hook-variables-honored" ], "xcbuildhook": [ Loading
pkgs/by-name/fl/flow-control/package.nix +7 −8 Original line number Diff line number Diff line Loading @@ -6,11 +6,6 @@ callPackage, }: let zig_hook = zig_0_15.hook.overrideAttrs { zig_default_flags = "-Dcpu=baseline -Doptimize=ReleaseSafe --color off"; }; in stdenv.mkDerivation (finalAttrs: { pname = "flow-control"; version = "0.6.0"; Loading @@ -29,12 +24,16 @@ stdenv.mkDerivation (finalAttrs: { } $ZIG_GLOBAL_CACHE_DIR/p ''; nativeBuildInputs = [ zig_hook ]; nativeBuildInputs = [ zig_0_15 ]; passthru.updateScript = ./update.sh; dontSetZigDefaultFlags = true; zigBuildFlags = [ "-Dcpu=baseline" "-Doptimize=ReleaseSafe" ]; env.VERSION = finalAttrs.version; meta = { Loading
pkgs/by-name/gh/ghostty/package.nix +5 −7 Original line number Diff line number Diff line Loading @@ -29,13 +29,7 @@ # https://github.com/ghostty-org/ghostty/blob/4b4d4062dfed7b37424c7210d1230242c709e990/PACKAGING.md#build-options optimizeLevel ? "ReleaseFast", }: let zig = zig_0_14; zig_hook = zig.hook.overrideAttrs { zig_default_flags = "-Dcpu=baseline -Doptimize=${optimizeLevel} --color off"; }; in stdenv.mkDerivation (finalAttrs: { pname = "ghostty"; version = "1.2.3"; Loading Loading @@ -66,7 +60,7 @@ stdenv.mkDerivation (finalAttrs: { pandoc pkg-config removeReferencesTo zig_hook zig_0_14 # GTK frontend glib # Required for `glib-compile-schemas` Loading @@ -93,10 +87,14 @@ stdenv.mkDerivation (finalAttrs: { harfbuzz ]; dontSetZigDefaultFlags = true; zigBuildFlags = [ "--system" "${finalAttrs.deps}" "-Dversion-string=${finalAttrs.version}" "-Dcpu=baseline" "-Doptimize=${optimizeLevel}" ] ++ lib.mapAttrsToList (name: package: "-fsys=${name} --search-prefix ${lib.getLib package}") { inherit glslang; Loading
pkgs/by-name/ro/roc/package.nix +4 −3 Original line number Diff line number Diff line Loading @@ -31,6 +31,10 @@ rustPlatform.buildRustPackage { hash = "sha256-pPnOM4hpbAkGCV47aw5eHbpOujjFtJa3v/3/D8gybO8="; }; dontUseZigBuild = true; dontUseZigCheck = true; dontUseZigInstall = true; nativeBuildInputs = [ cmake zig_0_13 Loading @@ -53,9 +57,6 @@ rustPlatform.buildRustPackage { cargoHash = "sha256-wJViSHcezoIchWe4Py9j+9U+YJUA5ja/x94UipuWO2g="; # prevents zig AccessDenied error github.com/ziglang/zig/issues/6810 XDG_CACHE_HOME = "xdg_cache"; preBuild = let llvmVersion = builtins.splitVersion llvmPackages.release_version; Loading