diff options
-rw-r--r-- | .config/nixpkgs/config.nix | 15 | ||||
-rw-r--r-- | .config/nixpkgs/packages/rufo/default.nix | 33 | ||||
-rw-r--r-- | .vimrc | 1 |
3 files changed, 46 insertions, 3 deletions
diff --git a/.config/nixpkgs/config.nix b/.config/nixpkgs/config.nix index 13e43aa..f2174b0 100644 --- a/.config/nixpkgs/config.nix +++ b/.config/nixpkgs/config.nix @@ -21,8 +21,8 @@ in name = "woodpecker"; paths = [ Terminal Graphical Xorg Awesome Fonts Audio LaTeX - Android JavaScript Python PHP Lua Elixir Html Shell Haskell - Perl Nix C Golang Rust CSS SQL YAML + Android JavaScript Python PHP Lua Elixir HTML Shell Haskell + Perl Nix C Golang Rust CSS SQL YAML Ruby ]; }; @@ -371,7 +371,7 @@ in paths = [ elixir_1_10 ]; }; - Html = pkgs.buildEnv { + HTML = pkgs.buildEnv { name = "html"; paths = [ html-tidy @@ -401,6 +401,15 @@ in paths = [ nixos-generators nix-index nix-linter nixfmt nixpkgs-fmt nixpkgs-lint ]; }; + Ruby = pkgs.buildEnv { + name = "ruby"; + paths = [ + (callPackage ./packages/rufo/default.nix {}) + rubocop + ruby + ]; + }; + C = pkgs.buildEnv { name = "c"; paths = [ astyle clang-tools gcc gdb gnumake meson ninja ]; diff --git a/.config/nixpkgs/packages/rufo/default.nix b/.config/nixpkgs/packages/rufo/default.nix new file mode 100644 index 0000000..7d0a539 --- /dev/null +++ b/.config/nixpkgs/packages/rufo/default.nix @@ -0,0 +1,33 @@ +{ buildRubyGem, fetchgit, lib, ruby, git }: + +buildRubyGem rec { + + inherit ruby; + gemName = "rufo"; + name = "${gemName}-${version}"; + version = "b3f3aedf759d792761ad52e6bddb9ed51ffc6731"; + + src = fetchgit { + rev = version; + url = "https://github.com/ruby-formatter/rufo.git"; + sha256 = "1z87ivd8xpm3ggbcv3sjr4c0ws6733yfh8l6xg5f0km6ax7s8h1j"; + }; + + buildInputs = [ git ruby ]; + + preBuild = '' + rm spec/fixtures/file_finder/only_gemfiles/a.gemspec + ''; + + preFixup = '' + cp exe/rufo $out/bin/rufo + cp -rT lib $out/lib + ''; + + meta = with lib; { + inherit version; + license = licenses.mit; + description = "The Ruby Formatter"; + homepage = "https://github.com/ruby-formatter/rufo"; + }; +} @@ -304,6 +304,7 @@ augroup AutoCommands " Linting file type post write commands. autocmd FileType css autocmd! BufWritePost <buffer> exe 'Notify(''prettier --write --parser css ' . expand('%') . ' 2>&1'')' | :e + autocmd FileType ruby autocmd! BufWritePost <buffer> exe 'Notify(''rufo ' . expand('%') . ' 2>&1 && rubocop ' . expand('%') . ' 2>&1'')' | :e autocmd FileType rust autocmd! BufWritePost <buffer> exe 'Notify(''rustfmt ' . expand('%') . ' 2>&1 && printf "rustfmt OK: ' . expand('%') . '"'')' | :e autocmd FileType json autocmd! BufWritePost <buffer> exe 'Notify(''jsonlint -i ' . expand('%') . ' 2>&1 && printf "JSON OK: ' . expand('%') . '"'')' | :e autocmd FileType haskell autocmd! BufWritePost <buffer> exe 'Notify(''hlint ' . expand('%') . ' 2>&1 && brittany --write-mode inplace ' . expand('%') . ' 2>&1'')' | :e |