diff --git a/flake.lock b/flake.lock index fdc677a90..a92be5310 100644 --- a/flake.lock +++ b/flake.lock @@ -3,11 +3,11 @@ "flake-compat": { "flake": false, "locked": { - "lastModified": 1673956053, - "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", "owner": "edolstra", "repo": "flake-compat", - "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", "type": "github" }, "original": { @@ -33,12 +33,15 @@ } }, "flake-utils": { + "inputs": { + "systems": "systems" + }, "locked": { - "lastModified": 1659877975, - "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", + "lastModified": 1705309234, + "narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=", "owner": "numtide", "repo": "flake-utils", - "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0", + "rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26", "type": "github" }, "original": { @@ -49,7 +52,7 @@ }, "flake-utils_2": { "inputs": { - "systems": "systems" + "systems": "systems_2" }, "locked": { "lastModified": 1710146030, @@ -67,7 +70,7 @@ }, "flake-utils_3": { "inputs": { - "systems": "systems_2" + "systems": "systems_3" }, "locked": { "lastModified": 1705309234, @@ -118,27 +121,27 @@ }, "nixpkgs-stable": { "locked": { - "lastModified": 1702049175, - "narHash": "sha256-c/q2+tGHbmLgzT3sXyUKVJR98h1CTks2+nkVaoZPRM0=", + "lastModified": 1718955215, + "narHash": "sha256-3vNXv4zrblZFobrxz1P3RwLpHl6X3/GzfArdTxq0+nI=", "owner": "nixos", "repo": "nixpkgs", - "rev": "b15508bd65870620f1df5864e8e861dffbc4e428", + "rev": "201ed88e66f7f34d5c74e46d2e4399cc4bea1501", "type": "github" }, "original": { "owner": "nixos", - "ref": "release-23.05", + "ref": "release-24.05", "repo": "nixpkgs", "type": "github" } }, "nixpkgs-unstable": { "locked": { - "lastModified": 1713687659, - "narHash": "sha256-Yd8KuOBpZ0Slau/NxFhMPJI0gBxeax0vq/FD0rqKwuQ=", + "lastModified": 1718870667, + "narHash": "sha256-jab3Kpc8O1z3qxwVsCMHL4+18n5Wy/HHKyu1fcsF7gs=", "owner": "nixos", "repo": "nixpkgs", - "rev": "f2d7a289c5a5ece8521dd082b81ac7e4a57c2c5c", + "rev": "9b10b8f00cb5494795e5f51b39210fed4d2b0748", "type": "github" }, "original": { @@ -186,6 +189,21 @@ "type": "github" } }, + "systems_3": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, "zig": { "inputs": { "flake-compat": "flake-compat", @@ -195,11 +213,11 @@ ] }, "locked": { - "lastModified": 1713659103, - "narHash": "sha256-WgWH0HPGsxd7Ov5M4Ug7qjmxbTeG8517xO6hY3198tU=", + "lastModified": 1718929454, + "narHash": "sha256-lh7877nXtLucRmiJFrgJsND9iduZEX1I0HZ8VUHhGYA=", "owner": "mitchellh", "repo": "zig-overlay", - "rev": "a13735003a235a2e4e202b47277129f99bfc9294", + "rev": "16b1b7e06642c9fa72f978e4c7e8561466f06ca8", "type": "github" }, "original": { @@ -218,11 +236,11 @@ ] }, "locked": { - "lastModified": 1717848532, - "narHash": "sha256-d+xIUvSTreHl8pAmU1fnmkfDTGQYCn2Rb/zOwByxS2M=", + "lastModified": 1718539737, + "narHash": "sha256-hvQ900gSqzGnJWMRQwv65TixciIbC44iX0Nh5ENRwCU=", "owner": "mitchellh", "repo": "zig-overlay", - "rev": "02fc5cc555fc14fda40c42d7c3250efa43812b43", + "rev": "6eb42ce6f85d247b1aecf854c45d80902821d0ad", "type": "github" }, "original": { @@ -242,11 +260,11 @@ "zig-overlay": "zig-overlay" }, "locked": { - "lastModified": 1717891972, - "narHash": "sha256-VyLdi6nZPMeQ431uKqJpQ01kwtmUQqYKgpvUdgSZ+DM=", + "lastModified": 1718930611, + "narHash": "sha256-FtfVhs6XHNfSQRQorrrz03nD0LCNp2FCnGllRntHBts=", "owner": "zigtools", "repo": "zls", - "rev": "c5ceadf362df07aa40b657db166bf6229a5ea1c5", + "rev": "0b9746b60c2020ab948f6556f1c729858b82a0f0", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 300d49a12..a04d2fd6c 100644 --- a/flake.nix +++ b/flake.nix @@ -7,7 +7,7 @@ # We want to stay as up to date as possible but need to be careful that the # glibc versions used by our dependencies from Nix are compatible with the # system glibc that the user is building for. - nixpkgs-stable.url = "github:nixos/nixpkgs/release-23.05"; + nixpkgs-stable.url = "github:nixos/nixpkgs/release-24.05"; zig = { url = "github:mitchellh/zig-overlay"; diff --git a/nix/package.nix b/nix/package.nix index 8888a4e29..be179fdb9 100644 --- a/nix/package.nix +++ b/nix/package.nix @@ -38,6 +38,27 @@ zig_default_flags = "-Dcpu=baseline -Doptimize=${optimize}"; }; + # 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 + # + # NOTE: as of the current moment only linux files are provided, + # since darwin support is not finished + src = lib.fileset.toSource { + root = ../.; + fileset = lib.fileset.intersection (lib.fileset.fromSource (lib.sources.cleanSource ../.)) ( + lib.fileset.unions [ + ../dist/linux + ../conformance + ../images + ../pkg + ../src + ../vendor + ../build.zig + ../build.zig.zon + ] + ); + }; + # This hash is the computation of the zigCache fixed-output derivation. This # allows us to use remote package dependencies without breaking the sandbox. # @@ -52,42 +73,43 @@ # derivation in your store already. If so, just update the value as above.) zigCacheHash = import ./zigCacheHash.nix; - zigCache = src: - stdenv.mkDerivation { - inherit src; - name = "ghostty-cache"; - nativeBuildInputs = [git zig_0_12.hook]; + zigCache = stdenv.mkDerivation { + inherit src; + name = "ghostty-cache"; + nativeBuildInputs = [ + git + zig_0_12.hook + ]; - dontConfigure = true; - dontUseZigBuild = true; - dontUseZigInstall = true; - dontFixup = true; + dontConfigure = true; + dontUseZigBuild = true; + dontUseZigInstall = true; + dontFixup = true; - buildPhase = '' - runHook preBuild + buildPhase = '' + runHook preBuild - zig build --fetch + zig build --fetch - runHook postBuild - ''; + runHook postBuild + ''; - installPhase = '' - runHook preInstall + installPhase = '' + runHook preInstall - cp -r --reflink=auto $ZIG_GLOBAL_CACHE_DIR $out + cp -r --reflink=auto $ZIG_GLOBAL_CACHE_DIR $out - runHook postInstall - ''; + runHook postInstall + ''; - outputHashMode = "recursive"; - outputHash = zigCacheHash; - }; + outputHashMode = "recursive"; + outputHash = zigCacheHash; + }; in stdenv.mkDerivation (finalAttrs: { pname = "ghostty"; version = "0.1.0"; - - src = ./..; + inherit src; nativeBuildInputs = [ git @@ -129,7 +151,7 @@ in preBuild = '' rm -rf $ZIG_GLOBAL_CACHE_DIR - cp -r --reflink=auto ${zigCache finalAttrs.src} $ZIG_GLOBAL_CACHE_DIR + cp -r --reflink=auto ${zigCache} $ZIG_GLOBAL_CACHE_DIR chmod u+rwX -R $ZIG_GLOBAL_CACHE_DIR ''; @@ -159,9 +181,9 @@ in patchelf --add-rpath "${lib.makeLibraryPath [libX11]}" "$out/bin/.ghostty-wrapped" ''; - meta = with lib; { + meta = { homepage = "https://github.com/ghostty-org/ghostty"; - license = licenses.mit; + license = lib.licenses.mit; platforms = ["x86_64-linux" "aarch64-linux"]; mainProgram = "ghostty"; };