nixbook: git config, nixd, format
This commit is contained in:
parent
7322eaeb6f
commit
3bae7dc77c
6 changed files with 91 additions and 66 deletions
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -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];
|
||||||
|
|
|
||||||
|
|
@ -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,17 +36,19 @@ in {
|
||||||
desktopName = "Microsoft Teams";
|
desktopName = "Microsoft Teams";
|
||||||
})
|
})
|
||||||
pkgs.devcontainer
|
pkgs.devcontainer
|
||||||
(pkgs.writeShellScriptBin "devcontainer-open" (let
|
(pkgs.writeShellScriptBin "devcontainer-open" (
|
||||||
jq = "${pkgs.jq}/bin/jq";
|
let
|
||||||
devcontainer = "${pkgs.devcontainer}/bin/devcontainer";
|
jq = "${pkgs.jq}/bin/jq";
|
||||||
in ''
|
devcontainer = "${pkgs.devcontainer}/bin/devcontainer";
|
||||||
res=$(${devcontainer} up --workspace-folder .)
|
in ''
|
||||||
outcome=$(echo $res | ${jq} -r '.outcome')
|
res=$(${devcontainer} up --workspace-folder .)
|
||||||
[[ $outcome = "success" ]] || exit 1
|
outcome=$(echo $res | ${jq} -r '.outcome')
|
||||||
containerId=$(echo $res | ${jq} -r '.containerId')
|
[[ $outcome = "success" ]] || exit 1
|
||||||
remoteWorkspaceFolder=$(echo $res | ${jq} -r '.remoteWorkspaceFolder')
|
containerId=$(echo $res | ${jq} -r '.containerId')
|
||||||
docker exec -it --workdir=$remoteWorkspaceFolder $containerId bash
|
remoteWorkspaceFolder=$(echo $res | ${jq} -r '.remoteWorkspaceFolder')
|
||||||
''))
|
docker exec -it --workdir=$remoteWorkspaceFolder $containerId bash
|
||||||
|
''
|
||||||
|
))
|
||||||
];
|
];
|
||||||
|
|
||||||
home.sessionVariables = {
|
home.sessionVariables = {
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@
|
||||||
playerctl
|
playerctl
|
||||||
quickemu
|
quickemu
|
||||||
devenv
|
devenv
|
||||||
|
logseq
|
||||||
];
|
];
|
||||||
|
|
||||||
services.udiskie = {
|
services.udiskie = {
|
||||||
|
|
@ -37,7 +38,7 @@
|
||||||
|
|
||||||
programs.rbw.settings.pinentry = pkgs.pinentry-gnome3;
|
programs.rbw.settings.pinentry = pkgs.pinentry-gnome3;
|
||||||
|
|
||||||
# https://docs.pipewire.org/page_module_raop_discover.html
|
# https://docs.pipewire.org/page_module_raop_discover.html
|
||||||
xdg.configFile."pipewire/pipewire.conf.d/raop-discover.conf".text = ''
|
xdg.configFile."pipewire/pipewire.conf.d/raop-discover.conf".text = ''
|
||||||
context.modules = [
|
context.modules = [
|
||||||
{
|
{
|
||||||
|
|
@ -47,28 +48,28 @@
|
||||||
]
|
]
|
||||||
'';
|
'';
|
||||||
xdg.configFile."pipewire/pipewire.conf.d/raop-sink.conf".text = ''
|
xdg.configFile."pipewire/pipewire.conf.d/raop-sink.conf".text = ''
|
||||||
context.modules = [
|
context.modules = [
|
||||||
{ name = libpipewire-module-raop-sink
|
{ name = libpipewire-module-raop-sink
|
||||||
args = {
|
args = {
|
||||||
# Set the remote address to tunnel to
|
# Set the remote address to tunnel to
|
||||||
raop.ip = "127.0.0.1"
|
raop.ip = "127.0.0.1"
|
||||||
raop.port = 8190
|
raop.port = 8190
|
||||||
raop.name = "my-raop-device"
|
raop.name = "my-raop-device"
|
||||||
raop.hostname = "My Service"
|
raop.hostname = "My Service"
|
||||||
#raop.transport = "udp"
|
#raop.transport = "udp"
|
||||||
raop.encryption.type = "RSA"
|
raop.encryption.type = "RSA"
|
||||||
#raop.audio.codec = "PCM"
|
#raop.audio.codec = "PCM"
|
||||||
#raop.password = "****"
|
#raop.password = "****"
|
||||||
#audio.format = "S16"
|
#audio.format = "S16"
|
||||||
#audio.rate = 44100
|
#audio.rate = 44100
|
||||||
#audio.channels = 2
|
#audio.channels = 2
|
||||||
#audio.position = [ FL FR ]
|
#audio.position = [ FL FR ]
|
||||||
stream.props = {
|
stream.props = {
|
||||||
# extra sink properties
|
# extra sink properties
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
'';
|
'';
|
||||||
|
|
||||||
services.gnome-keyring.enable = true;
|
services.gnome-keyring.enable = true;
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,14 @@
|
||||||
{pkgs, ...}: let
|
{
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
lua = cmd: {__raw = cmd;};
|
lua = cmd: {__raw = cmd;};
|
||||||
luaFunc = cmd: lua ''
|
luaFunc = cmd:
|
||||||
function ()
|
lua ''
|
||||||
${cmd}
|
function ()
|
||||||
end'';
|
${cmd}
|
||||||
|
end'';
|
||||||
in {
|
in {
|
||||||
globals = {
|
globals = {
|
||||||
mapleader = " ";
|
mapleader = " ";
|
||||||
|
|
@ -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,30 +211,32 @@ in {
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
autoCmd = [{
|
autoCmd = [
|
||||||
event = "BufWritePre";
|
{
|
||||||
pattern = "*.go";
|
event = "BufWritePre";
|
||||||
# https://github.com/golang/tools/blob/master/gopls/doc/vim.md#imports-and-formatting
|
pattern = "*";
|
||||||
callback = luaFunc ''
|
# https://github.com/golang/tools/blob/master/gopls/doc/vim.md#imports-and-formatting
|
||||||
local params = vim.lsp.util.make_range_params()
|
callback = luaFunc ''
|
||||||
params.context = {only = {"source.organizeImports"}}
|
local params = vim.lsp.util.make_range_params()
|
||||||
-- buf_request_sync defaults to a 1000ms timeout. Depending on your
|
params.context = {only = {"source.organizeImports"}}
|
||||||
-- machine and codebase, you may want longer. Add an additional
|
-- buf_request_sync defaults to a 1000ms timeout. Depending on your
|
||||||
-- argument after params if you find that you have to write the file
|
-- machine and codebase, you may want longer. Add an additional
|
||||||
-- twice for changes to be saved.
|
-- argument after params if you find that you have to write the file
|
||||||
-- E.g., vim.lsp.buf_request_sync(0, "textDocument/codeAction", params, 3000)
|
-- twice for changes to be saved.
|
||||||
local result = vim.lsp.buf_request_sync(0, "textDocument/codeAction", params)
|
-- E.g., vim.lsp.buf_request_sync(0, "textDocument/codeAction", params, 3000)
|
||||||
for cid, res in pairs(result or {}) do
|
local result = vim.lsp.buf_request_sync(0, "textDocument/codeAction", params)
|
||||||
for _, r in pairs(res.result or {}) do
|
for cid, res in pairs(result or {}) do
|
||||||
if r.edit then
|
for _, r in pairs(res.result or {}) do
|
||||||
local enc = (vim.lsp.get_client_by_id(cid) or {}).offset_encoding or "utf-16"
|
if r.edit then
|
||||||
vim.lsp.util.apply_workspace_edit(r.edit, enc)
|
local enc = (vim.lsp.get_client_by_id(cid) or {}).offset_encoding or "utf-16"
|
||||||
|
vim.lsp.util.apply_workspace_edit(r.edit, enc)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
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;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue