Skip to content

Commit

Permalink
Initial
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchellh committed Mar 29, 2022
0 parents commit f8b0000
Show file tree
Hide file tree
Showing 9 changed files with 196 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -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 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
zig-cache/
zig-out/
/result*
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "vendor/mach-glfw"]
path = vendor/mach-glfw
url = https://github.com/hexops/mach-glfw.git
111 changes: 111 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 33 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -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 changes: 17 additions & 0 deletions nix/devshell.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{ mkShell

, pkg-config
, scdoc
, zig
}: mkShell rec {
name = "ghostty";

nativeBuildInputs = [
pkg-config
scdoc
zig
];

buildInputs = [
];
}
14 changes: 14 additions & 0 deletions nix/overlay.nix
Original file line number Diff line number Diff line change
@@ -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 changes: 9 additions & 0 deletions shell.nix
Original file line number Diff line number Diff line change
@@ -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 change: 1 addition & 0 deletions vendor/mach-glfw
Submodule mach-glfw added at fe72a5

0 comments on commit f8b0000

Please sign in to comment.