From 7fd624ec40d381dea65000e5be9d68ab74565f04 Mon Sep 17 00:00:00 2001 From: Sergei Bulavintsev Date: Wed, 31 Jan 2024 12:31:58 +0300 Subject: [PATCH] feat(nix): add develop suite --- nix/modules/nixos/cli-apps/atuin/default.nix | 24 +++++++++++++++++++ nix/modules/nixos/suites/common/default.nix | 1 + nix/modules/nixos/suites/develop/default.nix | 23 ++++++++++++++++++ nix/modules/nixos/tools/k8s/default.nix | 6 ++++- nix/modules/nixos/tools/linters/default.nix | 23 ++++++++++++++++++ nix/modules/nixos/tools/lsp/default.nix | 25 ++++++++++++++++++++ nix/packages/sys/default.nix | 4 ++-- nix/systems/x86_64-linux/nz/default.nix | 1 + 8 files changed, 104 insertions(+), 3 deletions(-) create mode 100644 nix/modules/nixos/cli-apps/atuin/default.nix create mode 100644 nix/modules/nixos/suites/develop/default.nix create mode 100644 nix/modules/nixos/tools/linters/default.nix create mode 100644 nix/modules/nixos/tools/lsp/default.nix diff --git a/nix/modules/nixos/cli-apps/atuin/default.nix b/nix/modules/nixos/cli-apps/atuin/default.nix new file mode 100644 index 0000000..fbff256 --- /dev/null +++ b/nix/modules/nixos/cli-apps/atuin/default.nix @@ -0,0 +1,24 @@ +{ + lib, + config, + pkgs, + ... +}: +with lib; +with lib.custom; let + cfg = config.custom.cli-apps.atuin; +in { + options.custom.cli-apps.atuin = { + enable = mkEnableOption "atuin"; + }; + + config = mkIf cfg.enable { + home.programs.atuin = { + enable = true; + # Does not work right now, injecting via fish + enableBashIntegration = true; + enableFishIntegration = true; + enableZshIntegration = true; + }; + }; +} diff --git a/nix/modules/nixos/suites/common/default.nix b/nix/modules/nixos/suites/common/default.nix index ddb846c..7619e94 100644 --- a/nix/modules/nixos/suites/common/default.nix +++ b/nix/modules/nixos/suites/common/default.nix @@ -41,6 +41,7 @@ in { misc.enable = true; }; custom.cli-apps = { + atuin.enable = true; neovim.enable = true; tmux.enable = true; }; diff --git a/nix/modules/nixos/suites/develop/default.nix b/nix/modules/nixos/suites/develop/default.nix new file mode 100644 index 0000000..fba4058 --- /dev/null +++ b/nix/modules/nixos/suites/develop/default.nix @@ -0,0 +1,23 @@ +{ + options, + config, + lib, + pkgs, + ... +}: +with lib; +with lib.custom; let + cfg = config.suites.develop; +in { + options.suites.develop = with types; { + enable = mkBoolOpt false "Enable the develop suite"; + }; + + config = mkIf cfg.enable { + custom.tools = { + lsp.enable = true; + linters.enable = true; + k8s.enable = true; + }; + }; +} diff --git a/nix/modules/nixos/tools/k8s/default.nix b/nix/modules/nixos/tools/k8s/default.nix index 402a424..cba8a8d 100644 --- a/nix/modules/nixos/tools/k8s/default.nix +++ b/nix/modules/nixos/tools/k8s/default.nix @@ -15,8 +15,9 @@ in { }; config = mkIf cfg.enable { - programs.zsh.shellAliases = { + programs.fish.shellAliases = { k = "kubecolor"; + kk = "kubecolor"; kubectl = "kubecolor"; kc = "kubectx"; kn = "kubens"; @@ -30,6 +31,9 @@ in { kubecolor kubernetes-helm helmfile + helm-docs + k9s + krew ]; }; } diff --git a/nix/modules/nixos/tools/linters/default.nix b/nix/modules/nixos/tools/linters/default.nix new file mode 100644 index 0000000..f8bb160 --- /dev/null +++ b/nix/modules/nixos/tools/linters/default.nix @@ -0,0 +1,23 @@ +{ + options, + config, + lib, + pkgs, + ... +}: +with lib; +with lib.custom; let + cfg = config.custom.tools.linters; +in { + options.custom.tools.linters = with types; { + enable = mkBoolOpt false "Whether or not to enable linters utilities."; + }; + + config = mkIf cfg.enable { + environment.systemPackages = with pkgs; [ + alejandra + ctags + stylua + ]; + }; +} diff --git a/nix/modules/nixos/tools/lsp/default.nix b/nix/modules/nixos/tools/lsp/default.nix new file mode 100644 index 0000000..5175989 --- /dev/null +++ b/nix/modules/nixos/tools/lsp/default.nix @@ -0,0 +1,25 @@ +{ + options, + config, + lib, + pkgs, + ... +}: +with lib; +with lib.custom; let + cfg = config.custom.tools.lsp; +in { + options.custom.tools.lsp = with types; { + enable = mkBoolOpt false "Whether or not to enable lsp utilities."; + }; + + config = mkIf cfg.enable { + environment.systemPackages = with pkgs; [ + lua-language-server # LSP for lua + marksman # LSP for markdown + rnix-lsp # LSP for nix + tree-sitter + yamllint + ]; + }; +} diff --git a/nix/packages/sys/default.nix b/nix/packages/sys/default.nix index c1431ed..c9c6491 100644 --- a/nix/packages/sys/default.nix +++ b/nix/packages/sys/default.nix @@ -3,12 +3,12 @@ writeShellScriptBin "sys" '' cmd_rebuild() { echo "🔨 Building system configuration with $REBUILD_COMMAND" - $REBUILD_COMMAND switch --flake .# + $REBUILD_COMMAND switch --flake ~/dotfiles/nix# } cmd_test() { echo "🏗️ Building ephemeral system configuration with $REBUILD_COMMAND" - $REBUILD_COMMAND test --fast --flake .# + $REBUILD_COMMAND test --fast --flake ~/dotfiles/nix# } # TODO: Make it update a single input diff --git a/nix/systems/x86_64-linux/nz/default.nix b/nix/systems/x86_64-linux/nz/default.nix index 2a0fff3..d9721cc 100644 --- a/nix/systems/x86_64-linux/nz/default.nix +++ b/nix/systems/x86_64-linux/nz/default.nix @@ -13,6 +13,7 @@ suites.common.enable = true; # Enables the basics, like audio, networking, ssh, etc. suites.desktop.enable = true; + suites.develop.enable = true; # ======================== DO NOT CHANGE THIS ======================== system.stateVersion = "23.11";