Procházet zdrojové kódy

some more changes for ghostty

Zander Hawke před 1 rokem
rodič
revize
c488bea06f

+ 40 - 40
flake.lock

@@ -14,11 +14,11 @@
         "nixpkgs": "nixpkgs"
       },
       "locked": {
-        "lastModified": 1728672398,
-        "narHash": "sha256-KxuGSoVUFnQLB2ZcYODW7AVPAh9JqRlD5BrfsC/Q4qs=",
+        "lastModified": 1737621947,
+        "narHash": "sha256-8HFvG7fvIFbgtaYAY2628Tb89fA55nPm2jSiNs0/Cws=",
         "owner": "cachix",
         "repo": "cachix",
-        "rev": "aac51f698309fd0f381149214b7eee213c66ef0a",
+        "rev": "f65a3cd5e339c223471e64c051434616e18cc4f5",
         "type": "github"
       },
       "original": {
@@ -60,11 +60,11 @@
         ]
       },
       "locked": {
-        "lastModified": 1738414267,
-        "narHash": "sha256-7B+rkQlQ8zIzVgJRiu49ZFST6NBWt+JsnQZ/Q4W3qlI=",
+        "lastModified": 1739003866,
+        "narHash": "sha256-Uxc5JYTB9Dij4t8SBQmfs6Gh5DDsGRS37v3uPQfNvAg=",
         "owner": "cachix",
         "repo": "devenv",
-        "rev": "3f49b4afbb9a80b1e81fb6071f59dac152177efa",
+        "rev": "ebaa7440666d6aadea574b723c9188cf6f56447f",
         "type": "github"
       },
       "original": {
@@ -101,11 +101,11 @@
         ]
       },
       "locked": {
-        "lastModified": 1738148035,
-        "narHash": "sha256-KYOATYEwaKysL3HdHdS5kbQMXvzS4iPJzJrML+3TKAo=",
+        "lastModified": 1738765162,
+        "narHash": "sha256-3Z40qHaFScWUCVQrGc4Y+RdoPsh1R/wIh+AN4cTXP0I=",
         "owner": "nix-community",
         "repo": "disko",
-        "rev": "18d0a984cc2bc82cf61df19523a34ad463aa7f54",
+        "rev": "ff3568858c54bd306e9e1f2886f0f781df307dff",
         "type": "github"
       },
       "original": {
@@ -117,11 +117,11 @@
     "flake-compat": {
       "flake": false,
       "locked": {
-        "lastModified": 1696426674,
-        "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
+        "lastModified": 1733328505,
+        "narHash": "sha256-NeCCThCEP3eCl2l/+27kNNK7QrwZB1IJCrXfrbv5oqU=",
         "owner": "edolstra",
         "repo": "flake-compat",
-        "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
+        "rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec",
         "type": "github"
       },
       "original": {
@@ -217,11 +217,11 @@
         ]
       },
       "locked": {
-        "lastModified": 1737301351,
-        "narHash": "sha256-2UNmLCKORvdBRhPGI8Vx0b6l7M8/QBey/nHLIxOl4jE=",
+        "lastModified": 1737465171,
+        "narHash": "sha256-R10v2hoJRLq8jcL4syVFag7nIGE7m13qO48wRIukWNg=",
         "owner": "cachix",
         "repo": "git-hooks.nix",
-        "rev": "15a87cedeb67e3dbc8d2f7b9831990dffcf4e69f",
+        "rev": "9364dc02281ce2d37a1f55b6e51f7c0f65a75f17",
         "type": "github"
       },
       "original": {
@@ -307,16 +307,16 @@
         ]
       },
       "locked": {
-        "lastModified": 1736373539,
-        "narHash": "sha256-dinzAqCjenWDxuy+MqUQq0I4zUSfaCvN9rzuCmgMZJY=",
+        "lastModified": 1739002622,
+        "narHash": "sha256-PtJV5OYQF7XO6XkDYypsYJS3+OsgYaYSmkO3I/A7lZo=",
         "owner": "nix-community",
         "repo": "home-manager",
-        "rev": "bd65bc3cde04c16755955630b344bc9e35272c56",
+        "rev": "947eef9e99c42346cf0aac2bebe1cd94924c173b",
         "type": "github"
       },
       "original": {
         "owner": "nix-community",
-        "ref": "release-24.11",
+        "ref": "master",
         "repo": "home-manager",
         "type": "github"
       }
