allow building nix package with different optimizations
parent
f0e3516c34
commit
bf34582f54
14
flake.nix
14
flake.nix
|
|
@ -53,10 +53,22 @@
|
|||
};
|
||||
|
||||
packages.${system} = rec {
|
||||
ghostty = pkgs-stable.callPackage ./nix/package.nix {
|
||||
ghostty-debug = pkgs-stable.callPackage ./nix/package.nix {
|
||||
inherit (pkgs-zig-0-12) zig_0_12;
|
||||
revision = self.shortRev or self.dirtyShortRev or "dirty";
|
||||
optimize = "Debug";
|
||||
};
|
||||
ghostty-releasesafe = pkgs-stable.callPackage ./nix/package.nix {
|
||||
inherit (pkgs-zig-0-12) zig_0_12;
|
||||
revision = self.shortRev or self.dirtyShortRev or "dirty";
|
||||
optimize = "ReleaseSafe";
|
||||
};
|
||||
ghostty-releasefast = pkgs-stable.callPackage ./nix/package.nix {
|
||||
inherit (pkgs-zig-0-12) zig_0_12;
|
||||
revision = self.shortRev or self.dirtyShortRev or "dirty";
|
||||
optimize = "ReleaseFast";
|
||||
};
|
||||
ghostty = ghostty-releasesafe;
|
||||
default = ghostty;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
zig_0_12,
|
||||
pandoc,
|
||||
revision ? "dirty",
|
||||
optimize ? "Debug",
|
||||
}: let
|
||||
# The Zig hook has no way to select the release type without actual
|
||||
# overriding of the default flags.
|
||||
|
|
@ -34,7 +35,7 @@
|
|||
# ultimately acted on and has made its way to a nixpkgs implementation, this
|
||||
# can probably be removed in favor of that.
|
||||
zig012Hook = zig_0_12.hook.overrideAttrs {
|
||||
zig_default_flags = "-Dcpu=baseline -Doptimize=ReleaseFast";
|
||||
zig_default_flags = "-Dcpu=baseline -Doptimize=${optimize}";
|
||||
};
|
||||
|
||||
# This hash is the computation of the zigCache fixed-output derivation. This
|
||||
|
|
@ -132,18 +133,6 @@ in
|
|||
chmod u+rwX -R $ZIG_GLOBAL_CACHE_DIR
|
||||
'';
|
||||
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
zig build -Dcpu=baseline -Doptimize=ReleaseSafe -Dversion-string=${finalAttrs.version}-${revision}-nix
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
zig build install -Dcpu=baseline -Doptimize=ReleaseSafe -Dversion-string=${finalAttrs.version}-${revision}-nix --prefix $out
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
outputs = ["out" "terminfo" "shell_integration"];
|
||||
|
||||
postInstall = ''
|
||||
|
|
|
|||
Loading…
Reference in New Issue