From 54e7f13f14c81aa86a12ed3ff219e88963766c49 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Thu, 7 Dec 2023 20:46:05 -0800 Subject: [PATCH 1/6] remove new-window action from desktop file Fixes #1006 --- dist/linux/app.desktop | 1 - 1 file changed, 1 deletion(-) diff --git a/dist/linux/app.desktop b/dist/linux/app.desktop index c87e73cee..1c9017ff4 100644 --- a/dist/linux/app.desktop +++ b/dist/linux/app.desktop @@ -13,5 +13,4 @@ X-GNOME-UsesNotifications=true [Desktop Action new-window] Name=New Window -Actions=new-window Exec=ghostty From 5846d991e95d44b5e41bf41a98618e1bc609d022 Mon Sep 17 00:00:00 2001 From: RGBCube <78925721+RGBCube@users.noreply.github.com> Date: Fri, 8 Dec 2023 12:33:33 +0300 Subject: [PATCH 2/6] Add garnix cache and clean up all nix code --- README.md | 37 +++--- flake.lock | 113 ++++-------------- flake.nix | 93 +++++++------- garnix.yaml | 6 + nix/build-support/check-zig-cache-hash.sh | 4 +- nix/{devshell.nix => devShell.nix} | 11 +- nix/overlay.nix | 27 ----- nix/package.nix | 20 +--- nix/wraptest.nix | 11 +- ...{zig_cache_hash.nix => zig-cache-hash.nix} | 0 shell.nix | 9 -- 11 files changed, 114 insertions(+), 217 deletions(-) create mode 100644 garnix.yaml rename nix/{devshell.nix => devShell.nix} (95%) delete mode 100644 nix/overlay.nix rename nix/{zig_cache_hash.nix => zig-cache-hash.nix} (100%) delete mode 100644 shell.nix diff --git a/README.md b/README.md index 0d4f31de4..37efc86ee 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,7 @@ beta users using Ghostty as their primary terminal. See more in | ------------------ | ------------------------------------------------------------------------ | -------------------------- | | macOS | [Tip ("Nightly")](https://github.com/mitchellh/ghostty/releases/tag/tip) | MacOS 12+ Universal Binary | | Linux | [Build from Source](#developing-ghostty) | | +| Linux (NixOS/Nix) | [Use the Flake](#nix-package) | | | Windows | [Build from Source](#developing-ghostty) | [Notes](#windows-notes) | ### Configuration @@ -505,50 +506,42 @@ Make sure your Prettier version matches the version of in [devshell.nix](https:/ ### Nix Package -> [!WARNING] -> The Nix package currently depends on versions of LLVM and Zig that are -> currently not in cache.nixos.org and will be built from source. This can take -> a very long time, especially in situations where CPU is at a premium. Most -> people should follow the instructions in [Developing -> Ghostty](#developing-ghostty) instead. +There is Nix package that can be used in the flake (`packages.ghostty` or `packages.default`). +It can be used in NixOS configurations and otherwise built off of. -There is a functional Nix package that can be used in the `flake.nix` file -(`packages.ghostty`). It can be used in NixOS configurations and otherwise -built off of (however, please heed the above warning). - -Below is a sample on how to add it to a NixOS overlay: +Below is an example: ```nix { inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; - # NOTE: This will require your git SSH access to the repo + # NOTE: This will require your git SSH access to the repo. + # + # WARNING: Do NOT pin the `nixpkgs` input, as that will + # declare the cache useless. If you do, you will have + # to compile LLVM, Zig and Ghostty itself on your machine, + # which will take a very very long time. ghostty = { url = "git+ssh://git@github.com/mitchellh/ghostty"; - inputs.nixpkgs.follows = "nixpkgs"; }; }; outputs = { nixpkgs, ghostty, ... }: { - nixosConfigurations.nixos = nixpkgs.lib.nixosSystem { + nixosConfigurations.mysystem = nixpkgs.lib.nixosSystem { modules = [ { - nixpkgs.overlays = [ - (final: prev: { - ghostty = ghostty.packages.${prev.system}.ghostty; - }) + environment.systemPackages = [ + ghostty.packages.x86_64-linux.default ]; } - - # Other modules here... ]; }; }; } ``` -You can also test the build of the nix package at any time by running `nix build .` +You can also test the build of the nix package at any time by running `nix build .`. #### Updating the Zig Cache Fixed-Output Derivation Hash @@ -567,5 +560,5 @@ To update it, you can run the following in the repository root: ./nix/build-support/check-zig-cache-hash.sh --update ``` -This will write out the `nix/zig_cache_hash.nix` file with the updated hash +This will write out the `nix/zig-cache-hash.nix` file with the updated hash that can then be committed and pushed to fix the builds. diff --git a/flake.lock b/flake.lock index 046409e95..cdcb72981 100644 --- a/flake.lock +++ b/flake.lock @@ -3,11 +3,11 @@ "flake-compat": { "flake": false, "locked": { - "lastModified": 1648199409, - "narHash": "sha256-JwPKdC2PoVBkG6E+eWw3j6BMR6sL3COpYWfif7RVb8Y=", + "lastModified": 1673956053, + "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", "owner": "edolstra", "repo": "flake-compat", - "rev": "64a525ee38886ab9028e6f61790de0832aa3ef03", + "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", "type": "github" }, "original": { @@ -32,38 +32,7 @@ "type": "github" } }, - "flake-compat_3": { - "flake": false, - "locked": { - "lastModified": 1673956053, - "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", - "owner": "edolstra", - "repo": "flake-compat", - "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", - "type": "github" - }, - "original": { - "owner": "edolstra", - "repo": "flake-compat", - "type": "github" - } - }, "flake-utils": { - "locked": { - "lastModified": 1656065134, - "narHash": "sha256-oc6E6ByIw3oJaIyc67maaFcnjYOz1mMcOtHxbEf9NwQ=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "bee6a7250dd1b01844a2de7e02e4df7d8a0a206c", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "flake-utils_2": { "locked": { "lastModified": 1659877975, "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", @@ -78,7 +47,7 @@ "type": "github" } }, - "flake-utils_3": { + "flake-utils_2": { "inputs": { "systems": "systems" }, @@ -96,7 +65,7 @@ "type": "github" } }, - "flake-utils_4": { + "flake-utils_3": { "locked": { "lastModified": 1659877975, "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", @@ -114,7 +83,7 @@ "gitignore": { "inputs": { "nixpkgs": [ - "zls-master", + "zls", "nixpkgs" ] }, @@ -144,18 +113,18 @@ "url": "https://raw.githubusercontent.com/ziglang/zig/63bd2bff12992aef0ce23ae4b344e9cb5d65f05d/doc/langref.html.in" } }, - "nixpkgs": { + "nixpkgs-stable": { "locked": { - "lastModified": 1691950488, - "narHash": "sha256-iUNEeudc4dGjx+HsHccnGiuZUVE/nhjXuQ1DVCsHIUY=", + "lastModified": 1702042171, + "narHash": "sha256-abT0/nqbQfvx052z0JLkCDXulyM+YGznbN8tv6DYNpo=", "owner": "nixos", "repo": "nixpkgs", - "rev": "720e61ed8de116eec48d6baea1d54469b536b985", + "rev": "357f2203132b749d87d379dfe05245204b2dfe93", "type": "github" }, "original": { "owner": "nixos", - "ref": "release-23.05", + "ref": "release-23.11", "repo": "nixpkgs", "type": "github" } @@ -192,47 +161,13 @@ "type": "github" } }, - "nixpkgs_2": { - "locked": { - "lastModified": 1689088367, - "narHash": "sha256-Y2tl2TlKCWEHrOeM9ivjCLlRAKH3qoPUE/emhZECU14=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "5c9ddb86679c400d6b7360797b8a22167c2053f8", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "release-23.05", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_3": { - "locked": { - "lastModified": 1701336116, - "narHash": "sha256-kEmpezCR/FpITc6yMbAh4WrOCiT2zg5pSjnKrq51h5Y=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "f5c27c6136db4d76c30e533c20517df6864c46ee", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixpkgs-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, "root": { "inputs": { - "flake-compat": "flake-compat", - "flake-utils": "flake-utils", - "nixpkgs": "nixpkgs", + "nixpkgs-stable": "nixpkgs-stable", "nixpkgs-unstable": "nixpkgs-unstable", "nixpkgs-zig-0-12": "nixpkgs-zig-0-12", "zig": "zig", - "zls-master": "zls-master" + "zls": "zls" } }, "systems": { @@ -252,9 +187,11 @@ }, "zig": { "inputs": { - "flake-compat": "flake-compat_2", - "flake-utils": "flake-utils_2", - "nixpkgs": "nixpkgs_2" + "flake-compat": "flake-compat", + "flake-utils": "flake-utils", + "nixpkgs": [ + "nixpkgs-stable" + ] }, "locked": { "lastModified": 1701908568, @@ -272,10 +209,10 @@ }, "zig-overlay": { "inputs": { - "flake-compat": "flake-compat_3", - "flake-utils": "flake-utils_4", + "flake-compat": "flake-compat_2", + "flake-utils": "flake-utils_3", "nixpkgs": [ - "zls-master", + "zls", "nixpkgs" ] }, @@ -293,12 +230,14 @@ "type": "github" } }, - "zls-master": { + "zls": { "inputs": { - "flake-utils": "flake-utils_3", + "flake-utils": "flake-utils_2", "gitignore": "gitignore", "langref": "langref", - "nixpkgs": "nixpkgs_3", + "nixpkgs": [ + "nixpkgs-stable" + ], "zig-overlay": "zig-overlay" }, "locked": { diff --git a/flake.nix b/flake.nix index b1411652b..9fc4d0d7d 100644 --- a/flake.nix +++ b/flake.nix @@ -1,11 +1,18 @@ { - description = "ghostty"; + description = "👻"; + + nixConfig = { + extra-trusted-substituters = "https://cache.garnix.io/"; + extra-trusted-public-keys = "cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g="; + }; inputs = { nixpkgs-unstable.url = "github:nixos/nixpkgs/nixpkgs-unstable"; - flake-utils.url = "github:numtide/flake-utils"; - zig.url = "github:mitchellh/zig-overlay"; - zls-master.url = "github:zigtools/zls/master"; + + # 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.11"; # This is a nixpkgs mirror (based off of nixos-unstable) that contains # patches for LLVM 17 and Zig 0.12 (master/nightly). @@ -17,54 +24,44 @@ # devShell) to build a Zig that can be included in a NixOS configuration. nixpkgs-zig-0-12.url = "github:vancluever/nixpkgs/vancluever-zig-0-12"; - # 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.url = "github:nixos/nixpkgs/release-23.05"; + zig = { + url = "github:mitchellh/zig-overlay"; + inputs.nixpkgs.follows = "nixpkgs-stable"; + }; - # Used for shell.nix - flake-compat = { url = github:edolstra/flake-compat; flake = false; }; + zls = { + url = "github:zigtools/zls/master"; + inputs.nixpkgs.follows = "nixpkgs-stable"; + }; }; - outputs = { self, nixpkgs, flake-utils, ... }@inputs: - let - overlays = [ - # Our repo overlay - (import ./nix/overlay.nix) + outputs = { + nixpkgs-unstable + , nixpkgs-stable + , nixpkgs-zig-0-12 + , zig + , zls + , ... + }: builtins.foldl' nixpkgs-stable.lib.recursiveUpdate {} (builtins.map (system: let + pkgs-stable = nixpkgs-stable.legacyPackages.${system}; + pkgs-unstable = nixpkgs-unstable.legacyPackages.${system}; + pkgs-zig-0-12 = nixpkgs-zig-0-12.legacyPackages.${system}; + in { + devShell = pkgs-stable.callPackage ./nix/devShell.nix { + inherit (pkgs-unstable) tracy; + inherit (zls.packages.${system}) zls; - # Other overlays - (final: prev: { - zigpkgs = inputs.zig.packages.${prev.system}; + zig = zig.packages.${system}.master; + wraptest = pkgs-stable.callPackage ./nix/wraptest.nix {}; + }; - zig_0_12 = inputs.nixpkgs-zig-0-12.legacyPackages.${prev.system}.zig_0_12; + packages.${system} = rec { + ghostty = pkgs-stable.callPackage ./nix/package.nix { + inherit (pkgs-zig-0-12) zig_0_12; + }; + default = ghostty; + }; - # Latest version of Tracy - tracy = inputs.nixpkgs-unstable.legacyPackages.${prev.system}.tracy; - - # Latest version of ZLS - zls = inputs.zls-master.packages.${prev.system}.zls; - }) - ]; - - # Our supported systems are the same supported systems as the Zig binaries - systems = builtins.attrNames inputs.zig.packages; - in - flake-utils.lib.eachSystem systems (system: - let pkgs = import nixpkgs { inherit overlays system; }; - in rec { - devShell = pkgs.devShell; - - # NOTE: using packages.ghostty right out of the flake currently - # requires a build of LLVM 17 and Zig master from source. This will - # take quite a bit of time. Until LLVM 17 and an upcoming Zig 0.12 are - # up in nixpkgs, most folks will want to continue to use the devShell - # and the instructions found at: - # - # https://github.com/mitchellh/ghostty/tree/main#developing-ghostty - # - packages.ghostty = pkgs.ghostty; - packages.default = packages.ghostty; - defaultPackage = packages.ghostty; - } - ); + # Our supported systems are the same supported systems as the Zig binaries. + }) (builtins.attrNames zig.packages)); } diff --git a/garnix.yaml b/garnix.yaml new file mode 100644 index 000000000..0fff899d6 --- /dev/null +++ b/garnix.yaml @@ -0,0 +1,6 @@ +builds: + exclude: [] + include: + - "*.aarch64-darwin.*" + - "*.aarch64-linux.*" + - "*.x86_64-linux.*" diff --git a/nix/build-support/check-zig-cache-hash.sh b/nix/build-support/check-zig-cache-hash.sh index 8c02e237b..bee6f5f60 100755 --- a/nix/build-support/check-zig-cache-hash.sh +++ b/nix/build-support/check-zig-cache-hash.sh @@ -3,7 +3,7 @@ # Nothing in this script should fail. set -e -CACHE_HASH_FILE="$(realpath "$(dirname "$0")/../zig_cache_hash.nix")" +CACHE_HASH_FILE="$(realpath "$(dirname "$0")/../zig-cache-hash.nix")" help() { echo "" @@ -11,7 +11,7 @@ help() { echo "commit, and push the update:" echo "" echo " ./nix/build-support/check-zig-cache-hash.sh --update" - echo " git add nix/zig_cache_hash.nix" + echo " git add nix/zig-cache-hash.nix" echo " git commit -m \"nix: update Zig cache hash\"" echo " git push" echo "" diff --git a/nix/devshell.nix b/nix/devShell.nix similarity index 95% rename from nix/devshell.nix rename to nix/devShell.nix index 247302828..662a2c7e6 100644 --- a/nix/devshell.nix +++ b/nix/devShell.nix @@ -1,8 +1,11 @@ -{ mkShell, lib, stdenv +{ + mkShell +, lib +, stdenv , bashInteractive , gdb -, glxinfo +#, glxinfo # unused , ncurses , nodejs , nodePackages @@ -13,7 +16,7 @@ , scdoc , tracy , valgrind -, vulkan-loader +#, vulkan-loader # unused , vttest , wabt , wasmtime @@ -66,7 +69,7 @@ let gtk4 glib ]; -in mkShell rec { +in mkShell { name = "ghostty"; nativeBuildInputs = [ diff --git a/nix/overlay.nix b/nix/overlay.nix deleted file mode 100644 index ff6e551cc..000000000 --- a/nix/overlay.nix +++ /dev/null @@ -1,27 +0,0 @@ -final: prev: rec { - # Notes: - # - # When determining a SHA256, use this to set a fake one until we know - # the real value: - # - # vendorSha256 = nixpkgs.lib.fakeSha256; - # - - devShell = prev.callPackage ./devshell.nix { }; - ghostty = prev.callPackage ./package.nix { }; - - wraptest = prev.callPackage ./wraptest.nix { }; - - # Last known working self-hosted with -fstage1, due to - # https://github.com/ziglang/zig/issues/12944 - # I ended up finding a workaround for this but I still feel - # weird about it so I'm going to keep this around in case - # we want to rollback. - #zig = final.zigpkgs.master-2022-09-13; - - # zig we want to be the latest nightly since 0.9.0 is not released yet. - zig = final.zigpkgs.master; - - # last known working stage1 build, the rest in the future are stage3 - #zig = final.zigpkgs.master-2022-08-19; -} diff --git a/nix/package.nix b/nix/package.nix index 58d579f7a..a260b69ad 100644 --- a/nix/package.nix +++ b/nix/package.nix @@ -1,11 +1,5 @@ -# NOTE: using this derivation right out of the flake currently requires a build -# of LLVM 17 and Zig master from source. This will take quite a bit of time. -# Until LLVM 17 and an upcoming Zig 0.12 are up in nixpkgs, most folks will -# want to continue to use the devShell and the instructions found at: -# -# https://github.com/mitchellh/ghostty/tree/main#developing-ghostty -# -{ lib +{ + lib , stdenv , bzip2 @@ -31,9 +25,7 @@ , ncurses , pkg-config , zig_0_12 -}: - -let +}: let # The Zig hook has no way to select the release type without actual # overriding of the default flags. # @@ -57,7 +49,7 @@ let # (It's also possible that you might see a hash mismatch - without the # network errors - if you don't have a previous instance of the cache # derivation in your store already. If so, just update the value as above.) - zigCacheHash = import ./zig_cache_hash.nix; + zigCacheHash = import ./zig-cache-hash.nix; zigCache = src: stdenv.mkDerivation { inherit src; @@ -88,9 +80,7 @@ let outputHashMode = "recursive"; outputHash = zigCacheHash; }; -in - -stdenv.mkDerivation (finalAttrs: { +in stdenv.mkDerivation (finalAttrs: { pname = "ghostty"; version = "0.1.0"; diff --git a/nix/wraptest.nix b/nix/wraptest.nix index cb50d456a..9707a5d3a 100644 --- a/nix/wraptest.nix +++ b/nix/wraptest.nix @@ -1,5 +1,10 @@ -{ lib, stdenv, fetchFromGitHub, autoPatchelfHook }: -stdenv.mkDerivation rec { +{ + stdenv +, fetchFromGitHub +, autoPatchelfHook +}: + +stdenv.mkDerivation { version = "0.1.0-e7a96089"; pname = "wraptest"; @@ -23,7 +28,7 @@ stdenv.mkDerivation rec { cp wraptest $out/bin ''; - meta = with lib; { + meta = { description = "Test of DEC VT terminal line-wrapping semantics"; homepage = "https://github.com/mattiase/wraptest"; platforms = [ "aarch64-linux" "i686-linux" "x86_64-linux" ]; diff --git a/nix/zig_cache_hash.nix b/nix/zig-cache-hash.nix similarity index 100% rename from nix/zig_cache_hash.nix rename to nix/zig-cache-hash.nix diff --git a/shell.nix b/shell.nix deleted file mode 100644 index 7e231b715..000000000 --- a/shell.nix +++ /dev/null @@ -1,9 +0,0 @@ -(import - ( - let flake-compat = (builtins.fromJSON (builtins.readFile ./flake.lock)).nodes.flake-compat; in - fetchTarball { - url = "https://github.com/edolstra/flake-compat/archive/${flake-compat.locked.rev}.tar.gz"; - sha256 = flake-compat.locked.narHash; - } - ) - { src = ./.; }).shellNix From 0e941896fabe92b1ea71699b3bf9512de69ac052 Mon Sep 17 00:00:00 2001 From: RGBCube Date: Fri, 8 Dec 2023 16:23:06 +0300 Subject: [PATCH 3/6] Compile wraptest with O3, run hooks --- nix/wraptest.nix | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/nix/wraptest.nix b/nix/wraptest.nix index 9707a5d3a..7fdad2e38 100644 --- a/nix/wraptest.nix +++ b/nix/wraptest.nix @@ -4,13 +4,13 @@ , autoPatchelfHook }: -stdenv.mkDerivation { +stdenv.mkDerivation rec { version = "0.1.0-e7a96089"; pname = "wraptest"; src = fetchFromGitHub { owner = "mattiase"; - repo = "wraptest"; + repo = pname; rev = "e7a960892873035d2ef56b9770c32b43635821fb"; sha256 = "sha256-+v6xpPCmvKfsDkPmBSv6+6yAg2Kzame5Zwx2WKjQreI="; }; @@ -20,12 +20,20 @@ stdenv.mkDerivation { ]; buildPhase = '' - gcc -o wraptest wraptest.c + runHook preBuild + + cc -O3 -o wraptest wraptest.c + + runHook postBuild ''; installPhase = '' + runHook preInstall + mkdir -p $out/bin - cp wraptest $out/bin + cp wraptest $out/bin/ + + runHook postInstall ''; meta = { From b3082e39256e6f6c331a73c2f73f55f3838a10e9 Mon Sep 17 00:00:00 2001 From: RGBCube Date: Fri, 8 Dec 2023 16:27:26 +0300 Subject: [PATCH 4/6] Use camelCase for all nix files --- README.md | 2 +- nix/build-support/check-zig-cache-hash.sh | 8 ++++---- nix/package.nix | 2 +- nix/{zig-cache-hash.nix => zigCacheHash.nix} | 0 4 files changed, 6 insertions(+), 6 deletions(-) rename nix/{zig-cache-hash.nix => zigCacheHash.nix} (100%) diff --git a/README.md b/README.md index 37efc86ee..4f25bef7c 100644 --- a/README.md +++ b/README.md @@ -560,5 +560,5 @@ To update it, you can run the following in the repository root: ./nix/build-support/check-zig-cache-hash.sh --update ``` -This will write out the `nix/zig-cache-hash.nix` file with the updated hash +This will write out the `nix/zigCacheHash.nix` file with the updated hash that can then be committed and pushed to fix the builds. diff --git a/nix/build-support/check-zig-cache-hash.sh b/nix/build-support/check-zig-cache-hash.sh index bee6f5f60..26669b008 100755 --- a/nix/build-support/check-zig-cache-hash.sh +++ b/nix/build-support/check-zig-cache-hash.sh @@ -3,15 +3,15 @@ # Nothing in this script should fail. set -e -CACHE_HASH_FILE="$(realpath "$(dirname "$0")/../zig-cache-hash.nix")" +CACHE_HASH_FILE="$(realpath "$(dirname "$0")/../zigCacheHash.nix")" help() { echo "" echo "To fix, please (manually) re-run the script from the repository root," echo "commit, and push the update:" echo "" - echo " ./nix/build-support/check-zig-cache-hash.sh --update" - echo " git add nix/zig-cache-hash.nix" + echo " ./nix/build-support/check-zigCacheHash.sh --update" + echo " git add nix/zigCacheHash.nix" echo " git commit -m \"nix: update Zig cache hash\"" echo " git push" echo "" @@ -52,7 +52,7 @@ fi # Write out the cache file cat > "${CACHE_HASH_FILE}" < Date: Fri, 8 Dec 2023 07:58:52 -0800 Subject: [PATCH 5/6] nix: make devshell platform-specific --- flake.lock | 8 ++++---- flake.nix | 9 ++------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/flake.lock b/flake.lock index cdcb72981..d99077202 100644 --- a/flake.lock +++ b/flake.lock @@ -115,16 +115,16 @@ }, "nixpkgs-stable": { "locked": { - "lastModified": 1702042171, - "narHash": "sha256-abT0/nqbQfvx052z0JLkCDXulyM+YGznbN8tv6DYNpo=", + "lastModified": 1702049175, + "narHash": "sha256-c/q2+tGHbmLgzT3sXyUKVJR98h1CTks2+nkVaoZPRM0=", "owner": "nixos", "repo": "nixpkgs", - "rev": "357f2203132b749d87d379dfe05245204b2dfe93", + "rev": "b15508bd65870620f1df5864e8e861dffbc4e428", "type": "github" }, "original": { "owner": "nixos", - "ref": "release-23.11", + "ref": "release-23.05", "repo": "nixpkgs", "type": "github" } diff --git a/flake.nix b/flake.nix index 9fc4d0d7d..af1891f43 100644 --- a/flake.nix +++ b/flake.nix @@ -1,18 +1,13 @@ { description = "👻"; - nixConfig = { - extra-trusted-substituters = "https://cache.garnix.io/"; - extra-trusted-public-keys = "cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g="; - }; - inputs = { nixpkgs-unstable.url = "github:nixos/nixpkgs/nixpkgs-unstable"; # 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.11"; + nixpkgs-stable.url = "github:nixos/nixpkgs/release-23.05"; # This is a nixpkgs mirror (based off of nixos-unstable) that contains # patches for LLVM 17 and Zig 0.12 (master/nightly). @@ -47,7 +42,7 @@ pkgs-unstable = nixpkgs-unstable.legacyPackages.${system}; pkgs-zig-0-12 = nixpkgs-zig-0-12.legacyPackages.${system}; in { - devShell = pkgs-stable.callPackage ./nix/devShell.nix { + devShell.${system} = pkgs-stable.callPackage ./nix/devShell.nix { inherit (pkgs-unstable) tracy; inherit (zls.packages.${system}) zls; From ee26d481403e46e675750180b691ed8162bfc3b6 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Fri, 8 Dec 2023 07:59:19 -0800 Subject: [PATCH 6/6] nix: add back shell.nix --- shell.nix | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 shell.nix diff --git a/shell.nix b/shell.nix new file mode 100644 index 000000000..6b7e7a250 --- /dev/null +++ b/shell.nix @@ -0,0 +1,9 @@ +(import + ( + let flake-compat = (builtins.fromJSON (builtins.readFile ./flake.lock)).nodes.flake-compat; in + fetchTarball { + url = "https://github.com/edolstra/flake-compat/archive/${flake-compat.locked.rev}.tar.gz"; + sha256 = flake-compat.locked.narHash; + } + ) + { src = ./.; }).shellNix