From 97df8d8cc13e2162283dd0148602b733f65e5d32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20Qui=C3=B1ones?= Date: Fri, 12 Jan 2024 18:05:20 -0500 Subject: [PATCH] zig: add module programs.zig --- modules/lib/maintainers.nix | 6 +++++ modules/modules.nix | 1 + modules/programs/zig.nix | 47 +++++++++++++++++++++++++++++++++++++ 3 files changed, 54 insertions(+) create mode 100644 modules/programs/zig.nix diff --git a/modules/lib/maintainers.nix b/modules/lib/maintainers.nix index e75541d93..3f48406b1 100644 --- a/modules/lib/maintainers.nix +++ b/modules/lib/maintainers.nix @@ -465,6 +465,12 @@ github = "liyangau"; githubId = 71299093; }; + luisnquin = { + name = "Luis Quiñones"; + email = "lpaandres2020@gmail.com"; + github = "luisnquin"; + githubId = 86449787; + }; wcarlsen = { name = "Willi Carlsen"; email = "carlsenwilli+nix@gmail.com"; diff --git a/modules/modules.nix b/modules/modules.nix index 16b7837bf..f6cb391a9 100644 --- a/modules/modules.nix +++ b/modules/modules.nix @@ -245,6 +245,7 @@ let ./programs/z-lua.nix ./programs/zathura.nix ./programs/zellij.nix + ./programs/zig.nix ./programs/zoxide.nix ./programs/zplug.nix ./programs/zsh.nix diff --git a/modules/programs/zig.nix b/modules/programs/zig.nix new file mode 100644 index 000000000..2e46f0f76 --- /dev/null +++ b/modules/programs/zig.nix @@ -0,0 +1,47 @@ +{ config, pkgs, lib, ... }: + +with lib; + +let + + cfg = config.programs.zig; + +in { + meta.maintainers = [ maintainers.luisnquin ]; + + options = { + programs.zig = { + enable = mkEnableOption "zig"; + + package = mkOption pkgs { + type = types.package; + default = pkgs.zig; + defaultText = literalExpression "pkgs.zig"; + description = "The Zig package to use."; + }; + + enableZshIntegration = mkOption { + type = types.bool; + default = false; + description = '' + Whether to enable Zig’s Zsh integration. + ''; + }; + }; + }; + + config = mkIf cfg.enable { + home.packages = [ cfg.package ]; + + programs.zsh.plugins = mkIf cfg.enableZshIntegration [{ + name = "zig-zsh-completions-plugin"; + file = "zig-shell-completions.plugin.zsh"; + src = pkgs.fetchFromGitHub { + owner = "ziglang"; + repo = "shell-completions"; + rev = "31d3ad12890371bf467ef7143f5c2f31cfa7b7c1"; + sha256 = "1fzl1x56b4m11wajk1az4p24312z7wlj2cqa3b519v30yz9clgr0"; + }; + }]; + }; +}