From 84191dac3eb3ff2c0c189d33a9c13b3db8378f25 Mon Sep 17 00:00:00 2001 From: joygnu Date: Thu, 4 Jul 2024 08:07:16 +0200 Subject: [PATCH] rb --- home/default.nix | 1 - home/hyprland/cmus.sh | 7 -- home/neovim/default.nix | 114 ------------------------------- home/neovim/populate-nvim-env.py | 87 ----------------------- modules/misc/default.nix | 5 ++ modules/packages/default.nix | 2 + 6 files changed, 7 insertions(+), 209 deletions(-) delete mode 100755 home/hyprland/cmus.sh delete mode 100644 home/neovim/default.nix delete mode 100644 home/neovim/populate-nvim-env.py diff --git a/home/default.nix b/home/default.nix index e204367..19e047e 100644 --- a/home/default.nix +++ b/home/default.nix @@ -9,7 +9,6 @@ ./gtk ./git ./ags - ./neovim inputs.nix-colors.homeManagerModules.default inputs.ags.homeManagerModules.default ]; diff --git a/home/hyprland/cmus.sh b/home/hyprland/cmus.sh deleted file mode 100755 index 5f6d647..0000000 --- a/home/hyprland/cmus.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env bash - -# Start cmus in a screen session named 'cmus_session' -screen -S cmus_session -dm cmus - -echo "cmus started in screen session 'cmus_session'. Use 'screen -r cmus_session' to attach." - diff --git a/home/neovim/default.nix b/home/neovim/default.nix deleted file mode 100644 index f34d069..0000000 --- a/home/neovim/default.nix +++ /dev/null @@ -1,114 +0,0 @@ -{ flake -, config -, pkgs -, lib -, ... -}: - - -let - inherit (lib) concatStringsSep optional; - inherit (config.lib.file) mkOutOfStoreSymlink; - - cfg = config.programs.neovim; - - home = config.home.homeDirectory; - populateEnv = ./populate-nvim-env.py; - - populateEnvScript = openapi_path: '' - mkdir -p ${config.xdg.dataHome}/nvim/site/plugin - ${pkgs.python39}/bin/python ${populateEnv} -o ${config.xdg.dataHome}/nvim/site/plugin --openapi_path "${openapi_path}" - ''; -in -{ - # Neovim - - # https://rycee.gitlab.io/home-manager/options.html#opt-programs.neovim.enable - programs.neovim = { - enable = true; - viAlias = true; - vimAlias = true; - defaultEditor = true; - package = pkgs.neovim-nightly; - extraLuaPackages = ps: [ ps.magick ]; - }; - - # xdg.configFile."nvim" = { - # source = config.lib.file.mkOutOfStoreSymlink "${home}/.config/nvim"; - # recursive = true; - # }; - - home.packages = with pkgs.unstable; [ - tree-sitter - lua-language-server - stylua - shfmt - - # python - python311Packages.flake8 - python311Packages.black - python311Packages.python-lsp-server - - # web stuff - nodePackages_latest.prettier - nodePackages_latest.eslint_d - nodePackages_latest.vscode-langservers-extracted - nodePackages_latest.typescript-language-server - - # rust - rust-analyzer - rustfmt - - # config - taplo - - # nix - nixpkgs-fmt - rnix-lsp - - (pkgs.writeShellScriptBin "update-nvim-env" '' - # - # update-nvim-env - # - # Update neovim env such that it can be used in neovide or other GUIs. - - ${populateEnvScript config.sops.secrets.openapi-key.path} - '') - (pkgs.writeShellScriptBin "clean-nvim-all" '' - rm -rf ${config.xdg.dataHome}/nvim - rm -rf ${config.xdg.cacheHome}/nvim - rm -rf ${config.xdg.stateHome}/nvim - rm -rf ${config.xdg.configHome}/nvim - '') - (pkgs.writeShellScriptBin "clean-nvim" '' - rm -rf ${config.xdg.dataHome}/nvim - rm -rf ${config.xdg.stateHome}/nvim - rm -rf ${config.xdg.cacheHome}/nvim - '') - ]; - - home.activation.neovim = lib.hm.dag.entryAfter [ "writeBoundary" ] '' - echo "Populating neovim env..." - ${populateEnvScript config.sops.secrets.openapi-key.path} - ''; - - programs.zsh.initExtra = lib.mkIf cfg.enable (lib.mkAfter '' - # alias n="${pkgs.neovim}/bin/nvim" - ''); - - - sops = { - age.keyFile = "${home}/.config/sops/age/keys.txt"; - age.generateKey = true; - secrets = { - openapi-key = { - # owner = "rayandrew"; - mode = "0440"; - sopsFile = ../../secrets.yaml; - # path = "%r/openapi-key.txt"; - path = "${config.home.homeDirectory}/.openai_api_key"; - # neededForUsers = true; - }; - }; - }; -} diff --git a/home/neovim/populate-nvim-env.py b/home/neovim/populate-nvim-env.py deleted file mode 100644 index 46c43bd..0000000 --- a/home/neovim/populate-nvim-env.py +++ /dev/null @@ -1,87 +0,0 @@ -#!/bin/env python3 - -import os -from collections import OrderedDict -import argparse -from pathlib import Path - -KEYS = [ - # PATH - "PATH", - "CS154_ADMIN", - "BREW_PREFIX", - "CONDA_PYTHON_EXE", - "SPACESHIP_ROOT", - "COLORFGBG", - "XPC_SERVICE_NAME", - "_CE_M", - "XPC_FLAGS", - "LANG", - # terminal - "VISUAL", - "LESS", - "LOGNAME", - "COLORTERM", - "HISTFILE", - "LC_TERMINAL", - "LC_TERMINAL_VERSION", - "ITERM_SESSION_ID", - "ITERM_PROFILE", - "TERM_SESSION_ID", - "TERM_PROGRAM", - "STARSHIP_SESSION_KEY", - "STARSHIP_CONFIG", - "VI_MODE_SET_CURSOR", - "_", - "LSCOLORS", - "ZSH", - "EDITOR", - # XDG - "XDG_DATA_HOME", - "XDG_STATE_HOME", - "XDG_CACHE_HOME", - "XDG_CONFIG_HOME", -] - - -def main(args): - env = os.environ.copy() - env = OrderedDict(sorted(env.items())) - dst_file = "{}/env.lua".format(args.output_path) - - openapi_key = None - - if args.openapi_path != "": - openapi_path = Path(args.openapi_path) - if openapi_path.exists(): - with open(openapi_path, "r") as f: - openapi_key = f.readline().strip("\n") - - with open(dst_file, "w") as f: - for key, value in env.items(): - if key in KEYS: - if key == "PATH": - f.write('vim.env.PATH = vim.env.PATH .. ":{}"\n'.format(value)) - continue - f.write('vim.fn.setenv("{}", "{}")\n'.format(key, value)) - - if openapi_key is not None: - f.write('vim.fn.setenv("OPENAI_API_KEY", "{}")\n'.format(openapi_key)) - - f.close() - - -if __name__ == "__main__": - home_directory = os.path.expanduser("~") - parser = argparse.ArgumentParser("Neovim Populate Env") - parser.add_argument("--openapi_path", required=False, type=str, default="") - parser.add_argument( - "-o", - "--output_path", - required=False, - help="Output Path", - type=str, - default="{}/.config/nvim/lua/rayandrew".format(home_directory), - ) - args = parser.parse_args() - main(args) diff --git a/modules/misc/default.nix b/modules/misc/default.nix index 76277f6..1fccedf 100644 --- a/modules/misc/default.nix +++ b/modules/misc/default.nix @@ -22,6 +22,11 @@ programs.gnupg.agent = { pinentryPackage = pkgs.pinentry-curses; enableSSHSupport = true; }; + +programs.neovim = { + enable = true; + defaultEditor = true; +}; programs.hyprland.enable = true; users.defaultUserShell = pkgs.zsh; diff --git a/modules/packages/default.nix b/modules/packages/default.nix index 70abe30..99794d4 100644 --- a/modules/packages/default.nix +++ b/modules/packages/default.nix @@ -41,6 +41,8 @@ gnome-calculator gnome-disk-utility #random utils + gnat14 + libgccjit tree rofi-wayland screen