feat: add nix code formatter

This commit is contained in:
matt1432 2023-11-22 15:33:16 -05:00
parent 231fd16756
commit 1fae0a73d3
52 changed files with 725 additions and 617 deletions

View file

@ -1,15 +1,18 @@
{ config, lib, ... }: {
{
config,
lib,
...
}: {
imports = [
./programs.nix
];
programs = {
starship = let
textColor = "#e3e5e5";
firstColor = "#bd93f9";
textColor = "#e3e5e5";
firstColor = "#bd93f9";
secondColor = "#715895";
thirdColor = "#382c4a";
thirdColor = "#382c4a";
fourthColor = "#120e18";
in {
enable = true;
@ -93,10 +96,10 @@
enable = true;
enableCompletion = true;
historyFile = "\$HOME/.cache/.bash_history";
historyFile = "\$HOME/.cache/.bash_history";
historyFileSize = 100000; # default
historySize = 10000; # default
historyControl = [
historySize = 10000; # default
historyControl = [
"erasedups"
"ignorespace"
];
@ -119,29 +122,29 @@
];
shellAliases = {
sudo = "sudo ";
sudo = "sudo ";
frick = "sudo $(fc -ln -1)";
nivm = "nvim";
nivm = "nvim";
nivim = "nvim";
tmux = "tmux -2";
ls = "ls -lah --color=auto";
tree = "tree -a -I node_modules";
cp = "cp -r";
tmux = "tmux -2";
ls = "ls -lah --color=auto";
tree = "tree -a -I node_modules";
cp = "cp -r";
chore = "(cd ~/.nix; git add flake.lock; git commit -m 'chore: update flake.lock'; git push)";
tup = "tailscale up --login-server https://headscale.nelim.org";
tup = "tailscale up --login-server https://headscale.nelim.org";
pc = "mosh matt@binto -- tmux -2u new -At laptop";
pc = "mosh matt@binto -- tmux -2u new -At laptop";
oksys = "mosh matt@oksys -- tmux -2u new -At laptop";
pve = "mosh matt@pve -- tmux -2u new -At laptop";
pve = "mosh matt@pve -- tmux -2u new -At laptop";
mc = "mosh mc@mc -- tmux -2u new -At laptop";
pod = "mosh matt@pve -- ssh -t -p 6768 matt@10.0.0.122 'tmux -2u new -At laptop'";
mc = "mosh mc@mc -- tmux -2u new -At laptop";
pod = "mosh matt@pve -- ssh -t -p 6768 matt@10.0.0.122 'tmux -2u new -At laptop'";
jelly = "mosh matt@pve -- ssh -t matt@10.0.0.123 'tmux -2u new -At laptop'";
qbit = "mosh matt@pve -- ssh -t matt@10.0.0.128 'tmux -2u new -At laptop'";
qbit = "mosh matt@pve -- ssh -t matt@10.0.0.128 'tmux -2u new -At laptop'";
};
sessionVariables = {
# FIXME: why is this not set by home-manager?

View file

@ -1,4 +1,4 @@
{ pkgs, ... }: {
{pkgs, ...}: {
programs = {
fzf = {
enable = true;

View file

@ -1,6 +1,5 @@
{ pkgs, ... }: {
{pkgs, ...}: {
programs = {
git = {
enable = true;
lfs.enable = true;
@ -9,7 +8,7 @@
userEmail = "matt@nelim.org";
includes = [
{ path = "${pkgs.dracula-theme}/git-colors"; }
{path = "${pkgs.dracula-theme}/git-colors";}
];
delta = {
@ -24,11 +23,11 @@
extraConfig.pager = let
cmd = "LESS='LRc --mouse' ${pkgs.delta}/bin/delta";
in {
diff = cmd;
show = cmd;
stash = cmd;
log = cmd;
reflog = cmd;
diff = cmd;
show = cmd;
stash = cmd;
log = cmd;
reflog = cmd;
};
};
};

View file

@ -0,0 +1,2 @@
-- Add `:Format` command to format current buffer
vim.api.nvim_create_user_command("Format", "call CocAction('format')", {})

View file

@ -1,28 +1,32 @@
{ pkgs, lib, ... }: let
{
pkgs,
lib,
...
}: let
# installs a vim plugin from git with a given tag / branch
plugin = owner: repo: rev: hash: pkgs.vimUtils.buildVimPlugin {
pname = "${lib.strings.sanitizeDerivationName repo}";
version = rev;
src = pkgs.fetchFromGitHub {
inherit rev owner repo hash;
plugin = owner: repo: rev: hash:
pkgs.vimUtils.buildVimPlugin {
pname = "${lib.strings.sanitizeDerivationName repo}";
version = rev;
src = pkgs.fetchFromGitHub {
inherit rev owner repo hash;
};
};
};
fileContents = lib.strings.fileContents;
in {
# TODO: make a gradle module and have java in device-vars.nix
xdg.dataFile = {
".gradle/gradle.properties".source =
pkgs.writeText "gradle.properties" ''
org.gradle.java.home = ${pkgs.temurin-bin-17}
'';
".gradle/gradle.properties".source = pkgs.writeText "gradle.properties" ''
org.gradle.java.home = ${pkgs.temurin-bin-17}
'';
};
home.packages = with pkgs; [
gradle
gradle-completion # FIXME: not working
alejandra
];
programs = {
java = {
enable = true;
package = pkgs.temurin-bin-17;
@ -95,8 +99,13 @@ in {
languageserver = {
nix = {
command = "nil";
filetypes = [ "nix" ];
rootPatterns = [ "flake.nix" ];
filetypes = ["nix"];
rootPatterns = ["flake.nix"];
settings = {
nil = {
formatting = {command = ["alejandra"];};
};
};
};
};
@ -107,6 +116,7 @@ in {
};
extraConfig = fileContents ./base.vim;
extraLuaConfig = fileContents ./base.lua;
plugins = with pkgs.vimPlugins; [
# Coc configured
@ -173,9 +183,10 @@ in {
config = fileContents ./plugins/treesitter.vim;
}
{
plugin = (plugin "lukas-reineke" "indent-blankline.nvim"
"046e2cf04e08ece927bacbfb87c5b35c0b636546"
"sha256-bhoep8aTYje5K/dZ/XmpwBPn4PBEMPrmw33QJdfFe6M=");
plugin =
plugin "lukas-reineke" "indent-blankline.nvim"
"046e2cf04e08ece927bacbfb87c5b35c0b636546"
"sha256-bhoep8aTYje5K/dZ/XmpwBPn4PBEMPrmw33QJdfFe6M=";
type = "lua";
config = fileContents ./plugins/indent.lua;
}

View file

@ -1,4 +1,4 @@
{ pkgs, ... }: {
{pkgs, ...}: {
programs = {
tmux = {
enable = true;