This commit is contained in:
Mitchell Hashimoto
2022-03-29 09:04:32 -07:00
commit f8b0000444
9 changed files with 196 additions and 0 deletions

5
.envrc Normal file
View File

@ -0,0 +1,5 @@
# If we are a computer with nix-shell available, then use that to setup
# the build environment with exactly what we need.
if has nix-shell; then
use nix
fi

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
zig-cache/
zig-out/
/result*

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "vendor/mach-glfw"]
path = vendor/mach-glfw
url = https://github.com/hexops/mach-glfw.git

111
flake.lock generated Normal file
View File

@ -0,0 +1,111 @@
{
"nodes": {
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1648199409,
"narHash": "sha256-JwPKdC2PoVBkG6E+eWw3j6BMR6sL3COpYWfif7RVb8Y=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "64a525ee38886ab9028e6f61790de0832aa3ef03",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-utils": {
"locked": {
"lastModified": 1648297722,
"narHash": "sha256-W+qlPsiZd8F3XkzXOzAoR+mpFqzm3ekQkJNa+PIh1BQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "0f8662f1319ad6abf89b3380dd2722369fc51ade",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_2": {
"locked": {
"lastModified": 1629481132,
"narHash": "sha256-JHgasjPR0/J1J3DRm4KxM4zTyAj4IOJY8vIl75v/kPI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "997f7efcb746a9c140ce1f13c72263189225f482",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1648219316,
"narHash": "sha256-Ctij+dOi0ZZIfX5eMhgwugfvB+WZSrvVNAyAuANOsnQ=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "30d3d79b7d3607d56546dd2a6b49e156ba0ec634",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1631288242,
"narHash": "sha256-sXm4KiKs7qSIf5oTAmrlsEvBW193sFj+tKYVirBaXz0=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "0e24c87754430cb6ad2f8c8c8021b29834a8845e",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-compat": "flake-compat",
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs",
"zig": "zig"
}
},
"zig": {
"inputs": {
"flake-utils": "flake-utils_2",
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1648514449,
"narHash": "sha256-JRFuHkCPcZuzZG7/Jn1JRE9Yad4d6oa+r82Y9IlyFgk=",
"owner": "roarkanize",
"repo": "zig-overlay",
"rev": "bea2f952e65ce19ad0133ae4aa6ac225da6f0dfc",
"type": "github"
},
"original": {
"owner": "roarkanize",
"repo": "zig-overlay",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

33
flake.nix Normal file
View File

@ -0,0 +1,33 @@
{
description = "ghostty";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
zig.url = "github:roarkanize/zig-overlay";
# Used for shell.nix
flake-compat = { url = github:edolstra/flake-compat; flake = false; };
};
outputs = { self, nixpkgs, flake-utils, ... }@inputs:
let
overlays = [
# Our repo overlay
(import ./nix/overlay.nix)
# Other overlays
(final: prev: {
zigpkgs = inputs.zig.packages.${prev.system};
})
];
# 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;
}
);
}

17
nix/devshell.nix Normal file
View File

@ -0,0 +1,17 @@
{ mkShell
, pkg-config
, scdoc
, zig
}: mkShell rec {
name = "ghostty";
nativeBuildInputs = [
pkg-config
scdoc
zig
];
buildInputs = [
];
}

14
nix/overlay.nix Normal file
View File

@ -0,0 +1,14 @@
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 { };
# zig we want to be the latest nightly since 0.9.0 is not released yet.
zig = final.zigpkgs.master.latest;
}

9
shell.nix Normal file
View File

@ -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

1
vendor/mach-glfw vendored Submodule

@ -0,0 +1 @@
Subproject commit fe72a5d53188fe5016f96d2c519c604f9550e542