mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
build: add nix script to make cache tarball
Run `nix run .#make-cache` to create a directory `blob/` with a tarball of the Zig deps.
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@ -19,3 +19,4 @@ glad.zip
|
|||||||
/Box_test_diff.ppm
|
/Box_test_diff.ppm
|
||||||
/ghostty.qcow2
|
/ghostty.qcow2
|
||||||
/build.zig.zon2json-lock
|
/build.zig.zon2json-lock
|
||||||
|
/blob
|
||||||
|
35
flake.nix
35
flake.nix
@ -45,6 +45,8 @@
|
|||||||
builtins.foldl' nixpkgs-stable.lib.recursiveUpdate {} (
|
builtins.foldl' nixpkgs-stable.lib.recursiveUpdate {} (
|
||||||
builtins.map (
|
builtins.map (
|
||||||
system: let
|
system: let
|
||||||
|
version = "1.1.1";
|
||||||
|
revision = self.shortRev or self.dirtyShortRev or "dirty";
|
||||||
pkgs-stable = nixpkgs-stable.legacyPackages.${system};
|
pkgs-stable = nixpkgs-stable.legacyPackages.${system};
|
||||||
pkgs-unstable = nixpkgs-unstable.legacyPackages.${system};
|
pkgs-unstable = nixpkgs-unstable.legacyPackages.${system};
|
||||||
in {
|
in {
|
||||||
@ -56,12 +58,12 @@
|
|||||||
|
|
||||||
packages.${system} = let
|
packages.${system} = let
|
||||||
mkArgs = optimize: {
|
mkArgs = optimize: {
|
||||||
inherit optimize;
|
inherit optimize version revision;
|
||||||
|
|
||||||
revision = self.shortRev or self.dirtyShortRev or "dirty";
|
|
||||||
};
|
};
|
||||||
in rec {
|
in rec {
|
||||||
deps = pkgs-stable.callPackage ./build.zig.zon.nix {};
|
deps = pkgs-stable.callPackage ./build.zig.zon.nix {
|
||||||
|
name = "ghostty-cache-${version}-${revision}";
|
||||||
|
};
|
||||||
ghostty-debug = pkgs-stable.callPackage ./nix/package.nix (mkArgs "Debug");
|
ghostty-debug = pkgs-stable.callPackage ./nix/package.nix (mkArgs "Debug");
|
||||||
ghostty-releasesafe = pkgs-stable.callPackage ./nix/package.nix (mkArgs "ReleaseSafe");
|
ghostty-releasesafe = pkgs-stable.callPackage ./nix/package.nix (mkArgs "ReleaseSafe");
|
||||||
ghostty-releasefast = pkgs-stable.callPackage ./nix/package.nix (mkArgs "ReleaseFast");
|
ghostty-releasefast = pkgs-stable.callPackage ./nix/package.nix (mkArgs "ReleaseFast");
|
||||||
@ -99,6 +101,31 @@
|
|||||||
x11-gnome = runVM ./nix/vm/x11-gnome.nix;
|
x11-gnome = runVM ./nix/vm/x11-gnome.nix;
|
||||||
x11-plasma6 = runVM ./nix/vm/x11-plasma6.nix;
|
x11-plasma6 = runVM ./nix/vm/x11-plasma6.nix;
|
||||||
x11-xfce = runVM ./nix/vm/x11-xfce.nix;
|
x11-xfce = runVM ./nix/vm/x11-xfce.nix;
|
||||||
|
make-cache = let
|
||||||
|
program = pkgs-stable.writeShellScript "make-cache" ''
|
||||||
|
set -e
|
||||||
|
mkdir -p blob
|
||||||
|
WORK_DIR=$(mktemp -d)
|
||||||
|
if [[ ! "$WORK_DIR" || ! -d "$WORK_DIR" ]]; then
|
||||||
|
echo "Could not create temp dir"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
function cleanup {
|
||||||
|
rm -rf "$WORK_DIR"
|
||||||
|
}
|
||||||
|
trap cleanup EXIT
|
||||||
|
ln -s "${self.packages.${system}.deps}" "$WORK_DIR/cache"
|
||||||
|
pushd "$WORK_DIR/cache" > /dev/null
|
||||||
|
tar --create --file "$WORK_DIR/temp.tar.gz" */*
|
||||||
|
popd > /dev/null
|
||||||
|
HASH=$(sha256sum "$WORK_DIR/temp.tar.gz" | awk "NR == 1 { print \$1 }; NR>1 { exit }")
|
||||||
|
mv "$WORK_DIR/temp.tar.gz" "blob/$HASH.tar.gz"
|
||||||
|
ln -sf "$HASH.tar.gz" "blob/ghostty-cache-${version}-${revision}.tar.gz"
|
||||||
|
'';
|
||||||
|
in {
|
||||||
|
type = "app";
|
||||||
|
program = "${program}";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
# Our supported systems are the same supported systems as the Zig binaries.
|
# Our supported systems are the same supported systems as the Zig binaries.
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
pkg-config,
|
pkg-config,
|
||||||
zig_0_13,
|
zig_0_13,
|
||||||
pandoc,
|
pandoc,
|
||||||
|
version,
|
||||||
revision ? "dirty",
|
revision ? "dirty",
|
||||||
optimize ? "Debug",
|
optimize ? "Debug",
|
||||||
enableX11 ? true,
|
enableX11 ? true,
|
||||||
@ -48,7 +49,7 @@
|
|||||||
in
|
in
|
||||||
stdenv.mkDerivation (finalAttrs: {
|
stdenv.mkDerivation (finalAttrs: {
|
||||||
pname = "ghostty";
|
pname = "ghostty";
|
||||||
version = "1.1.1";
|
inherit version;
|
||||||
|
|
||||||
# We limit source like this to try and reduce the amount of rebuilds as possible
|
# We limit source like this to try and reduce the amount of rebuilds as possible
|
||||||
# thus we only provide the source that is needed for the build
|
# thus we only provide the source that is needed for the build
|
||||||
|
Reference in New Issue
Block a user