mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
allow building nix package with different optimizations
This commit is contained in:

committed by
Mitchell Hashimoto

parent
f0e3516c34
commit
bf34582f54
14
flake.nix
14
flake.nix
@ -53,10 +53,22 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
packages.${system} = rec {
|
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;
|
inherit (pkgs-zig-0-12) zig_0_12;
|
||||||
revision = self.shortRev or self.dirtyShortRev or "dirty";
|
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;
|
default = ghostty;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
zig_0_12,
|
zig_0_12,
|
||||||
pandoc,
|
pandoc,
|
||||||
revision ? "dirty",
|
revision ? "dirty",
|
||||||
|
optimize ? "Debug",
|
||||||
}: let
|
}: let
|
||||||
# The Zig hook has no way to select the release type without actual
|
# The Zig hook has no way to select the release type without actual
|
||||||
# overriding of the default flags.
|
# overriding of the default flags.
|
||||||
@ -34,7 +35,7 @@
|
|||||||
# ultimately acted on and has made its way to a nixpkgs implementation, this
|
# ultimately acted on and has made its way to a nixpkgs implementation, this
|
||||||
# can probably be removed in favor of that.
|
# can probably be removed in favor of that.
|
||||||
zig012Hook = zig_0_12.hook.overrideAttrs {
|
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
|
# 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
|
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"];
|
outputs = ["out" "terminfo" "shell_integration"];
|
||||||
|
|
||||||
postInstall = ''
|
postInstall = ''
|
||||||
|
Reference in New Issue
Block a user