@@ -444,11 +444,11 @@
     },
     "nixpkgs": {
       "locked": {
-        "lastModified": 1730531603,
-        "narHash": "sha256-Dqg6si5CqIzm87sp57j5nTaeBbWhHFaVyG7V6L8k3lY=",
+        "lastModified": 1733212471,
+        "narHash": "sha256-M1+uCoV5igihRfcUKrr1riygbe73/dzNnzPsmaLCmpo=",
         "owner": "NixOS",
         "repo": "nixpkgs",
-        "rev": "7ffd9ae656aec493492b44d0ddfb28e79a1ea25d",
+        "rev": "55d15ad12a74eb7d4646254e13638ad0c4128776",
         "type": "github"
       },
       "original": {
@@ -460,11 +460,11 @@
     },
     "nixpkgs-darwin": {
       "locked": {
-        "lastModified": 1738322334,
-        "narHash": "sha256-SYQTFMBJRbvLBaTm0D8qnbrmwfQQkalVtef6XLbGDFs=",
+        "lastModified": 1738979878,
+        "narHash": "sha256-1P8Eq3nspI/EkS/ppDde9BwWEj0WZ8vOaiNrWsd53xE=",
         "owner": "nixos",
         "repo": "nixpkgs",
-        "rev": "d42233d3d0c2ec4765314a966981303006a46aa8",
+        "rev": "0eccf247721298ea23349309b1963db253943c2f",
         "type": "github"
       },
       "original": {
@@ -476,11 +476,11 @@
     },
     "nixpkgs-unstable": {
       "locked": {
-        "lastModified": 1738297584,
-        "narHash": "sha256-AYvaFBzt8dU0fcSK2jKD0Vg23K2eIRxfsVXIPCW9a0E=",
+        "lastModified": 1738958807,
+        "narHash": "sha256-h0WKgHTLkjwjRNTkqByQquS7N/15SqIFMQ356Ww8uCA=",
         "owner": "nixos",
         "repo": "nixpkgs",
-        "rev": "9189ac18287c599860e878e905da550aa6dec1cd",
+        "rev": "e8d0b02af0958823c955aaab3c82b03f54411d91",
         "type": "github"
       },
       "original": {
@@ -508,11 +508,11 @@
     },
     "nixpkgs_3": {
       "locked": {
-        "lastModified": 1738277201,
-        "narHash": "sha256-6L+WXKCw5mqnUIExvqkD99pJQ41xgyCk6z/H9snClwk=",
+        "lastModified": 1738843498,
+        "narHash": "sha256-7x+Q4xgFj9UxZZO9aUDCR8h4vyYut4zPUvfj3i+jBHE=",
         "owner": "nixos",
         "repo": "nixpkgs",
-        "rev": "666e1b3f09c267afd66addebe80fb05a5ef2b554",
+        "rev": "f5a32fa27df91dfc4b762671a0e0a859a8a0058f",
         "type": "github"
       },
       "original": {
@@ -537,11 +537,11 @@
         "treefmt-nix": "treefmt-nix"
       },
       "locked": {
-        "lastModified": 1737731711,
-        "narHash": "sha256-6ubhKkCkBMuqFMjzeg+/2L5dNipKKf1KE9i8r8inyEg=",
+        "lastModified": 1738775476,
+        "narHash": "sha256-oFox7N1n+EE2I4WvuE0y4SI0a6h9RAoT216QQCtGcQ4=",
         "owner": "nix-community",
         "repo": "nixvim",
-        "rev": "841155edf9c4578f2f9a7bd6993e1da2ce73b35c",
+        "rev": "82440e1d4ed9d252d09c4cd9edc8c9ef23ce1f3a",
         "type": "github"
       },
       "original": {
@@ -561,11 +561,11 @@
         ]
       },
       "locked": {
-        "lastModified": 1737372689,
-        "narHash": "sha256-nH3zK2ki0fd5o5qvbGHxukE4qnOLJa1uCzoDObG5vrE=",
+        "lastModified": 1737924095,
+        "narHash": "sha256-9RO/IlxiE7bpY7GYsdDMNB533PnDOBo9UvYyXXqlN4c=",
         "owner": "NuschtOS",
         "repo": "search",
-        "rev": "570cc17bbc25650eb7d69e4fcda8cfd2f1656922",
+        "rev": "5efc9c966bb9bdad07a3c28667eac38b758c6f18",
         "type": "github"
       },
       "original": {
@@ -609,11 +609,11 @@
         ]
       },
       "locked": {
-        "lastModified": 1737483750,
-        "narHash": "sha256-5An1wq5U8sNycOBBg3nsDDgpwBmR9liOpDGlhliA6Xo=",
+        "lastModified": 1738070913,
+        "narHash": "sha256-j6jC12vCFsTGDmY2u1H12lMr62fnclNjuCtAdF1a4Nk=",
         "owner": "numtide",
         "repo": "treefmt-nix",
-        "rev": "f2cc121df15418d028a59c9737d38e3a90fbaf8f",
+        "rev": "bebf27d00f7d10ba75332a0541ac43676985dea3",
         "type": "github"
       },
       "original": {

+ 4 - 3
flake.nix

@@ -15,7 +15,7 @@
     disko.url = "github:nix-community/disko";
     disko.inputs.nixpkgs.follows = "nixpkgs";
 
-    home-manager.url = "github:nix-community/home-manager/release-24.11";
+    home-manager.url = "github:nix-community/home-manager/master";
     home-manager.inputs.nixpkgs.follows = "nixpkgs";
 
     nixvim.url = "github:nix-community/nixvim/nixos-24.11";
@@ -34,6 +34,7 @@
       disko,
       home-manager,
       nixvim,
+
       ...
     }@inputs:
     rec {
@@ -72,7 +73,7 @@
       modules = import ./modules;
       overlays = import ./overlays { inherit inputs; };
 
-      packages = lib.forAllSystemsWithPkgs (import ./packages);
-      formatter = lib.forAllSystems (system: nixpkgs.legacyPackages.${system}.nixfmt-rfc-style);
+      packages = lib.eachSystemWithPkgs (import ./packages);
+      formatter = lib.eachSystem (system: nixpkgs.legacyPackages.${system}.nixfmt-rfc-style);
     };
 }

+ 4 - 8
home/features/desktop/ghostty.nix

@@ -1,19 +1,15 @@
 {
   pkgs,
   config,
-  outputs,
   ...
 }:
 {
-  imports = [
-    outputs.modules.home-manager.ghostty-darwin
-  ];
-
-  programs.ghostty-darwin = {
+  programs.ghostty = {
     enable = true;
+    package = null;
 
-    # installBatSyntax = true;
-    # installVimSyntax = true;
+    installBatSyntax = false;
+    installVimSyntax = false;
 
     enableBashIntegration = true;
     enableZshIntegration = true;

+ 3 - 3
lib/default.nix

@@ -44,16 +44,16 @@ rec {
       extraSpecialArgs = { inherit inputs outputs; };
     };
 
-  forAllSystems = inputs.nixpkgs.lib.genAttrs [
+  eachSystem = inputs.nixpkgs.lib.genAttrs [
     "x86_64-linux"
     "x86_64-darwin"
     "aarch64-linux"
     "aarch64-darwin"
   ];
 
-  forAllSystemsWithPkgs =
+  eachSystemWithPkgs =
     f:
-    forAllSystems (
+    eachSystem (
       system:
       f {
         pkgs = getPkgsForSystem system;

+ 0 - 1
modules/home-manager/default.nix

@@ -1,3 +1,2 @@
 {
-  ghostty-darwin = import ./programs/ghostty-darwin.nix;
 }

+ 0 - 184
modules/home-manager/programs/ghostty-darwin.nix

@@ -1,184 +0,0 @@
-{
-  config,
-  lib,
-  pkgs,
-  ...
-}:
-let
-  cfg = config.programs.ghostty-darwin;
-
-  keyValueSettings = {
-    listsAsDuplicateKeys = true;
-    mkKeyValue = lib.generators.mkKeyValueDefault { } " = ";
-  };
-  keyValue = pkgs.formats.keyValue keyValueSettings;
-in
-{
-  meta.maintainers = [ lib.maintainers.HeitorAugustoLN ];
-
-  options.programs.ghostty-darwin = {
-    enable = lib.mkEnableOption "Ghostty";
-
-    package = lib.mkPackageOption pkgs "ghostty" { };
-
-    settings = lib.mkOption {
-      inherit (keyValue) type;
-      default = { };
-      example = lib.literalExpression ''
-        {
-          theme = "catppuccin-mocha";
-          font-size = 10;
-          keybind = [
-            "ctrl+h=goto_split:left"
-            "ctrl+l=goto_split:right"
-          ];
-        }
-      '';
-      description = ''
-        Configuration written to {file}`$XDG_CONFIG_HOME/ghostty/config`.
-
-        See <https://ghostty.org/docs/config/reference> for more information.
-      '';
-    };
-
-    themes = lib.mkOption {
-      type = lib.types.attrsOf keyValue.type;
-      default = { };
-      example = {
-        catppuccin-mocha = {
-          palette = [
-            "0=#45475a"
-            "1=#f38ba8"
-            "2=#a6e3a1"
-            "3=#f9e2af"
-            "4=#89b4fa"
-            "5=#f5c2e7"
-            "6=#94e2d5"
-            "7=#bac2de"
-            "8=#585b70"
-            "9=#f38ba8"
-            "10=#a6e3a1"
-            "11=#f9e2af"
-            "12=#89b4fa"
-            "13=#f5c2e7"
-            "14=#94e2d5"
-            "15=#a6adc8"
-          ];
-          background = "1e1e2e";
-          foreground = "cdd6f4";
-          cursor-color = "f5e0dc";
-          selection-background = "353749";
-          selection-foreground = "cdd6f4";
-        };
-      };
-      description = ''
-        Custom themes written to {file}`$XDG_CONFIG_HOME/ghostty/themes`.
-
-        See <https://ghostty.org/docs/features/theme#authoring-a-custom-theme> for more information.
-      '';
-    };
-
-    clearDefaultKeybinds = lib.mkEnableOption "" // {
-      description = "Whether to clear default keybinds.";
-    };
-
-    installVimSyntax = lib.mkEnableOption "installation of Ghostty configuration syntax for Vim";
-
-    installBatSyntax = lib.mkEnableOption "installation of Ghostty configuration syntax for bat" // {
-      default = true;
-    };
-
-    enableBashIntegration = lib.mkEnableOption ''
-      bash shell integration.
-
-      This is ensures that shell integration works in more scenarios, such as switching shells within Ghostty.
-      But it is not needed to have shell integration.
-      See <https://ghostty.org/docs/features/shell-integration#manual-shell-integration-setup> for more information
-    '';
-
-    enableFishIntegration = lib.mkEnableOption ''
-      fish shell integration.
-
-      This is ensures that shell integration works in more scenarios, such as switching shells within Ghostty.
-      But it is not needed to have shell integration.
-      See <https://ghostty.org/docs/features/shell-integration#manual-shell-integration-setup> for more information
-    '';
-
-    enableZshIntegration = lib.mkEnableOption ''
-      zsh shell integration.
-
-      This is ensures that shell integration works in more scenarios, such as switching shells within Ghostty.
-      But it is not needed to have shell integration.
-      See <https://ghostty.org/docs/features/shell-integration#manual-shell-integration-setup> for more information
-    '';
-  };
-
-  config = lib.mkIf cfg.enable (
-    lib.mkMerge [
-      {
-        programs.ghostty.settings = lib.mkIf cfg.clearDefaultKeybinds {
-          keybind = lib.mkBefore [ "clear" ];
-        };
-
-        # MacOS also supports XDG configuration directory, so we use it for both
-        # Linux and macOS to reduce complexity
-        xdg.configFile = lib.mkMerge [
-          {
-            "ghostty/config" = lib.mkIf (cfg.settings != { }) {
-              source = keyValue.generate "ghostty-config" cfg.settings;
-              onChange = "ghostty +validate-config";
-            };
-          }
-
-          (lib.mkIf (cfg.themes != { }) (
-            lib.mapAttrs' (name: value: {
-              name = "ghostty/themes/${name}";
-              value.source = keyValue.generate "ghostty-${name}-theme" value;
-            }) cfg.themes
-          ))
-        ];
-      }
-
-      # (lib.mkIf cfg.installVimSyntax {
-      #   programs.vim.plugins = [ cfg.package.vim ];
-      # })
-
-      # (lib.mkIf cfg.installBatSyntax {
-      #   programs.bat = {
-      #     syntaxes.ghostty = {
-      #       src = cfg.package;
-      #       file = "share/bat/syntaxes/ghostty.sublime-syntax";
-      #     };
-      #     config.map-syntax =
-      #       [ "${config.xdg.configHome}/ghostty/config:Ghostty Config" ];
-      #   };
-      # })
-
-      (lib.mkIf cfg.enableBashIntegration {
-        # Make order 101 to be placed exactly after bash completions, as Ghostty
-        # documentation suggests sourcing the script as soon as possible
-        programs.bash.initExtra = lib.mkOrder 101 ''
-          if [[ -n "''${GHOSTTY_RESOURCES_DIR}" ]]; then
-            builtin source "''${GHOSTTY_RESOURCES_DIR}/shell-integration/bash/ghostty.bash"
-          fi
-        '';
-      })
-
-      (lib.mkIf cfg.enableFishIntegration {
-        programs.fish.shellInit = ''
-          if set -q GHOSTTY_RESOURCES_DIR
-            source "$GHOSTTY_RESOURCES_DIR/shell-integration/fish/vendor_conf.d/ghostty-shell-integration.fish"
-          end
-        '';
-      })
-
-      (lib.mkIf cfg.enableZshIntegration {
-        programs.zsh.initExtra = ''
-          if [[ -n $GHOSTTY_RESOURCES_DIR ]]; then
-            source "$GHOSTTY_RESOURCES_DIR"/shell-integration/zsh/ghostty-integration
-          fi
-        '';
-      })
-    ]
-  );
-}