From e6ed60548397627bf10f561f9438201dbba0a36e Mon Sep 17 00:00:00 2001 From: Azat Bahawi Date: Sun, 21 Apr 2024 02:15:42 +0300 Subject: 2024-04-21 --- modules/common/profiles/dev/containers.nix | 57 -------------- modules/common/profiles/dev/default.nix | 84 -------------------- modules/common/profiles/dev/gdbinit | 41 ---------- modules/common/profiles/dev/ghci.conf | 35 --------- modules/common/profiles/dev/pystartup.py | 121 ----------------------------- modules/common/profiles/dev/sql.nix | 105 ------------------------- 6 files changed, 443 deletions(-) delete mode 100644 modules/common/profiles/dev/containers.nix delete mode 100644 modules/common/profiles/dev/default.nix delete mode 100644 modules/common/profiles/dev/gdbinit delete mode 100644 modules/common/profiles/dev/ghci.conf delete mode 100644 modules/common/profiles/dev/pystartup.py delete mode 100644 modules/common/profiles/dev/sql.nix (limited to 'modules/common/profiles/dev') diff --git a/modules/common/profiles/dev/containers.nix b/modules/common/profiles/dev/containers.nix deleted file mode 100644 index 8f3bfc6..0000000 --- a/modules/common/profiles/dev/containers.nix +++ /dev/null @@ -1,57 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: -with lib; -let - cfg = config.nixfiles.modules.profiles.dev.containers; -in -{ - options.nixfiles.modules.profiles.dev.containers.enable = - mkEnableOption "Tools for working with containers and container orchestration" - // { - default = config.nixfiles.modules.profiles.dev.enable; - }; - - config = mkIf cfg.enable { - nixfiles.modules.common.shell.aliases = { - h = "helm"; - k = "kubectl"; - kns = "kubens"; - ktx = "kubectx"; - }; - - hm.home = { - sessionVariables = { - MINIKUBE_IN_STYLE = "false"; - WERF_DEV = "true"; - WERF_INSECURE_REGISTRY = "true"; - WERF_LOG_DEBUG = "true"; - WERF_LOG_PRETTY = "false"; - WERF_LOG_VERBOSE = "true"; - WERF_SYNCHRONIZATION = ":local"; - WERF_TELEMETRY = "false"; - }; - - packages = with pkgs; [ - k9s - kubectl - kubectl-doctor - kubectl-images - kubectl-tree - kubectx - kubelogin-oidc - kubent - kubernetes-helm - kubespy - minikube - skopeo - stern - telepresence2 - werf - ]; - }; - }; -} diff --git a/modules/common/profiles/dev/default.nix b/modules/common/profiles/dev/default.nix deleted file mode 100644 index 6ac1fe6..0000000 --- a/modules/common/profiles/dev/default.nix +++ /dev/null @@ -1,84 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: -with lib; -let - cfg = config.nixfiles.modules.profiles.dev; -in -{ - imports = [ - ./containers.nix - ./hidden.nix - ./sql.nix - ]; - - options.nixfiles.modules.profiles.dev.enable = mkEnableOption "Catch-all profile for stuff related to software development and etc."; - - config = mkIf cfg.enable { - nixfiles.modules = { - bat.enable = true; - curl.enable = true; - direnv.enable = true; - editorconfig.enable = true; - git.client.enable = true; - gnupg.enable = true; - nmap.enable = true; - wget.enable = true; - }; - - hm = { - home = { - sessionVariables = rec { - CABAL_DIR = "${config.dirs.data}/cabal"; - CABAL_CONFIG = pkgs.writeText "cabal-config" '' - repository hackage.haskell.org - url: https://hackage.haskell.org/ - secure: True - - jobs: $ncpus - - remote-repo-cache: ${CABAL_DIR}/packages - - world-file: ${CABAL_DIR}/world - - logs-dir: ${CABAL_DIR}/logs - build-summary: ${CABAL_DIR}/logs/build.log - - installdir: ${CABAL_DIR}/bin - extra-prog-path: ${CABAL_DIR}/bin - ''; - STACK_ROOT = "${config.dirs.data}/stack"; - - RUSTUP_HOME = "${config.dirs.data}/rustup"; - CARGO_HOME = "${config.dirs.data}/cargo"; - - GOPATH = "${config.dirs.data}/go"; - GORE_HOME = "${config.dirs.data}/gore"; - - PYTHONSTARTUP = ./pystartup.py; - }; - - packages = with pkgs; [ - age - htmlq - httpie - hydra-check - jq - logcli - nix-update - nixpkgs-review - sops - yq - ]; - }; - - xdg.configFile = { - "gdb/gdbinit".source = ./gdbinit; - "ghc/ghci.conf".source = ./ghci.conf; - }; - }; - }; -} diff --git a/modules/common/profiles/dev/gdbinit b/modules/common/profiles/dev/gdbinit deleted file mode 100644 index e266236..0000000 --- a/modules/common/profiles/dev/gdbinit +++ /dev/null @@ -1,41 +0,0 @@ -set confirm off -set verbose off -set editing off - -set history expansion on - -set height 0 -set width 0 - -handle SIGALRM nostop print nopass -handle SIGBUS stop print nopass -handle SIGPIPE nostop print nopass -handle SIGSEGV stop print nopass - -set print address on -set print elements 0 -set print object on -set print pretty on -set print repeats 0 -set print static-members on -set print vtbl on - -set output-radix 10 - -set demangle-style gnu-v3 - -set disassembly-flavor intel - -alias iv=info variables - -alias da=disassemble - -define fs - finish - step -end - -define btc - backtrace - continue -end diff --git a/modules/common/profiles/dev/ghci.conf b/modules/common/profiles/dev/ghci.conf deleted file mode 100644 index d672167..0000000 --- a/modules/common/profiles/dev/ghci.conf +++ /dev/null @@ -1,35 +0,0 @@ -:set -XBinaryLiterals -:set -XFlexibleContexts -:set -XNoMonomorphismRestriction - -:seti -XConstraintKinds -:seti -XDataKinds -:seti -XDeriveFunctor -:seti -XFlexibleInstances -:seti -XFunctionalDependencies -:seti -XGADTs -:seti -XLambdaCase -:seti -XMagicHash -:seti -XMultiParamTypeClasses -:seti -XMultiWayIf -:seti -XOverloadedLabels -:seti -XPackageImports -:seti -XPolyKinds -:seti -XRankNTypes -:seti -XScopedTypeVariables -:seti -XStandaloneDeriving -:seti -XTupleSections -:seti -XTypeFamilies -:seti -XTypeOperators -:seti -XUndecidableInstances - -:set +c -:set +m -:set +r -:set +s -:set +t - -:set prompt "\ESC[1;34m>\ESC[m\STX " -:set prompt-cont "\ESC[1;94m|\ESC[m\STX " - -:def hoogle \x -> pure (":!hoogle --color --count=10 \"" ++ x ++ "\"") diff --git a/modules/common/profiles/dev/pystartup.py b/modules/common/profiles/dev/pystartup.py deleted file mode 100644 index adde66c..0000000 --- a/modules/common/profiles/dev/pystartup.py +++ /dev/null @@ -1,121 +0,0 @@ -import atexit -import os -import readline -import rlcompleter -import sys -from code import InteractiveConsole -from tempfile import mkstemp - -readline.parse_and_bind("tab: complete") - - -class TermColors(dict): - color_templates = ( - ("Normal", "0"), - ("Black", "0;30"), - ("Red", "0;31"), - ("Green", "0;32"), - ("Brown", "0;33"), - ("Blue", "0;34"), - ("Purple", "0;35"), - ("Cyan", "0;36"), - ("LightGray", "0;37"), - ("DarkGray", "1;30"), - ("LightRed", "1;31"), - ("LightGreen", "1;32"), - ("Yellow", "1;33"), - ("LightBlue", "1;34"), - ("LightPurple", "1;35"), - ("LightCyan", "1;36"), - ("White", "1;37"), - ) - color_base = "\001\033[%sm\002" - - def __init__(self): - self.update(dict([(k, self.color_base % v) for k, v in self.color_templates])) - - -class Completer(object): - def save_history(self): - import readline - - readline.write_history_file(self.python_histfile) - - def __init__(self): - self.python_dir = os.path.expanduser("%s/python" % os.environ["XDG_DATA_HOME"]) - - if not os.path.exists(self.python_dir): - os.mkdir(self.python_dir) - - self.python_histfile = os.path.expanduser("%s/history" % self.python_dir) - - if os.path.exists(self.python_histfile): - readline.read_history_file(self.python_histfile) - - readline.set_history_length(1000) - atexit.register(self.save_history) - - -def DisplayHook(value): - if value is not None: - try: - import __builtin__ - - __builtin__._ = value - except ImportError: - __builtins__._ = value - - import pprint - - pprint.pprint(value) - del pprint - - -class EditableBufferInteractiveConsole(InteractiveConsole): - def __init__(self, *args, **kwargs): - self.last_buffer = [] - InteractiveConsole.__init__(self, *args, **kwargs) - - def runsource(self, source, *args): - self.last_buffer = [source.encode("utf-8")] - return InteractiveConsole.runsource(self, source, *args) - - def raw_input(self, *args): - line = InteractiveConsole.raw_input(self, *args) - - if line == EDIT_CMD: - tmp_fd, tmp_file = mkstemp(".py") - - os.write(tmp_fd, b"\n".join(self.last_buffer)) - os.close(tmp_fd) - - os.system("%s %s" % (EDITOR, tmp_file)) - - line = open(tmp_file).read() - - os.unlink(tmp_file) - tmp_file = "" - - lines = line.split("\n") - - for i in range(len(lines) - 1): - self.push(lines[i]) - - line = lines[-1] - return line - - -TC = TermColors() -ps1 = "%sλ%s %s>%s " -sys.ps1 = ps1 % (TC["Blue"], TC["Normal"], TC["White"], TC["Normal"]) -ps2 = " %s…%s %s>%s " -sys.ps2 = ps2 % (TC["Blue"], TC["Normal"], TC["White"], TC["Normal"]) -sys.displayhook = DisplayHook - -C = Completer() -EDITOR = os.environ.get("EDITOR", "vim") -EDIT_CMD = ":e" -C = EditableBufferInteractiveConsole(locals=locals()) -C.interact(banner="") - -sys.exit() diff --git a/modules/common/profiles/dev/sql.nix b/modules/common/profiles/dev/sql.nix deleted file mode 100644 index c2d4894..0000000 --- a/modules/common/profiles/dev/sql.nix +++ /dev/null @@ -1,105 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: -with lib; -let - cfg = config.nixfiles.modules.profiles.dev.sql; -in -{ - options.nixfiles.modules.profiles.dev.sql.enable = - mkEnableOption "SQL stuff and database management tools" - // { - default = config.nixfiles.modules.profiles.dev.enable; - }; - - config = mkIf cfg.enable { - hm = { - home.packages = with pkgs; [ - pgcli - litecli - ]; - - xdg = - let - mainSection = { - destructive_warning = "True"; - enable_pager = "True"; - keyword_casing = "auto"; - less_chatty = "True"; - log_file = "/dev/null"; - log_level = "CRITICAL"; - multi_line = "False"; - syntax_style = "default"; - table_format = "fancy_grid"; - }; - - colorsSection = with config.colors.withHashtag; { - "arg-toolbar" = "noinherit bold"; - "arg-toolbar.text" = "nobold"; - "bottom-toolbar" = "bg:${base01} ${base06}"; - "bottom-toolbar.off" = "bg:${base01} ${base02}"; - "bottom-toolbar.on" = "bg:${base01} ${base07}"; - "bottom-toolbar.transaction.failed" = "bg:${base01} ${base08} bold"; - "bottom-toolbar.transaction.valid" = "bg:${base01} ${base0B} bold"; - "completion-menu.completion" = "bg:${base01} ${base06}"; - "completion-menu.completion.current" = "bg:${base06} ${base01}"; - "completion-menu.meta.completion" = "bg:${base01} ${base13}"; - "completion-menu.meta.completion.current" = "bg:${base09} ${base01}"; - "completion-menu.multi-column-meta" = "bg:${base09} ${base01}"; - "scrollbar" = "bg:${base01}"; - "scrollbar.arrow" = "bg:${base01}"; - "search" = "bg:${base17} ${base07}"; - "search-toolbar" = "noinherit bold"; - "search-toolbar.text" = "nobold"; - "search.current" = "bg:${base14} ${base07}"; - "selected" = "bg:${base0D} ${base07}"; - "system-toolbar" = "noinherit bold"; - }; - - mkCliConfig = - { name, custom }: - { - "${name}/config" = { - text = generators.toINI { } { - main = mainSection // custom; - colors = mapAttrs (_: v: "'${v}'") colorsSection; - }; - }; - }; - in - { - configFile = mkMerge ( - map mkCliConfig [ - { - name = "pgcli"; - custom = { - prompt = "'\\u@\\h:\\d> '"; - multi_line_mode = "psql"; - on_error = "STOP"; - auto_expand = "True"; - expand = "True"; - keyring = "False"; - vi = "True"; - casing_file = "/dev/null"; - history_file = "/dev/null"; - }; - } - { - name = "litecli"; - custom = { - prompt = "'\\d> '"; - prompt_continuation = "'-> '"; - auto_vertical_output = "True"; - key_bindings = "vi"; - audit_log = "/dev/null"; - }; - } - ] - ); - }; - }; - }; -} -- cgit 1.4.1