From c52656033c45aa03c7e7e8508acda0cb30ed8eb4 Mon Sep 17 00:00:00 2001 From: Emil Lerch Date: Fri, 31 Jan 2025 16:57:34 -0800 Subject: [PATCH] initial commit --- .gitignore | 1 + LICENSE | 21 ++++++++++++++++++++ README.md | 7 +++++++ flake.lock | 26 ++++++++++++++++++++++++ flake.nix | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 113 insertions(+) create mode 100644 .gitignore create mode 100644 LICENSE create mode 100644 README.md create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b2be92b --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +result diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..506dadd --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2025 Emil Lerch + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..93093e9 --- /dev/null +++ b/README.md @@ -0,0 +1,7 @@ +Nix flake for Ghostty AppImage +============================== + +Uses [Ghostty app image](https://github.com/psadi/ghostty-appimage) + +I do not believe this flake will work on NixOS proper. Appimages use a wrapper +there that do not work outside of NixOS. diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..c798d62 --- /dev/null +++ b/flake.lock @@ -0,0 +1,26 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1738142207, + "narHash": "sha256-NGqpVVxNAHwIicXpgaVqJEJWeyqzoQJ9oc8lnK9+WC4=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "9d3ae807ebd2981d593cddd0080856873139aa40", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "ref": "nixos-unstable", + "type": "indirect" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..a92e37d --- /dev/null +++ b/flake.nix @@ -0,0 +1,58 @@ +{ + description = "Ghostty AppImage"; + + inputs = { + nixpkgs.url = "nixpkgs/nixos-unstable"; + }; + + outputs = { self, nixpkgs }: + let + upstreamVersion = "1.1.0"; + appimageVersion = "v1.1.0+1"; + exename = "ghostty"; + + mkGhostty = system: + let + pkgs = import nixpkgs { inherit system; }; + arch = if system == "x86_64-linux" then "x86_64" else "aarch64"; + appimagename = "Ghostty-${upstreamVersion}-${arch}.AppImage"; + in pkgs.stdenv.mkDerivation { + pname = "ghostty"; + version = appimageVersion; + + src = pkgs.fetchurl { + url = "https://github.com/psadi/ghostty-appimage/releases/download/${appimageVersion}/${appimagename}"; + hash = if system == "x86_64-linux" then "sha256-B7YH8hfsPzpjdXcUTfo3dxj8xNFL8LZnHjEzinnf7M0=" else "sha256-Obn6PfQIsHQn6y4M20tqvWfw22TvoT4jEo181KGzEQs="; + }; + + nativeBuildInputs = [ pkgs.makeWrapper ]; + buildInputs = [ pkgs.appimage-run ]; + dontUnpack = true; + + installPhase = '' + mkdir -p $out/bin $out/share/applications + + # We do this so that nix won't try to do it's wrapper stuff needed for nix os + cp $src $out/share/${exename} + chmod +x $out/share/${exename} + + cat > $out/share/applications/Ghostty.desktop <