mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-04-12 10:48:39 +03:00
Use Alejandra to format Nix modules.
This commit is contained in:
10
.github/workflows/test.yml
vendored
10
.github/workflows/test.yml
vendored
@ -147,3 +147,13 @@ jobs:
|
||||
nix_path: nixpkgs=channel:nixos-unstable
|
||||
- name: prettier check
|
||||
run: nix develop -c prettier --check .
|
||||
|
||||
alejandra:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4 # Check out repo so we can lint it
|
||||
- uses: cachix/install-nix-action@v24
|
||||
with:
|
||||
nix_path: nixpkgs=channel:nixos-unstable
|
||||
- name: alejandra check
|
||||
run: nix develop -c alejandra --check .
|
||||
|
29
README.md
29
README.md
@ -492,6 +492,8 @@ on vastly improving this experience over time.
|
||||
|
||||
### Linting
|
||||
|
||||
#### Prettier
|
||||
|
||||
Ghostty's docs and resources (not including Zig code) are linted using
|
||||
[Prettier](https://prettier.io) with out-of-the-box settings. A Prettier CI
|
||||
check will fail builds with improper formatting. Therefore, if you are
|
||||
@ -502,7 +504,32 @@ run this from the repo root before you commit:
|
||||
prettier --write .
|
||||
```
|
||||
|
||||
Make sure your Prettier version matches the version of in [devShell.nix](https://github.com/mitchellh/ghostty/blob/main/nix/devShell.nix).
|
||||
Make sure your Prettier version matches the version of Prettier in [devShell.nix](https://github.com/mitchellh/ghostty/blob/main/nix/devShell.nix).
|
||||
|
||||
Nix users can use the following command to format with Prettier:
|
||||
|
||||
```
|
||||
nix develop -c prettier --write .
|
||||
```
|
||||
|
||||
#### Alejandra
|
||||
|
||||
Nix modules are formatted with [Alejandra](https://github.com/kamadorueda/alejandra/). An Alejandra CI check
|
||||
will fail builds with improper formatting.
|
||||
|
||||
Nix users can use the following command to format with Alejanda:
|
||||
|
||||
```
|
||||
nix develop -c alejandra .
|
||||
```
|
||||
|
||||
Non-Nix users should install Alejandra and use the follwing command to format with Alejanda:
|
||||
|
||||
```
|
||||
alejandra .
|
||||
```
|
||||
|
||||
Make sure your Alejandra version matches the version of Alejandra in [devShell.nix](https://github.com/mitchellh/ghostty/blob/main/nix/devShell.nix).
|
||||
|
||||
### Nix Package
|
||||
|
||||
|
15
flake.nix
15
flake.nix
@ -31,13 +31,14 @@
|
||||
};
|
||||
|
||||
outputs = {
|
||||
nixpkgs-unstable
|
||||
, nixpkgs-stable
|
||||
, nixpkgs-zig-0-12
|
||||
, zig
|
||||
, zls
|
||||
, ...
|
||||
}: builtins.foldl' nixpkgs-stable.lib.recursiveUpdate {} (builtins.map (system: let
|
||||
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};
|
||||
|
116
nix/devShell.nix
116
nix/devShell.nix
@ -1,55 +1,55 @@
|
||||
{
|
||||
mkShell
|
||||
, lib
|
||||
, stdenv
|
||||
|
||||
, bashInteractive
|
||||
, gdb
|
||||
#, glxinfo # unused
|
||||
, ncurses
|
||||
, nodejs
|
||||
, nodePackages
|
||||
, oniguruma
|
||||
, parallel
|
||||
, pkg-config
|
||||
, python3
|
||||
, scdoc
|
||||
, tracy
|
||||
, valgrind
|
||||
#, vulkan-loader # unused
|
||||
, vttest
|
||||
, wabt
|
||||
, wasmtime
|
||||
, wraptest
|
||||
, zig
|
||||
, zip
|
||||
, zls
|
||||
, llvmPackages_latest
|
||||
|
||||
, bzip2
|
||||
, expat
|
||||
, fontconfig
|
||||
, freetype
|
||||
, glib
|
||||
, gtk4
|
||||
, libadwaita
|
||||
, harfbuzz
|
||||
, libpng
|
||||
, libGL
|
||||
, libX11
|
||||
, libXcursor
|
||||
, libXext
|
||||
, libXi
|
||||
, libXinerama
|
||||
, libXrandr
|
||||
, pixman
|
||||
, zlib
|
||||
}:
|
||||
let
|
||||
mkShell,
|
||||
lib,
|
||||
stdenv,
|
||||
bashInteractive,
|
||||
gdb,
|
||||
#, glxinfo # unused
|
||||
ncurses,
|
||||
nodejs,
|
||||
nodePackages,
|
||||
oniguruma,
|
||||
parallel,
|
||||
pkg-config,
|
||||
python3,
|
||||
scdoc,
|
||||
tracy,
|
||||
valgrind,
|
||||
#, vulkan-loader # unused
|
||||
vttest,
|
||||
wabt,
|
||||
wasmtime,
|
||||
wraptest,
|
||||
zig,
|
||||
zip,
|
||||
zls,
|
||||
llvmPackages_latest,
|
||||
bzip2,
|
||||
expat,
|
||||
fontconfig,
|
||||
freetype,
|
||||
glib,
|
||||
gtk4,
|
||||
libadwaita,
|
||||
harfbuzz,
|
||||
libpng,
|
||||
libGL,
|
||||
libX11,
|
||||
libXcursor,
|
||||
libXext,
|
||||
libXi,
|
||||
libXinerama,
|
||||
libXrandr,
|
||||
pixman,
|
||||
zlib,
|
||||
alejandra,
|
||||
}: let
|
||||
# See package.nix. Keep in sync.
|
||||
rpathLibs = [
|
||||
rpathLibs =
|
||||
[
|
||||
libGL
|
||||
] ++ lib.optionals stdenv.isLinux [
|
||||
]
|
||||
++ lib.optionals stdenv.isLinux [
|
||||
bzip2
|
||||
expat
|
||||
fontconfig
|
||||
@ -69,10 +69,12 @@ let
|
||||
gtk4
|
||||
glib
|
||||
];
|
||||
in mkShell {
|
||||
in
|
||||
mkShell {
|
||||
name = "ghostty";
|
||||
|
||||
nativeBuildInputs = [
|
||||
nativeBuildInputs =
|
||||
[
|
||||
# For builds
|
||||
llvmPackages_latest.llvm
|
||||
ncurses
|
||||
@ -87,6 +89,7 @@ in mkShell {
|
||||
|
||||
# Linting
|
||||
nodePackages.prettier
|
||||
alejandra
|
||||
|
||||
# Testing
|
||||
parallel
|
||||
@ -97,7 +100,8 @@ in mkShell {
|
||||
# wasm
|
||||
wabt
|
||||
wasmtime
|
||||
] ++ lib.optionals stdenv.isLinux [
|
||||
]
|
||||
++ lib.optionals stdenv.isLinux [
|
||||
# My nix shell environment installs the non-interactive version
|
||||
# by default so we have to include this.
|
||||
bashInteractive
|
||||
@ -107,9 +111,11 @@ in mkShell {
|
||||
wraptest
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
buildInputs =
|
||||
[
|
||||
# TODO: non-linux
|
||||
] ++ lib.optionals stdenv.isLinux [
|
||||
]
|
||||
++ lib.optionals stdenv.isLinux [
|
||||
bzip2
|
||||
expat
|
||||
fontconfig
|
||||
@ -136,4 +142,4 @@ in mkShell {
|
||||
# This should be set onto the rpath of the ghostty binary if you want
|
||||
# it to be "portable" across the system.
|
||||
LD_LIBRARY_PATH = lib.makeLibraryPath rpathLibs;
|
||||
}
|
||||
}
|
||||
|
@ -1,30 +1,26 @@
|
||||
{
|
||||
lib
|
||||
, stdenv
|
||||
|
||||
, bzip2
|
||||
, expat
|
||||
, fontconfig
|
||||
, freetype
|
||||
, harfbuzz
|
||||
, libpng
|
||||
, pixman
|
||||
, zlib
|
||||
|
||||
, libGL
|
||||
, libX11
|
||||
, libXcursor
|
||||
, libXi
|
||||
, libXrandr
|
||||
|
||||
, glib
|
||||
, gtk4
|
||||
, libadwaita
|
||||
|
||||
, git
|
||||
, ncurses
|
||||
, pkg-config
|
||||
, zig_0_12
|
||||
lib,
|
||||
stdenv,
|
||||
bzip2,
|
||||
expat,
|
||||
fontconfig,
|
||||
freetype,
|
||||
harfbuzz,
|
||||
libpng,
|
||||
pixman,
|
||||
zlib,
|
||||
libGL,
|
||||
libX11,
|
||||
libXcursor,
|
||||
libXi,
|
||||
libXrandr,
|
||||
glib,
|
||||
gtk4,
|
||||
libadwaita,
|
||||
git,
|
||||
ncurses,
|
||||
pkg-config,
|
||||
zig_0_12,
|
||||
}: let
|
||||
# The Zig hook has no way to select the release type without actual
|
||||
# overriding of the default flags.
|
||||
@ -51,10 +47,11 @@
|
||||
# derivation in your store already. If so, just update the value as above.)
|
||||
zigCacheHash = import ./zigCacheHash.nix;
|
||||
|
||||
zigCache = src: stdenv.mkDerivation {
|
||||
zigCache = src:
|
||||
stdenv.mkDerivation {
|
||||
inherit src;
|
||||
name = "ghostty-cache";
|
||||
nativeBuildInputs = [ git zig_0_12.hook ];
|
||||
nativeBuildInputs = [git zig_0_12.hook];
|
||||
|
||||
dontConfigure = true;
|
||||
dontUseZigBuild = true;
|
||||
@ -80,7 +77,8 @@
|
||||
outputHashMode = "recursive";
|
||||
outputHash = zigCacheHash;
|
||||
};
|
||||
in stdenv.mkDerivation (finalAttrs: {
|
||||
in
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "ghostty";
|
||||
version = "0.1.0";
|
||||
|
||||
@ -93,9 +91,11 @@ in stdenv.mkDerivation (finalAttrs: {
|
||||
zig012Hook
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
buildInputs =
|
||||
[
|
||||
libGL
|
||||
] ++ lib.optionals stdenv.isLinux [
|
||||
]
|
||||
++ lib.optionals stdenv.isLinux [
|
||||
bzip2
|
||||
expat
|
||||
fontconfig
|
||||
@ -125,7 +125,7 @@ in stdenv.mkDerivation (finalAttrs: {
|
||||
chmod u+rwX -R $ZIG_GLOBAL_CACHE_DIR
|
||||
'';
|
||||
|
||||
outputs = [ "out" "terminfo" "shell_integration" ];
|
||||
outputs = ["out" "terminfo" "shell_integration"];
|
||||
|
||||
postInstall = ''
|
||||
terminfo_src=${
|
||||
@ -144,6 +144,6 @@ in stdenv.mkDerivation (finalAttrs: {
|
||||
meta = with lib; {
|
||||
homepage = "https://github.com/mitchellh/ghostty";
|
||||
license = licenses.mit;
|
||||
platforms = [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" ];
|
||||
platforms = ["x86_64-linux" "aarch64-linux" "aarch64-darwin"];
|
||||
};
|
||||
})
|
||||
})
|
||||
|
@ -1,9 +1,8 @@
|
||||
{
|
||||
stdenv
|
||||
, fetchFromGitHub
|
||||
, autoPatchelfHook
|
||||
stdenv,
|
||||
fetchFromGitHub,
|
||||
autoPatchelfHook,
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
version = "0.1.0-e7a96089";
|
||||
pname = "wraptest";
|
||||
@ -39,6 +38,6 @@ stdenv.mkDerivation rec {
|
||||
meta = {
|
||||
description = "Test of DEC VT terminal line-wrapping semantics";
|
||||
homepage = "https://github.com/mattiase/wraptest";
|
||||
platforms = [ "aarch64-linux" "i686-linux" "x86_64-linux" ];
|
||||
platforms = ["aarch64-linux" "i686-linux" "x86_64-linux"];
|
||||
};
|
||||
}
|
||||
|
@ -1,9 +1,12 @@
|
||||
(import
|
||||
(
|
||||
let flake-compat = (builtins.fromJSON (builtins.readFile ./flake.lock)).nodes.flake-compat; in
|
||||
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
|
||||
{src = ./.;})
|
||||
.shellNix
|
||||
|
Reference in New Issue
Block a user