nixbook: git config, nixd, format

This commit is contained in:
tristan 2024-10-23 22:53:02 +01:00
parent 7322eaeb6f
commit 3bae7dc77c
6 changed files with 91 additions and 66 deletions

View file

@ -5,6 +5,7 @@
graph = "log --oneline --all --graph"; graph = "log --oneline --all --graph";
amend = "commit --amend --no-edit"; amend = "commit --amend --no-edit";
sdiff = "diff --staged"; sdiff = "diff --staged";
fpush = "push --force-with-lease";
t = "tag --annotate"; t = "tag --annotate";
bclone = "!sh ${pkgs.writeShellScriptBin "bare-clone" '' bclone = "!sh ${pkgs.writeShellScriptBin "bare-clone" ''
url=$1 url=$1

View file

@ -3,12 +3,12 @@
pkgs, pkgs,
lib, lib,
... ...
}: { } @ input: {
programs.nixvim = programs.nixvim =
{ {
enable = true; enable = true;
} }
// (import ../../../lib/nixvim.nix {inherit pkgs;}); // (import ../../../lib/nixvim.nix input);
programs.vscode = { programs.vscode = {
extensions = [pkgs.vscode-extensions.asvetliakov.vscode-neovim]; extensions = [pkgs.vscode-extensions.asvetliakov.vscode-neovim];

View file

@ -15,6 +15,11 @@ in {
email = "tristan.beedell@cryoserver.com"; email = "tristan.beedell@cryoserver.com";
terminal = false; terminal = false;
}; };
programs.git.extraConfig = {
"includeIf \"gitdir:~/Documents/personal/\"" = {
path = "~/Documents/personal/.gitconfig";
};
};
home.packages = [ home.packages = [
pkgs.thunderbird pkgs.thunderbird
@ -31,7 +36,8 @@ in {
desktopName = "Microsoft Teams"; desktopName = "Microsoft Teams";
}) })
pkgs.devcontainer pkgs.devcontainer
(pkgs.writeShellScriptBin "devcontainer-open" (let (pkgs.writeShellScriptBin "devcontainer-open" (
let
jq = "${pkgs.jq}/bin/jq"; jq = "${pkgs.jq}/bin/jq";
devcontainer = "${pkgs.devcontainer}/bin/devcontainer"; devcontainer = "${pkgs.devcontainer}/bin/devcontainer";
in '' in ''
@ -41,7 +47,8 @@ in {
containerId=$(echo $res | ${jq} -r '.containerId') containerId=$(echo $res | ${jq} -r '.containerId')
remoteWorkspaceFolder=$(echo $res | ${jq} -r '.remoteWorkspaceFolder') remoteWorkspaceFolder=$(echo $res | ${jq} -r '.remoteWorkspaceFolder')
docker exec -it --workdir=$remoteWorkspaceFolder $containerId bash docker exec -it --workdir=$remoteWorkspaceFolder $containerId bash
'')) ''
))
]; ];
home.sessionVariables = { home.sessionVariables = {

View file

@ -28,6 +28,7 @@
playerctl playerctl
quickemu quickemu
devenv devenv
logseq
]; ];
services.udiskie = { services.udiskie = {

View file

@ -1,6 +1,11 @@
{pkgs, ...}: let {
pkgs,
lib,
...
}: let
lua = cmd: {__raw = cmd;}; lua = cmd: {__raw = cmd;};
luaFunc = cmd: lua '' luaFunc = cmd:
lua ''
function () function ()
${cmd} ${cmd}
end''; end'';
@ -28,6 +33,8 @@ in {
"extends:>" "extends:>"
"precedes:<" "precedes:<"
]; ];
foldlevel = 2;
}; };
extraPlugins = [(pkgs.vimPlugins.actions-preview-nvim)]; extraPlugins = [(pkgs.vimPlugins.actions-preview-nvim)];
extraConfigLua = '' extraConfigLua = ''
@ -204,9 +211,10 @@ in {
} }
]; ];
autoCmd = [{ autoCmd = [
{
event = "BufWritePre"; event = "BufWritePre";
pattern = "*.go"; pattern = "*";
# https://github.com/golang/tools/blob/master/gopls/doc/vim.md#imports-and-formatting # https://github.com/golang/tools/blob/master/gopls/doc/vim.md#imports-and-formatting
callback = luaFunc '' callback = luaFunc ''
local params = vim.lsp.util.make_range_params() local params = vim.lsp.util.make_range_params()
@ -227,7 +235,8 @@ in {
end end
vim.lsp.buf.format({async = false}) vim.lsp.buf.format({async = false})
''; '';
}]; }
];
plugins = { plugins = {
bufferline.enable = true; bufferline.enable = true;
@ -261,7 +270,15 @@ in {
enable = true; enable = true;
servers = { servers = {
ts-ls.enable = true; ts-ls.enable = true;
nil-ls.enable = true; nixd = {
enable = true;
settings = {
nixpkgs.expr = ''import <nixpkgs> {}'';
options.zenix.expr = ''(builtins.getFlake "git+https://git.tristans.cloud/tristan/nix").nixosConfigurations.zenix.options'';
options.alpine.expr = ''(builtins.getFlake "git+https://git.tristans.cloud/tristan/nix").nixosConfigurations.alpine.options'';
formatting.command = [(lib.getExe pkgs.alejandra)];
};
};
yamlls.enable = true; yamlls.enable = true;
gopls.enable = true; gopls.enable = true;
}; };

View file

@ -1,7 +1,6 @@
{config, ...}: let {config, ...}: let
user = config.user; user = config.user;
in in {
{
users.users.${user}.extraGroups = ["libvirtd" "kvm"]; users.users.${user}.extraGroups = ["libvirtd" "kvm"];
virtualisation.libvirtd = { virtualisation.libvirtd = {
enable = true; enable = true;