From 5a4e7e22a6975ebc3de70e68446ff53109c64170 Mon Sep 17 00:00:00 2001 From: Azat Bahawi Date: Sun, 7 Jan 2024 23:57:45 +0300 Subject: 2024-01-07 --- modules/common/default.nix | 2 +- modules/common/editorconfig.nix | 129 +++++++++++++++++++++++++++ modules/common/neovim/default.nix | 27 ------ modules/common/profiles/dev/default.nix | 18 +--- modules/common/profiles/dev/editorconfig.ini | 96 -------------------- modules/common/profiles/headful.nix | 1 - modules/common/vscode.nix | 2 +- 7 files changed, 133 insertions(+), 142 deletions(-) create mode 100644 modules/common/editorconfig.nix delete mode 100644 modules/common/neovim/default.nix delete mode 100644 modules/common/profiles/dev/editorconfig.ini (limited to 'modules/common') diff --git a/modules/common/default.nix b/modules/common/default.nix index 3b42031..c6c7c81 100644 --- a/modules/common/default.nix +++ b/modules/common/default.nix @@ -6,6 +6,7 @@ _: { ./common ./curl.nix ./direnv.nix + ./editorconfig.nix ./emacs ./eza.nix ./fonts.nix @@ -13,7 +14,6 @@ _: { ./gnupg.nix ./htop.nix ./mpv.nix - ./neovim ./nmap.nix ./openssh.nix ./password-store.nix diff --git a/modules/common/editorconfig.nix b/modules/common/editorconfig.nix new file mode 100644 index 0000000..822acf6 --- /dev/null +++ b/modules/common/editorconfig.nix @@ -0,0 +1,129 @@ +{ + config, + lib, + ... +}: +with lib; let + cfg = config.nixfiles.modules.editorconfig; +in { + options.nixfiles.modules.editorconfig.enable = mkEnableOption "Editorconfig"; + + config = mkIf cfg.enable { + hm.editorconfig = { + enable = true; + settings = { + "*" = { + charset = "utf-8"; + end_of_line = "lf"; + indent_size = 2; + indent_style = "space"; + insert_final_newline = true; + max_line_length = 80; + trim_trailing_whitespace = true; + }; + + # https://google.github.io/styleguide/cppguide.html#Spaces_vs._Tabs + "*.{c,cc,cpp,cxx,h,hh,hpp,hxx}" = { + indent_size = 2; + indent_style = "space"; + }; + + # https://go.dev/doc/effective_go#formatting + "*.go" = { + indent_size = 2; + indent_style = "tab"; + }; + + # https://google.github.io/styleguide/pyguide.html#s3.4-indentation + # https://peps.python.org/pep-0008/#indentation + "*.py" = { + indent_size = 4; + indent_style = "space"; + }; + + # https://google.github.io/styleguide/shellguide.html#s5-formatting + "*.{sh,bash}" = { + indent_size = 2; + indent_style = "space"; + }; + + # https://www.haskell.org/onlinereport/haskell2010/haskellch10.html#x17-17800010.3 + # https://en.wikibooks.org/wiki/Haskell/Indentation + "*.hs" = { + indent_size = 2; + indent_style = "space"; + }; + + # https://google.github.io/styleguide/lispguide.xml#Formatting + "*.{lisp,cl,rkt,scm,el}" = { + indent_size = 2; + indent_style = "space"; + }; + + # https://github.com/ziglang/zig/wiki/FAQ#why-does-zig-fmt-use-spaces-instead-of-tabs + "*.zig" = { + indent_size = 4; + indent_style = "space"; + }; + + "*.{asm,s}" = { + indent_size = 4; + indent_style = "spaces"; + }; + + # https://www.gnu.org/software/make/manual/html_node/Rule-Syntax.html + "{Makefile*,*.mk}" = { + indent_size = 4; + indent_style = "tab"; + }; + + # https://cmake-format.readthedocs.io/en/latest/configopts.html#tab-size + # https://cmake-format.readthedocs.io/en/latest/configopts.html#use-tabchars + "{CMakeLists.txt,*.cmake}" = { + indent_size = 2; + indent_style = "space"; + }; + + # https://github.com/NixOS/rfcs/pull/166 + "*.nix" = { + indent_size = 2; + indent_style = "space"; + }; + + # https://developer.hashicorp.com/terraform/language/syntax/style + "*.{tf,hcl}" = { + indent_size = 2; + indent_style = "space"; + }; + + "*.{json,jsn}" = { + indent_size = 2; + indent_style = "space"; + }; + + # https://yaml.org/spec/1.2.2/#61-indentation-spaces + "*.{yaml,yml}" = { + indent_size = 2; + indent_style = "space"; + }; + + "*.{toml,tml}" = { + indent_size = 2; + indent_style = "space"; + }; + + # https://google.github.io/styleguide/htmlcssguide.html#Indentation + "*.{html,css}" = { + indent_size = 2; + indent_style = "space"; + }; + + # https://latexindentpl.readthedocs.io/en/latest/sec-default-user-local.html + "*.{tex,cls}" = { + indent_size = 4; + indent_style = "tab"; + }; + }; + }; + }; +} diff --git a/modules/common/neovim/default.nix b/modules/common/neovim/default.nix deleted file mode 100644 index 1e5f103..0000000 --- a/modules/common/neovim/default.nix +++ /dev/null @@ -1,27 +0,0 @@ -{ - config, - inputs, - lib, - ... -}: -with lib; let - cfg = config.nixfiles.modules.neovim; -in { - options.nixfiles.modules.neovim.enable = mkEnableOption "NeoVim"; - - config = mkIf cfg.enable { - hm = { - imports = [inputs.nixvim.homeManagerModules.nixvim]; - - programs.nixvim = { - enable = true; - - plugins = { - lsp.enable = true; - nix.enable = true; - surround.enable = true; - }; - }; - }; - }; -} diff --git a/modules/common/profiles/dev/default.nix b/modules/common/profiles/dev/default.nix index 2d0c0f6..ecd586a 100644 --- a/modules/common/profiles/dev/default.nix +++ b/modules/common/profiles/dev/default.nix @@ -20,6 +20,7 @@ in { bat.enable = true; curl.enable = true; direnv.enable = true; + editorconfig.enable = true; git.client.enable = true; gnupg.enable = true; nmap.enable = true; @@ -28,25 +29,9 @@ in { hm.home = { file = { - ".editorconfig".source = ./editorconfig.ini; - ".gdbinit".source = ./gdbinit; ".ghc/ghci.conf".source = ./ghci.conf; - - ".stack/config.yaml".text = generators.toYAML {} { - templates.params = rec { - author-name = my.fullname; - author-email = my.email; - copyright = "Copyright (c) 2023 ${author-name} <${author-email}>"; - github-username = my.username; - }; - }; - - ".stack/global-project/stack.yaml".text = generators.toYAML {} { - packages = []; - resolver = "lts-21.20"; - }; }; sessionVariables = rec { @@ -74,6 +59,7 @@ in { CARGO_HOME = "${config.my.home}/.cargo"; GOPATH = "${config.my.home}/.go"; + GORE_HOME = "${config.my.home}/.gore"; PYTHONSTARTUP = ./pystartup.py; }; diff --git a/modules/common/profiles/dev/editorconfig.ini b/modules/common/profiles/dev/editorconfig.ini deleted file mode 100644 index 87f47eb..0000000 --- a/modules/common/profiles/dev/editorconfig.ini +++ /dev/null @@ -1,96 +0,0 @@ -root = true - -[*] -charset = utf-8 -end_of_line = lf -indent_size = 4 -indent_style = space -insert_final_newline = true -max_line_length = 80 -trim_trailing_whitespace = true - -# C/C++ -[*.{c,cc,cpp,cxx,h,hh,hpp,hxx,ixx}] -indent_size = 4 -indent_style = tab - -# Go -[*.go] -indent_size = 4 -indent_style = tab - -# Python -[*.py] -indent_size = 4 -indent_style = space -max_line_length = 72 - -# Haskell -[*.hs] -indent_size = 2 -indent_style = space - -# Lisp(s) -[*.{lisp,cl,rkt,scm,el}] -indent_size = 2 -indent_style = space - -# Zig -[*.zig] -indent_size = 4 -indent_style = tab - -# Assembly -[*.{asm,s}] -indent_size = 4 -indent_style = tab - -# GNU Cringetools -[configure.ac] -indent_size = 4 -indent_style = tab - -# Make -[{Makefile*,*.mk}] -indent_size = 4 -indent_style = tab - -# CMake -[{CMakeLists.txt,*.cmake}] -indent_size = 8 -indent_style = tab - -# Nix -[*.nix] -indent_size = 2 -indent_style = space - -# HCL -[*.{tf,hcl}] -indent_size = 2 -indent_style = space - -# JSON -[*.json] -indent_size = 2 -indent_style = space - -# YAML -[*.{yaml,yml}] -indent_size = 2 -indent_style = space - -# TOML -[*.{toml,tml}] -indent_size = 4 -indent_style = space - -# Markup -[*.{html,xml}] -indent_size = 4 -indent_style = tab - -# (La)TeX -[*.{tex,cls}] -indent_size = 4 -indent_style = tab diff --git a/modules/common/profiles/headful.nix b/modules/common/profiles/headful.nix index 094d5dd..dc8e1d6 100644 --- a/modules/common/profiles/headful.nix +++ b/modules/common/profiles/headful.nix @@ -19,7 +19,6 @@ in { aria2.enable = true; emacs.enable = true; mpv.enable = true; - neovim.enable = true; openssh.client.enable = true; password-store.enable = true; vscode.enable = true; diff --git a/modules/common/vscode.nix b/modules/common/vscode.nix index 62abcf8..074f6f2 100644 --- a/modules/common/vscode.nix +++ b/modules/common/vscode.nix @@ -241,6 +241,6 @@ in { }; }; - nixpkgs.overlays = [inputs.nix-vscode-extensions.overlays.default]; + nixpkgs.overlays = [inputs.vscode-extensions.overlays.default]; }; } -- cgit 1.4.1