From ffab7cedc405351da1c9357665a0a80de869f36a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20B=C3=B6hme?= Date: Fri, 25 Oct 2024 07:35:36 +0200 Subject: [PATCH] feat: add ghostty --- flake.lock | 145 +++++++++++++++++++++++++---- flake.nix | 5 + hosts/nixos-laptop/default.nix | 1 + modules/config/terminal.nix | 13 +++ modules/programs/ghostty.nix | 35 +++++++ modules/programs/river/default.nix | 2 +- 6 files changed, 183 insertions(+), 18 deletions(-) create mode 100644 modules/config/terminal.nix create mode 100644 modules/programs/ghostty.nix diff --git a/flake.lock b/flake.lock index 91eb528..c712465 100644 --- a/flake.lock +++ b/flake.lock @@ -342,7 +342,25 @@ }, "flake-utils_2": { "inputs": { - "systems": "systems_4" + "systems": "systems_3" + }, + "locked": { + "lastModified": 1705309234, + "narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_3": { + "inputs": { + "systems": "systems_5" }, "locked": { "lastModified": 1726560853, @@ -358,6 +376,26 @@ "type": "github" } }, + "ghostty": { + "inputs": { + "nixpkgs-stable": "nixpkgs-stable", + "nixpkgs-unstable": "nixpkgs-unstable", + "zig": "zig" + }, + "locked": { + "lastModified": 1729372614, + "narHash": "sha256-WqbbdfXbayKTGplZ6GntKq1blX3YTI7WzXEPWhqo0fA=", + "ref": "refs/heads/main", + "rev": "1134a9cbea571a3303df352636b1329753b4d443", + "revCount": 7757, + "type": "git", + "url": "ssh://git@github.com/ghostty-org/ghostty" + }, + "original": { + "type": "git", + "url": "ssh://git@github.com/ghostty-org/ghostty" + } + }, "git-hooks": { "inputs": { "flake-compat": "flake-compat_3", @@ -653,7 +691,7 @@ "hyprwayland-scanner": "hyprwayland-scanner", "nixpkgs": "nixpkgs_4", "pre-commit-hooks": "pre-commit-hooks", - "systems": "systems_3", + "systems": "systems_4", "xdph": "xdph" }, "locked": { @@ -810,11 +848,11 @@ }, "master": { "locked": { - "lastModified": 1729497599, - "narHash": "sha256-VIL7URnjTkpYc7FQ0QJhV7Q2n2/hi3AgiFr5Ul1/glo=", + "lastModified": 1729502391, + "narHash": "sha256-maI+uLuGbgwkvNp+FzzhLiGvd80+MS0gASpHjU6B0hY=", "owner": "nixos", "repo": "nixpkgs", - "rev": "f6bdbd1605b17cfbd8af51ba68db779e130d54b3", + "rev": "d3503200cd28f0ecba42a9a4f82988f469932320", "type": "github" }, "original": { @@ -1031,16 +1069,16 @@ }, "nixpkgs-stable": { "locked": { - "lastModified": 1720386169, - "narHash": "sha256-NGKVY4PjzwAa4upkGtAMz1npHGoRzWotlSnVlqI40mo=", - "owner": "NixOS", + "lastModified": 1726062281, + "narHash": "sha256-PyFVySdGj3enKqm8RQuo4v1KLJLmNLOq2yYOHsI6e2Q=", + "owner": "nixos", "repo": "nixpkgs", - "rev": "194846768975b7ad2c4988bdb82572c00222c0d7", + "rev": "e65aa8301ba4f0ab8cb98f944c14aa9da07394f8", "type": "github" }, "original": { - "owner": "NixOS", - "ref": "nixos-24.05", + "owner": "nixos", + "ref": "release-24.05", "repo": "nixpkgs", "type": "github" } @@ -1061,6 +1099,38 @@ "type": "github" } }, + "nixpkgs-stable_3": { + "locked": { + "lastModified": 1720386169, + "narHash": "sha256-NGKVY4PjzwAa4upkGtAMz1npHGoRzWotlSnVlqI40mo=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "194846768975b7ad2c4988bdb82572c00222c0d7", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-24.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-unstable": { + "locked": { + "lastModified": 1719082008, + "narHash": "sha256-jHJSUH619zBQ6WdC21fFAlDxHErKVDJ5fpN0Hgx4sjs=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "9693852a2070b398ee123a329e68f0dab5526681", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "nixpkgs_10": { "locked": { "lastModified": 1692934111, @@ -1254,7 +1324,7 @@ }, "nuschtosSearch": { "inputs": { - "flake-utils": "flake-utils_2", + "flake-utils": "flake-utils_3", "nixpkgs": [ "nixvim", "nixpkgs" @@ -1282,7 +1352,7 @@ "hyprland", "nixpkgs" ], - "nixpkgs-stable": "nixpkgs-stable" + "nixpkgs-stable": "nixpkgs-stable_2" }, "locked": { "lastModified": 1728778939, @@ -1303,7 +1373,7 @@ "flake-compat": "flake-compat_6", "gitignore": "gitignore_4", "nixpkgs": "nixpkgs_9", - "nixpkgs-stable": "nixpkgs-stable_2" + "nixpkgs-stable": "nixpkgs-stable_3" }, "locked": { "lastModified": 1729104314, @@ -1346,6 +1416,7 @@ "disko": "disko", "flake-parts": "flake-parts", "flake-utils": "flake-utils", + "ghostty": "ghostty", "home-manager": "home-manager_2", "hypr-contrib": "hypr-contrib", "hyprland": "hyprland", @@ -1411,6 +1482,21 @@ } }, "systems_3": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_4": { "locked": { "lastModified": 1689347949, "narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=", @@ -1425,7 +1511,7 @@ "type": "github" } }, - "systems_4": { + "systems_5": { "locked": { "lastModified": 1681028828, "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", @@ -1440,7 +1526,7 @@ "type": "github" } }, - "systems_5": { + "systems_6": { "locked": { "lastModified": 1681028828, "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", @@ -1498,7 +1584,7 @@ }, "utils": { "inputs": { - "systems": "systems_5" + "systems": "systems_6" }, "locked": { "lastModified": 1692799911, @@ -1554,6 +1640,31 @@ "repo": "xdg-desktop-portal-hyprland", "type": "github" } + }, + "zig": { + "inputs": { + "flake-compat": [ + "ghostty" + ], + "flake-utils": "flake-utils_2", + "nixpkgs": [ + "ghostty", + "nixpkgs-stable" + ] + }, + "locked": { + "lastModified": 1717848532, + "narHash": "sha256-d+xIUvSTreHl8pAmU1fnmkfDTGQYCn2Rb/zOwByxS2M=", + "owner": "mitchellh", + "repo": "zig-overlay", + "rev": "02fc5cc555fc14fda40c42d7c3250efa43812b43", + "type": "github" + }, + "original": { + "owner": "mitchellh", + "repo": "zig-overlay", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 1beea8b..6884746 100644 --- a/flake.nix +++ b/flake.nix @@ -53,6 +53,9 @@ # Firefox user.js arkenfox-userjs.url = "github:arkenfox/user.js"; arkenfox-userjs.flake = false; + + ghostty.url = "git+ssh://git@github.com/ghostty-org/ghostty"; + # ghostty.url = "/home/moritz/Documents/ghostty"; }; outputs = inputs@{ self, flake-parts, ... }: @@ -178,11 +181,13 @@ "https://hyprland.cachix.org" "https://nix-community.cachix.org" "https://pre-commit-hooks.cachix.org" + "https://ghostty.cachix.org" ]; extra-trusted-public-keys = [ "hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc=" "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" "pre-commit-hooks.cachix.org-1:Pkk3Panw5AW24TOv6kz3PvLhlH8puAsJTBbOPmBo7Rc=" + "ghostty.cachix.org-1:QB389yTa6gTyneehvqG58y0WnHjQOqgnA+wBnpWWxns=" ]; }; } diff --git a/hosts/nixos-laptop/default.nix b/hosts/nixos-laptop/default.nix index 14ac222..37704af 100644 --- a/hosts/nixos-laptop/default.nix +++ b/hosts/nixos-laptop/default.nix @@ -20,6 +20,7 @@ webis.enable = true; impermanence.enable = true; }; + terminal.package = pkgs.kitty; programs.river.enable = true; programs.hyprland.enable = false; programs.exercism.enable = true; diff --git a/modules/config/terminal.nix b/modules/config/terminal.nix new file mode 100644 index 0000000..dbae99b --- /dev/null +++ b/modules/config/terminal.nix @@ -0,0 +1,13 @@ +{ lib +, ... +}: + +with lib; +{ + options.my.terminal = { + package = mkOption { + type = types.package; + apply = lib.getExe; + }; + }; +} diff --git a/modules/programs/ghostty.nix b/modules/programs/ghostty.nix new file mode 100644 index 0000000..a51f266 --- /dev/null +++ b/modules/programs/ghostty.nix @@ -0,0 +1,35 @@ +{ config +, lib +, pkgs +, inputs +, ... +}: + +with lib; +let + cfg = config.my.programs.ghostty; + format = pkgs.formats.keyValue { + listsAsDuplicateKeys = true; + }; +in +{ + options.my.programs.ghostty.enable = mkEnableOption "Ghostty"; + options.my.programs.ghostty.package = (mkPackageOption pkgs "Ghostty" { }) // { + inherit (inputs.ghostty.packages.${pkgs.system}) default; + }; + options.my.programs.ghostty.settings = mkOption { + inherit (format) type; + description = '' + Configuration written to {file}`$XDG_CONFIG_HOME/ghostty/config`. + ''; + default = { }; + }; + + config = mkIf cfg.enable { + my.terminal.package = cfg.package; + home-manager.users.moritz = { + home.packages = [ cfg.package ]; + xdg.configFile."ghostty/config".source = format.generate "ghostty-config" cfg.settings; + }; + }; +} diff --git a/modules/programs/river/default.nix b/modules/programs/river/default.nix index 9c395a6..a3e4c7c 100644 --- a/modules/programs/river/default.nix +++ b/modules/programs/river/default.nix @@ -68,7 +68,7 @@ in map = { normal = { "Super Q" = "close"; - "Super Return" = "spawn kitty"; + "Super Return" = "spawn '${config.my.terminal.package}'"; "Super R" = ''spawn 'exec $(tofi-run --fuzzy-match=true)' ''; "Super W" = ''spawn "pkill -USR1 waybar"''; "Super+Shift R" = "spawn ~/.config/river/init";