apply nix-fmt

This commit is contained in:
John Bowdre 2024-12-19 19:30:06 -06:00
parent 1c79db0b42
commit 24472642b0
Signed by: john
SSH key fingerprint: SHA256:cZYnOxaLdo+MhBNMX38ihO/p2Kek6fBykSFoJwHBhUo
60 changed files with 335 additions and 451 deletions

View file

@ -47,8 +47,7 @@
systems = [ "x86_64-linux" "aarch64-linux" ]; systems = [ "x86_64-linux" "aarch64-linux" ];
forEachSystem = f: lib.genAttrs systems (sys: f pkgsFor.${sys}); forEachSystem = f: lib.genAttrs systems (sys: f pkgsFor.${sys});
pkgsFor = nixpkgs.legacyPackages; pkgsFor = nixpkgs.legacyPackages;
in in {
{
inherit lib; inherit lib;
nixosModules = import ./modules/nixos; nixosModules = import ./modules/nixos;
homeManagerModules = import ./modules/home-manager; homeManagerModules = import ./modules/home-manager;

View file

@ -1,7 +1,6 @@
{ inputs, outputs, lib, config, pkgs, ... }: { { outputs, lib, config, pkgs, ... }: {
imports = [ imports = [ ../modules/tui ]
../modules/tui ++ (builtins.attrValues outputs.homeManagerModules);
] ++ (builtins.attrValues outputs.homeManagerModules);
nixpkgs = { nixpkgs = {
overlays = builtins.attrValues outputs.overlays; overlays = builtins.attrValues outputs.overlays;
@ -14,7 +13,7 @@
nix = { nix = {
package = lib.mkDefault pkgs.nix; package = lib.mkDefault pkgs.nix;
settings = { settings = {
experimental-features = ["nix-command" "flakes" ]; experimental-features = [ "nix-command" "flakes" ];
warn-dirty = false; warn-dirty = false;
}; };
}; };
@ -24,9 +23,7 @@
homeDirectory = lib.mkDefault "/home/${config.home.username}"; homeDirectory = lib.mkDefault "/home/${config.home.username}";
stateVersion = lib.mkDefault "24.11"; stateVersion = lib.mkDefault "24.11";
sessionVariables = { sessionVariables = { EDITOR = "nvim"; };
EDITOR = "nvim";
};
}; };
programs = { programs = {

View file

@ -1,10 +1,6 @@
{ inputs, outputs, lib, config, pkgs, ... }: { { ... }: {
imports = [ imports = [ ../global ];
../global
];
# packages # packages
home.packages = with pkgs; [ # home.packages = with pkgs; [ ];
];
} }

View file

@ -1,4 +1,4 @@
{ pkgs, lib, config, ... }: { { ... }: {
imports = [ imports = [
../global ../global
../modules/tui/extras ../modules/tui/extras
@ -7,6 +7,5 @@
]; ];
# packages # packages
home.packages = with pkgs; [ # home.packages = with pkgs; [ ];
];
} }

View file

@ -1,13 +1,10 @@
{ inputs, outputs, lib, config, pkgs, ... }: { { pkgs, ... }: {
imports = [ imports =
../global [ ../global ../modules/tui/extras ../modules/gui ../lib/chromeos.nix ];
../modules/tui/extras
../modules/gui
../lib/chromeos.nix
];
# extra packages # extra packages
home.packages = with pkgs; [ home.packages = with pkgs;
[
dive # Explore docker images dive # Explore docker images
]; ];
} }

View file

@ -1,4 +1,4 @@
{ inputs, outputs, lib, config, pkgs, ... }: { { pkgs, ... }: {
imports = [ imports = [
../global ../global
../modules/tui/extras ../modules/tui/extras
@ -7,7 +7,5 @@
]; ];
# packages # packages
home.packages = with pkgs; [ home.packages = with pkgs; [ vagrant ];
vagrant
];
} }

View file

@ -1,5 +1 @@
{ pkgs, inputs, outputs, lib, ... }: { { pkgs, ... }: { home.packages = with pkgs; [ google-chrome ]; }
home.packages = with pkgs; [
google-chrome
];
}

View file

@ -1,14 +1,6 @@
{ pkgs, ... }: { { pkgs, ... }: {
# Common GUI apps # Common GUI apps
imports = [ imports = [ ./firefox.nix ./vscode.nix ];
./firefox.nix
./vscode.nix
];
home.packages = with pkgs; [ home.packages = with pkgs; [ gimp-with-plugins lagrange qFlipper remmina ];
gimp-with-plugins
lagrange
qFlipper
remmina
];
} }

View file

@ -1,4 +1,4 @@
{ pkgs, lib, inputs, ... }: { pkgs, inputs, ... }:
let let
addons = inputs.firefox-addons.packages.${pkgs.system}; addons = inputs.firefox-addons.packages.${pkgs.system};

View file

@ -1,15 +1,14 @@
{ config, outputs, pkgs, lib, ... }: { { config, pkgs, ... }: {
home.packages = with pkgs; [ home.packages = with pkgs; [ hadolint ];
hadolint
];
programs.vscode = { programs.vscode = {
enable = true; enable = true;
enableExtensionUpdateCheck = false; enableExtensionUpdateCheck = false;
enableUpdateCheck = false; enableUpdateCheck = false;
package = pkgs.vscode; package = pkgs.vscode;
extensions = with pkgs.vscode-extensions; [ extensions = with pkgs.vscode-extensions;
[
# extensions available as nix packages # extensions available as nix packages
bbenoist.nix bbenoist.nix
github.vscode-github-actions github.vscode-github-actions
@ -72,18 +71,21 @@
]; ];
globalSnippets = { globalSnippets = {
"Insert datestamp" = { "Insert datestamp" = {
prefix = ["date"]; prefix = [ "date" ];
body = ["\"\${CURRENT_YEAR}-\${CURRENT_MONTH}-\${CURRENT_DATE}\""]; body = [ ''"''${CURRENT_YEAR}-''${CURRENT_MONTH}-''${CURRENT_DATE}"'' ];
description = "Insert date"; description = "Insert date";
}; };
"Insert timestamp" = { "Insert timestamp" = {
prefix = ["datetime"]; prefix = [ "datetime" ];
body = ["\"\${CURRENT_YEAR}-\${CURRENT_MONTH}-\${CURRENT_DATE}T\${CURRENT_HOUR}:\${CURRENT_MINUTE}:\${CURRENT_SECOND}Z\""]; body = [
''
"''${CURRENT_YEAR}-''${CURRENT_MONTH}-''${CURRENT_DATE}T''${CURRENT_HOUR}:''${CURRENT_MINUTE}:''${CURRENT_SECOND}Z"''
];
description = "Insert date and time"; description = "Insert date and time";
}; };
"Torchlight line number markup" = { "Torchlight line number markup" = {
prefix = ["torchlight"]; prefix = [ "torchlight" ];
body = ["torchlight! {\"lineNumbers\":true}"]; body = [ ''torchlight! {"lineNumbers":true}'' ];
description = "Enable Torchlight line numbers"; description = "Enable Torchlight line numbers";
}; };
}; };
@ -91,100 +93,95 @@
{ {
key = "backspace"; key = "backspace";
command = "-markdown.extension.onBackspaceKey"; command = "-markdown.extension.onBackspaceKey";
when = "editorTextFocus && !editorHasMultipleSelections && !editorReadonly && !markdown.extension.editor.cursor.inFencedCodeBlock && !markdown.extension.editor.cursor.inMathEnv && !suggestWidgetVisible && vim.mode != 'CommandlineInProgress' && vim.mode != 'EasyMotionInputMode' && vim.mode != 'EasyMotionMode' && vim.mode != 'Normal' && vim.mode != 'Replace' && vim.mode != 'SearchInProgressMode' && vim.mode != 'SurroundInputMode' && vim.mode != 'Visual' && vim.mode != 'VisualBlock' && vim.mode != 'VisualLine' && editorLangId =~ /^markdown$|^rmd$|^quarto$/"; when =
"editorTextFocus && !editorHasMultipleSelections && !editorReadonly && !markdown.extension.editor.cursor.inFencedCodeBlock && !markdown.extension.editor.cursor.inMathEnv && !suggestWidgetVisible && vim.mode != 'CommandlineInProgress' && vim.mode != 'EasyMotionInputMode' && vim.mode != 'EasyMotionMode' && vim.mode != 'Normal' && vim.mode != 'Replace' && vim.mode != 'SearchInProgressMode' && vim.mode != 'SurroundInputMode' && vim.mode != 'Visual' && vim.mode != 'VisualBlock' && vim.mode != 'VisualLine' && editorLangId =~ /^markdown$|^rmd$|^quarto$/";
} }
{ {
key = "ctrl+shift+alt+down"; key = "ctrl+shift+alt+down";
command = "-markdown.extension.onCopyLineDown"; command = "-markdown.extension.onCopyLineDown";
when = "editorTextFocus && !editorReadonly && !suggestWidgetVisible && editorLangId =~ /^markdown$|^rmd$|^quarto$/"; when =
"editorTextFocus && !editorReadonly && !suggestWidgetVisible && editorLangId =~ /^markdown$|^rmd$|^quarto$/";
} }
{ {
key = "ctrl+shift+alt+up"; key = "ctrl+shift+alt+up";
command = "-markdown.extension.onCopyLineUp"; command = "-markdown.extension.onCopyLineUp";
when = "editorTextFocus && !editorReadonly && !suggestWidgetVisible && editorLangId =~ /^markdown$|^rmd$|^quarto$/"; when =
"editorTextFocus && !editorReadonly && !suggestWidgetVisible && editorLangId =~ /^markdown$|^rmd$|^quarto$/";
} }
{ {
key = "ctrl+enter"; key = "ctrl+enter";
command = "-markdown.extension.onCtrlEnterKey"; command = "-markdown.extension.onCtrlEnterKey";
when = "editorTextFocus && !editorHasMultipleSelections && !editorReadonly && !markdown.extension.editor.cursor.inFencedCodeBlock && !markdown.extension.editor.cursor.inMathEnv && !suggestWidgetVisible && editorLangId =~ /^markdown$|^rmd$|^quarto$/"; when =
"editorTextFocus && !editorHasMultipleSelections && !editorReadonly && !markdown.extension.editor.cursor.inFencedCodeBlock && !markdown.extension.editor.cursor.inMathEnv && !suggestWidgetVisible && editorLangId =~ /^markdown$|^rmd$|^quarto$/";
} }
{ {
key = "enter"; key = "enter";
command = "-markdown.extension.onEnterKey"; command = "-markdown.extension.onEnterKey";
when = "editorTextFocus && !editorHasMultipleSelections && !editorReadonly && !markdown.extension.editor.cursor.inFencedCodeBlock && !markdown.extension.editor.cursor.inMathEnv && !suggestWidgetVisible && vim.mode != 'CommandlineInProgress' && vim.mode != 'EasyMotionInputMode' && vim.mode != 'EasyMotionMode' && vim.mode != 'Normal' && vim.mode != 'Replace' && vim.mode != 'SearchInProgressMode' && vim.mode != 'SurroundInputMode' && vim.mode != 'Visual' && vim.mode != 'VisualBlock' && vim.mode != 'VisualLine' && editorLangId =~ /^markdown$|^rmd$|^quarto$/"; when =
"editorTextFocus && !editorHasMultipleSelections && !editorReadonly && !markdown.extension.editor.cursor.inFencedCodeBlock && !markdown.extension.editor.cursor.inMathEnv && !suggestWidgetVisible && vim.mode != 'CommandlineInProgress' && vim.mode != 'EasyMotionInputMode' && vim.mode != 'EasyMotionMode' && vim.mode != 'Normal' && vim.mode != 'Replace' && vim.mode != 'SearchInProgressMode' && vim.mode != 'SurroundInputMode' && vim.mode != 'Visual' && vim.mode != 'VisualBlock' && vim.mode != 'VisualLine' && editorLangId =~ /^markdown$|^rmd$|^quarto$/";
} }
{ {
key = "ctrl+]"; key = "ctrl+]";
command = "-markdown.extension.onIndentLines"; command = "-markdown.extension.onIndentLines";
when = "editorTextFocus && !suggestWidgetVisible && editorLangId =~ /^markdown$|^rmd$|^quarto$/"; when =
"editorTextFocus && !suggestWidgetVisible && editorLangId =~ /^markdown$|^rmd$|^quarto$/";
} }
{ {
key = "alt+down"; key = "alt+down";
command = "-markdown.extension.onMoveLineDown"; command = "-markdown.extension.onMoveLineDown";
when = "editorTextFocus && !editorReadonly && !suggestWidgetVisible && editorLangId =~ /^markdown$|^rmd$|^quarto$/"; when =
"editorTextFocus && !editorReadonly && !suggestWidgetVisible && editorLangId =~ /^markdown$|^rmd$|^quarto$/";
} }
{ {
key = "alt+up"; key = "alt+up";
command = "-markdown.extension.onMoveLineUp"; command = "-markdown.extension.onMoveLineUp";
when = "editorTextFocus && !editorReadonly && !suggestWidgetVisible && editorLangId =~ /^markdown$|^rmd$|^quarto$/"; when =
"editorTextFocus && !editorReadonly && !suggestWidgetVisible && editorLangId =~ /^markdown$|^rmd$|^quarto$/";
} }
{ {
key = "ctrl+["; key = "ctrl+[";
command = "-markdown.extension.onOutdentLines"; command = "-markdown.extension.onOutdentLines";
when = "editorTextFocus && !suggestWidgetVisible && editorLangId =~ /^markdown$|^rmd$|^quarto$/"; when =
"editorTextFocus && !suggestWidgetVisible && editorLangId =~ /^markdown$|^rmd$|^quarto$/";
} }
{ {
key = "shift+enter"; key = "shift+enter";
command = "-markdown.extension.onShiftEnterKey"; command = "-markdown.extension.onShiftEnterKey";
when = "editorTextFocus && !editorHasMultipleSelections && !editorReadonly && !markdown.extension.editor.cursor.inFencedCodeBlock && !markdown.extension.editor.cursor.inMathEnv && !suggestWidgetVisible && editorLangId =~ /^markdown$|^rmd$|^quarto$/"; when =
"editorTextFocus && !editorHasMultipleSelections && !editorReadonly && !markdown.extension.editor.cursor.inFencedCodeBlock && !markdown.extension.editor.cursor.inMathEnv && !suggestWidgetVisible && editorLangId =~ /^markdown$|^rmd$|^quarto$/";
} }
{ {
key = "shift+tab"; key = "shift+tab";
command = "-markdown.extension.onShiftTabKey"; command = "-markdown.extension.onShiftTabKey";
when = "editorTextFocus && markdown.extension.editor.cursor.inList && !editorHasMultipleSelections && !editorReadonly && !editorTabMovesFocus && !hasOtherSuggestions && !hasSnippetCompletions && !inSnippetMode && !markdown.extension.editor.cursor.inFencedCodeBlock && !markdown.extension.editor.cursor.inMathEnv && !suggestWidgetVisible && editorLangId =~ /^markdown$|^rmd$|^quarto$/"; when =
"editorTextFocus && markdown.extension.editor.cursor.inList && !editorHasMultipleSelections && !editorReadonly && !editorTabMovesFocus && !hasOtherSuggestions && !hasSnippetCompletions && !inSnippetMode && !markdown.extension.editor.cursor.inFencedCodeBlock && !markdown.extension.editor.cursor.inMathEnv && !suggestWidgetVisible && editorLangId =~ /^markdown$|^rmd$|^quarto$/";
} }
{ {
key = "tab"; key = "tab";
command = "-markdown.extension.onTabKey"; command = "-markdown.extension.onTabKey";
when = "editorTextFocus && markdown.extension.editor.cursor.inList && !editorHasMultipleSelections && !editorReadonly && !editorTabMovesFocus && !hasOtherSuggestions && !hasSnippetCompletions && !inSnippetMode && !inlineSuggestionVisible && !markdown.extension.editor.cursor.inFencedCodeBlock && !markdown.extension.editor.cursor.inMathEnv && !suggestWidgetVisible && editorLangId =~ /^markdown$|^rmd$|^quarto$/"; when =
"editorTextFocus && markdown.extension.editor.cursor.inList && !editorHasMultipleSelections && !editorReadonly && !editorTabMovesFocus && !hasOtherSuggestions && !hasSnippetCompletions && !inSnippetMode && !inlineSuggestionVisible && !markdown.extension.editor.cursor.inFencedCodeBlock && !markdown.extension.editor.cursor.inMathEnv && !suggestWidgetVisible && editorLangId =~ /^markdown$|^rmd$|^quarto$/";
} }
]; ];
languageSnippets = { languageSnippets = {
jinja-yaml = { jinja-yaml = {
"Insert SLS header" = { "Insert SLS header" = {
isFileTemplate = true; isFileTemplate = true;
prefix = ["sls"]; prefix = [ "sls" ];
body = [ body = [ "# -*- coding: utf-8 -*-" "# vim: ft=yaml" "---" "$0" ];
"# -*- coding: utf-8 -*-"
"# vim: ft=yaml"
"---"
"\$0"
];
}; };
}; };
jinja-html = { jinja-html = {
"Insert jinja header" = { "Insert jinja header" = {
isFileTemplate = true; isFileTemplate = true;
prefix = ["jinja"]; prefix = [ "jinja" ];
body = [ body = [ "# -*- coding: utf-8 -*-" "# vim: ft=jinja" "$0" ];
"# -*- coding: utf-8 -*-"
"# vim: ft=jinja"
"\$0"
];
}; };
}; };
}; };
userSettings = { userSettings = {
"autoalign.moveableItems" = [ "autoalign.moveableItems" = [ "=" ":" "+=" "-=" ];
"=" "autoalign.nonMoveableItemsAdditional" = [ "ks=" "ds=" ];
":"
"+="
"-="
];
"autoalign.nonMoveableItemsAdditional" = [
"ks="
"ds="
];
"diffEditor.ignoreTrimWhitespace" = false; "diffEditor.ignoreTrimWhitespace" = false;
"editor.acceptSuggestionOnCommitCharacter" = false; "editor.acceptSuggestionOnCommitCharacter" = false;
"editor.acceptSuggestionOnEnter" = "off"; "editor.acceptSuggestionOnEnter" = "off";
@ -219,19 +216,15 @@
"powershell.promptToUpdatePowerShell" = false; "powershell.promptToUpdatePowerShell" = false;
"security.workspace.trust.untrustedFiles" = "open"; "security.workspace.trust.untrustedFiles" = "open";
"update.mode" = "none"; "update.mode" = "none";
"vim.normalModeKeyBindings" = [ "vim.normalModeKeyBindings" = [{
{ "after" = [ "@q" ];
"after" = ["@q"]; "before" = [ "Q" ];
"before" = ["Q"]; }];
}
];
"vim.statusBarColorControl" = false; "vim.statusBarColorControl" = false;
"vim.useCtrlKeys" = false; "vim.useCtrlKeys" = false;
"window.restoreWindows" = "none"; "window.restoreWindows" = "none";
"workbench.startupEditor" = "none"; "workbench.startupEditor" = "none";
"yaml.customTags" = [ "yaml.customTags" = [ "!reference sequence" ];
"!reference sequence"
];
"[markdown]" = { "[markdown]" = {
"editor.defaultFormatter" = "yzhang.markdown-all-in-one"; "editor.defaultFormatter" = "yzhang.markdown-all-in-one";
"editor.quickSuggestions" = { "editor.quickSuggestions" = {

View file

@ -1,14 +1,7 @@
{ pkgs, ... }: { { pkgs, ... }: {
# Core CLI apps # Core CLI apps
imports = [ imports = [ ./git.nix ./shell ./nix-index.nix ./neovim ./tmux.nix ./vim.nix ];
./git.nix
./shell
./nix-index.nix
./neovim
./tmux.nix
./vim.nix
];
home.packages = with pkgs; [ home.packages = with pkgs; [
apg # Automatic password generator apg # Automatic password generator

View file

@ -1,10 +1,7 @@
{ pkgs, ... }: { { pkgs, ... }: {
# Extra CLI apps # Extra CLI apps
imports = [ imports = [ ../default.nix ./go.nix ];
../default.nix
./go.nix
];
home.packages = with pkgs; [ home.packages = with pkgs; [
android-tools # Android SDK android-tools # Android SDK
@ -20,12 +17,8 @@
]; ];
programs.fish = { programs.fish = {
shellAbbrs = rec { shellAbbrs = rec { k = "kubectl"; };
k = "kubectl";
};
functions = { functions = { nugo = "hugo new content/posts/$argv/index.md"; };
nugo = "hugo new content/posts/$argv/index.md";
};
}; };
} }

View file

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

View file

@ -1,8 +1,6 @@
{ lib, ... }: { lib, ... }:
let let email = lib.concatStringsSep "" [ "john@bo" "wdre.net" ];
email = lib.concatStringsSep "" [ "john@bo" "wdre.net" ]; in {
in
{
programs.git = { programs.git = {
enable = lib.mkDefault true; enable = lib.mkDefault true;
delta.enable = true; delta.enable = true;
@ -19,4 +17,4 @@
user.signingKey = "~/.ssh/id_ed25519.pub"; user.signingKey = "~/.ssh/id_ed25519.pub";
}; };
}; };
} }

View file

@ -16,18 +16,14 @@
# Enable spellcheck for some filetypes # Enable spellcheck for some filetypes
{ {
event = "FileType"; event = "FileType";
pattern = [ pattern = [ "markdown" ];
"markdown"
];
command = "setlocal spell spelllang=en"; command = "setlocal spell spelllang=en";
} }
# Enable wrap for some filetypes # Enable wrap for some filetypes
{ {
event = "FileType"; event = "FileType";
pattern = [ pattern = [ "markdown" ];
"markdown"
];
command = "setlocal wrap linebreak"; command = "setlocal wrap linebreak";
} }
]; ];

View file

@ -1,6 +1,6 @@
{ {
programs.nixvim = { programs.nixvim = {
opts.completeopt = ["menu" "menuone" "noselect"]; opts.completeopt = [ "menu" "menuone" "noselect" ];
plugins = { plugins = {
luasnip.enable = true; luasnip.enable = true;
@ -25,7 +25,8 @@
enable = true; enable = true;
settings = { settings = {
snippet.expand = "function(args) require('luasnip').lsp_expand(args.body) end"; snippet.expand =
"function(args) require('luasnip').lsp_expand(args.body) end";
mapping = { mapping = {
"<C-d>" = "cmp.mapping.scroll_docs(-4)"; "<C-d>" = "cmp.mapping.scroll_docs(-4)";
@ -33,15 +34,16 @@
"<C-Space>" = "cmp.mapping.complete()"; "<C-Space>" = "cmp.mapping.complete()";
"<C-e>" = "cmp.mapping.close()"; "<C-e>" = "cmp.mapping.close()";
"<Tab>" = "cmp.mapping(cmp.mapping.select_next_item(), {'i', 's'})"; "<Tab>" = "cmp.mapping(cmp.mapping.select_next_item(), {'i', 's'})";
"<S-Tab>" = "cmp.mapping(cmp.mapping.select_prev_item(), {'i', 's'})"; "<S-Tab>" =
"cmp.mapping(cmp.mapping.select_prev_item(), {'i', 's'})";
"<CR>" = "cmp.mapping.confirm({ select = true })"; "<CR>" = "cmp.mapping.confirm({ select = true })";
}; };
sources = [ sources = [
{name = "path";} { name = "path"; }
{name = "nvim_lsp";} { name = "nvim_lsp"; }
{name = "luasnip";} { name = "luasnip"; }
{name = "nixpkgs_maintainers";} { name = "nixpkgs_maintainers"; }
{ {
name = "buffer"; name = "buffer";
# words from other open buffers can also be suggested # words from other open buffers can also be suggested

View file

@ -17,10 +17,7 @@
performance = { performance = {
combinePlugins = { combinePlugins = {
enable = true; enable = true;
standalonePlugins = [ standalonePlugins = [ "hmts.nvim" "nvim-treesitter" ];
"hmts.nvim"
"nvim-treesitter"
];
}; };
byteCompileLua.enable = true; byteCompileLua.enable = true;
}; };

View file

@ -6,13 +6,10 @@
}; };
keymaps = let keymaps = let
normal = normal = lib.mapAttrsToList (key: action: {
lib.mapAttrsToList
(key: action: {
mode = "n"; mode = "n";
inherit action key; inherit action key;
}) }) {
{
"<Space>" = "<NOP>"; "<Space>" = "<NOP>";
# Esc to clear search results # Esc to clear search results
@ -46,13 +43,10 @@
"<M-k>" = ":move-2<CR>"; "<M-k>" = ":move-2<CR>";
"<M-j>" = ":move+<CR>"; "<M-j>" = ":move+<CR>";
}; };
visual = visual = lib.mapAttrsToList (key: action: {
lib.mapAttrsToList
(key: action: {
mode = "v"; mode = "v";
inherit action key; inherit action key;
}) }) {
{
# better indenting # better indenting
">" = ">gv"; ">" = ">gv";
"<" = "<gv"; "<" = "<gv";
@ -66,19 +60,14 @@
# sort # sort
"<leader>s" = ":sort<CR>"; "<leader>s" = ":sort<CR>";
}; };
insert = insert = lib.mapAttrsToList (key: action: {
lib.mapAttrsToList
(key: action: {
mode = "i"; mode = "i";
inherit action key; inherit action key;
}) }) {
{
# Save by Ctrl+s # Save by Ctrl+s
"<C-s>" = "<Esc>:w<CR>"; "<C-s>" = "<Esc>:w<CR>";
}; };
in in config.lib.nixvim.keymaps.mkKeymaps { options.silent = true; }
config.lib.nixvim.keymaps.mkKeymaps
{options.silent = true;}
(normal ++ visual ++ insert); (normal ++ visual ++ insert);
}; };
} }

View file

@ -1,9 +1,7 @@
{ {
programs.nixvim = { programs.nixvim = {
clipboard = { clipboard = {
providers = { providers = { xsel.enable = true; };
xsel.enable = true;
};
register = "unnamed"; register = "unnamed";
}; };
@ -14,11 +12,15 @@
cursorline = true; # highlight the screen line of the cursor cursorline = true; # highlight the screen line of the cursor
expandtab = true; # expand <Tab> to spaces in Insert mode expandtab = true; # expand <Tab> to spaces in Insert mode
fileencoding = "utf-8"; # file-content encoding for the current buffer fileencoding = "utf-8"; # file-content encoding for the current buffer
foldlevel = 99; # folds with a level higher than this number will be closed foldlevel =
99; # folds with a level higher than this number will be closed
hidden = true; # Keep closed buffer open in the background hidden = true; # Keep closed buffer open in the background
ignorecase = true; # when search query is lowercase match both lower and upper patterns ignorecase =
inccommand = "split"; # search and replace: preview changes in quickfix list true; # when search query is lowercase match both lower and upper patterns
incsearch = true; # incremental search: show match for partly typed search command inccommand =
"split"; # search and replace: preview changes in quickfix list
incsearch =
true; # incremental search: show match for partly typed search command
laststatus = 3; # when to use a status line for the last window laststatus = 3; # when to use a status line for the last window
modeline = true; # tags such as 'vim:ft=sh' modeline = true; # tags such as 'vim:ft=sh'
modelines = 5; # check first and last five lines for modelines modelines = 5; # check first and last five lines for modelines
@ -29,14 +31,16 @@
scrolloff = 8; # number of lines to show around the cursor scrolloff = 8; # number of lines to show around the cursor
shiftwidth = 2; # number of spaces used for each step of (auto)indent shiftwidth = 2; # number of spaces used for each step of (auto)indent
signcolumn = "yes"; # whether to show the signcolumn signcolumn = "yes"; # whether to show the signcolumn
smartcase = true; # override ignorecase if search pattern containers upper case smartcase =
true; # override ignorecase if search pattern containers upper case
spell = false; # highlight spelling mistakes spell = false; # highlight spelling mistakes
splitbelow = true; # A new window is put below the current one splitbelow = true; # A new window is put below the current one
splitright = true; # A new window is put right of the corrent one splitright = true; # A new window is put right of the corrent one
swapfile = false; # Disable the swap file swapfile = false; # Disable the swap file
tabstop = 2; # number of spaces a <Tab> in the text stands for tabstop = 2; # number of spaces a <Tab> in the text stands for
termguicolors = true; # enables 24-bit colors termguicolors = true; # enables 24-bit colors
textwidth = 0; # maximum width of text that is being inserted, a longer line will be broken after whitespace to this width textwidth =
0; # maximum width of text that is being inserted, a longer line will be broken after whitespace to this width
undofile = true; # save and restore undo history undofile = true; # save and restore undo history
updatetime = 100; # Faster completion updatetime = 100; # Faster completion
wrap = false; # prevent wrapping text wrap = false; # prevent wrapping text

View file

@ -1,7 +1,6 @@
{ {
programs.nixvim.plugins.comment = { programs.nixvim.plugins.comment = {
enable = true; enable = true;
settings = { settings = {
opleader.line = "<C-_>"; opleader.line = "<C-_>";
toggler.line = "<C-_>"; toggler.line = "<C-_>";

View file

@ -1,12 +1,9 @@
{ {
programs.nixvim.plugins.floaterm = { programs.nixvim.plugins.floaterm = {
enable = true; enable = true;
width = 0.8; width = 0.8;
height = 0.8; height = 0.8;
title = ""; title = "";
keymaps.toggle = "<leader>,"; keymaps.toggle = "<leader>,";
}; };
} }

View file

@ -9,12 +9,10 @@
}; };
}; };
files."after/ftplugin/markdown.lua".keymaps = [ files."after/ftplugin/markdown.lua".keymaps = [{
{
mode = "n"; mode = "n";
key = "<leader>m"; key = "<leader>m";
action = ":MarkdownPreview<cr>"; action = ":MarkdownPreview<cr>";
} }];
];
}; };
} }

View file

@ -4,13 +4,8 @@
settings = { settings = {
highlight = false; highlight = false;
trim_last_line = false; trim_last_line = false;
ft_blocklist = [ ft_blocklist =
"checkhealth" [ "checkhealth" "floaterm" "lsipinfo" "neo-tree" "TelescopePrompt" ];
"floaterm"
"lsipinfo"
"neo-tree"
"TelescopePrompt"
];
}; };
}; };
} }

View file

@ -1,10 +1,10 @@
{ pkgs, lib, config, ... }: { lib, config, ... }:
let let
inherit (lib) mkIf; inherit (lib) mkIf;
hasPackage = pname: lib.any (p: p ? pname && p.name == pname) config.home.packages; hasPackage = pname:
lib.any (p: p ? pname && p.name == pname) config.home.packages;
hasFish = hasPackage "fish"; hasFish = hasPackage "fish";
in in {
{
programs.nix-index = { programs.nix-index = {
enable = true; enable = true;
enableFishIntegration = mkIf hasFish true; enableFishIntegration = mkIf hasFish true;

View file

@ -1,6 +1,6 @@
{ {
cat = "bat"; cat = "bat";
ccat = "egrep -v '^\s*(#|\\$)'"; ccat = "egrep -v '^s*(#|\\$)'";
g = "git"; g = "git";
gg = "git graph"; gg = "git graph";
gs = "git status"; gs = "git status";

View file

@ -1,17 +1,12 @@
{ {
imports = [ imports = [ ./eza.nix ./fish ];
./eza.nix
./fish
];
home = { home = { shellAliases = import ./aliases.nix; };
shellAliases = import ./aliases.nix;
};
programs = { programs = {
zoxide = { zoxide = {
enable = true; enable = true;
options = ["--cmd" "j"]; options = [ "--cmd" "j" ];
}; };
direnv = { direnv = {
@ -23,9 +18,7 @@
bat = { bat = {
enable = true; enable = true;
config = { config = { theme = "gruvbox-dark"; };
theme = "gruvbox-dark";
};
}; };
}; };
} }

View file

@ -2,9 +2,7 @@
programs.eza = { programs.eza = {
enable = true; enable = true;
enableFishIntegration = false; enableFishIntegration = false;
extraOptions = [ extraOptions = [ "--group-directories-first" ];
"--group-directories-first"
];
git = true; git = true;
}; };

View file

@ -1,9 +1,5 @@
{ pkgs, ... }: { { pkgs, ... }: {
imports = [ imports = [ ./abbrs.nix ./functions.nix ./shell-init.nix ];
./abbrs.nix
./functions.nix
./shell-init.nix
];
programs = { programs = {
fish = { fish = {
@ -27,9 +23,7 @@
enableTransience = true; enableTransience = true;
settings = { settings = {
container.disabled = true; container.disabled = true;
nix_shell = { nix_shell = { format = "via [$symbol]($style) "; };
format = "via [$symbol]($style) ";
};
}; };
}; };
}; };

View file

@ -5,15 +5,20 @@
# Disable greeting # Disable greeting
fish_greeting = ""; fish_greeting = "";
get-local-ip = "ip addr show $(ip route | grep default | awk '{print $5}') | grep 'inet ' | awk '{print $2}' | cut -d/ -f1"; get-local-ip =
"ip addr show $(ip route | grep default | awk '{print $5}') | grep 'inet ' | awk '{print $2}' | cut -d/ -f1";
ssh = "TERM=xterm command ssh $argv"; ssh = "TERM=xterm command ssh $argv";
# Rebuild home-manager # Rebuild home-manager
switch-home = "home-manager switch -b backup --flake ${config.home.homeDirectory}/.dotfiles#$USER@$(hostname -s)"; switch-home =
switch-nix = "sudo nixos-rebuild switch --flake ${config.home.homeDirectory}/.dotfiles"; "home-manager switch -b backup --flake ${config.home.homeDirectory}/.dotfiles#$USER@$(hostname -s)";
upgrade-nix = "nix-channel --update; nix-env --install --attr nixpkgs.nix nixpkgs.cacert"; switch-nix =
"sudo nixos-rebuild switch --flake ${config.home.homeDirectory}/.dotfiles";
upgrade-nix =
"nix-channel --update; nix-env --install --attr nixpkgs.nix nixpkgs.cacert";
# Trees # Trees
tt = "cbonsai -S -t 0.25 -c \"&,&,&,&,&,&,&,&,&,&,&,&,&,&,&,&,&,&,&,&,&,&,&,&,&,&,&,&,&,&,&,&,&,&,&,&,&,&,&,&,&,&,&,&,&,&,&,&,&,&,🌸,🌺,💮\""; tt = ''
cbonsai -S -t 0.25 -c "&,&,&,&,&,&,&,&,&,&,&,&,&,&,&,&,&,&,&,&,&,&,&,&,&,&,&,&,&,&,&,&,&,&,&,&,&,&,&,&,&,&,&,&,&,&,&,&,&,&,🌸,🌺,💮"'';
}; };
} }

View file

@ -10,9 +10,7 @@
historyLimit = 100000; historyLimit = 100000;
keyMode = "vi"; keyMode = "vi";
mouse = true; mouse = true;
plugins = with pkgs.tmuxPlugins; [ plugins = with pkgs.tmuxPlugins; [ tokyo-night-tmux ];
tokyo-night-tmux
];
extraConfig = '' extraConfig = ''
# new panes inherit current working directory # new panes inherit current working directory
bind '%' split-window -h -c '#{pane_current_path}' bind '%' split-window -h -c '#{pane_current_path}'

View file

@ -1,4 +1,4 @@
{ pkgs, lib, ... }: { { pkgs, ... }: {
programs.vim = { programs.vim = {
enable = true; enable = true;
# defaultEditor = true; # defaultEditor = true;

View file

@ -1,4 +1,4 @@
{ inputs, outputs,... }: { { inputs, outputs, ... }: {
imports = [ imports = [
inputs.home-manager.nixosModules.home-manager inputs.home-manager.nixosModules.home-manager
./fish.nix ./fish.nix
@ -12,9 +12,7 @@
nixpkgs = { nixpkgs = {
overlays = builtins.attrValues outputs.overlays; overlays = builtins.attrValues outputs.overlays;
config = { config = { allowUnfree = true; };
allowUnfree = true;
};
}; };
environment.enableAllTerminfo = true; environment.enableAllTerminfo = true;

View file

@ -1,5 +1,4 @@
{ inputs, lib, ... }: { inputs, lib, ... }: {
{
nix = { nix = {
settings = { settings = {
trusted-users = [ "root" "@wheel" ]; trusted-users = [ "root" "@wheel" ];

View file

@ -1,5 +1,4 @@
{ lib, ... }: { lib, ... }: {
{
services.tailscale = { services.tailscale = {
enable = true; enable = true;
useRoutingFeatures = lib.mkDefault "client"; useRoutingFeatures = lib.mkDefault "client";

View file

@ -1,5 +1 @@
{ { virtualisation.docker = { enable = true; }; }
virtualisation.docker = {
enable = true;
};
}

View file

@ -9,9 +9,7 @@
wayland = true; wayland = true;
}; };
}; };
desktopManager = { desktopManager = { gnome.enable = true; };
gnome.enable = true;
};
xkb.layout = "us"; xkb.layout = "us";
xkb.variant = ""; xkb.variant = "";
}; };

View file

@ -1,5 +1 @@
{ { virtualisation.libvirtd = { enable = true; }; }
virtualisation.libvirtd = {
enable = true;
};
}

View file

@ -1,5 +1 @@
{ { services.printing = { enable = true; }; }
services.printing = {
enable = true;
};
}

View file

@ -1,3 +1 @@
{ { services.sshd.enable = true; }
services.sshd.enable = true;
}

View file

@ -1,6 +1,4 @@
{ {
imports = [ ../global/tailscale.nix ]; imports = [ ../global/tailscale.nix ];
services.tailscale = { services.tailscale = { useRoutingFeatures = "both"; };
useRoutingFeatures = "both";
};
} }

View file

@ -1,5 +1 @@
{ { programs.wireshark = { enable = true; }; }
programs.wireshark = {
enable = true;
};
}

View file

@ -1,15 +1,12 @@
{ pkgs, config, ... }: { pkgs, config, ... }:
let ifTheyExist = groups: builtins.filter (group: builtins.hasAttr group config.users.groups) groups; let
in ifTheyExist = groups:
{ builtins.filter (group: builtins.hasAttr group config.users.groups) groups;
in {
users.users.john = { users.users.john = {
isNormalUser = true; isNormalUser = true;
shell = pkgs.fish; shell = pkgs.fish;
extraGroups = [ extraGroups = [ "audio" "video" "wheel" ] ++ ifTheyExist [
"audio"
"video"
"wheel"
] ++ ifTheyExist [
"docker" "docker"
"libvirtd" "libvirtd"
"mysql" "mysql"
@ -22,6 +19,7 @@ in
packages = [ pkgs.home-manager ]; packages = [ pkgs.home-manager ];
}; };
home-manager.users.john = import ../../../../home/${config.networking.hostName}.nix; home-manager.users.john =
import ../../../../home/${config.networking.hostName}.nix;
} }

View file

@ -1,4 +1,4 @@
{ pkgs, inputs, ... }: { { inputs, ... }: {
imports = [ imports = [
inputs.hardware.nixosModules.common-cpu-intel inputs.hardware.nixosModules.common-cpu-intel
inputs.hardware.nixosModules.common-pc-ssd inputs.hardware.nixosModules.common-pc-ssd

View file

@ -1,13 +1,12 @@
{ config, lib, pkgs, modulesPath, ... }: { config, lib, modulesPath, ... }:
{ {
imports = [ imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
(modulesPath + "/installer/scan/not-detected.nix")
];
boot = { boot = {
initrd = { initrd = {
availableKernelModules = [ "xhci_pci" "usb_storage" "sd_mod" "sdhci_pci" ]; availableKernelModules =
[ "xhci_pci" "usb_storage" "sd_mod" "sdhci_pci" ];
kernelModules = [ ]; kernelModules = [ ];
}; };
kernelModules = [ "kvm-intel" ]; kernelModules = [ "kvm-intel" ];
@ -21,7 +20,6 @@
}; };
}; };
fileSystems = { fileSystems = {
"/" = { "/" = {
device = "/dev/disk/by-uuid/b2c7656b-2292-4dc9-94f2-a66690a14969"; device = "/dev/disk/by-uuid/b2c7656b-2292-4dc9-94f2-a66690a14969";
@ -33,13 +31,13 @@
}; };
}; };
swapDevices = [{ swapDevices =
device = "/dev/disk/by-uuid/9cd48b44-07e5-4d0f-aaf0-7ca07e7b7945"; [{ device = "/dev/disk/by-uuid/9cd48b44-07e5-4d0f-aaf0-7ca07e7b7945"; }];
}];
networking.useDHCP = lib.mkDefault true; networking.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; hardware.cpu.intel.updateMicrocode =
lib.mkDefault config.hardware.enableRedistributableFirmware;
} }

View file

@ -1,8 +1,9 @@
# A nixpkgs instance that is grabbed from the pinned nixpkgs commit in the lock file # A nixpkgs instance that is grabbed from the pinned nixpkgs commit in the lock file
# This is useful to avoid using channels when using legacy nix commands # This is useful to avoid using channels when using legacy nix commands
let lock = (builtins.fromJSON (builtins.readFile ./flake.lock)).nodes.nixpkgs.locked; let
in lock =
import (fetchTarball { (builtins.fromJSON (builtins.readFile ./flake.lock)).nodes.nixpkgs.locked;
in import (fetchTarball {
url = "https://github.com/nixos/nixpkgs/archive/${lock.rev}.tar.gz"; url = "https://github.com/nixos/nixpkgs/archive/${lock.rev}.tar.gz";
sha256 = lock.narHash; sha256 = lock.narHash;
}) })

View file

@ -1,13 +1,13 @@
# This file defines overlays # This file defines overlays
{ inputs, ... }: { inputs, ... }: {
{
# This one brings our custom packages from the 'pkgs' directory # This one brings our custom packages from the 'pkgs' directory
additions = final: _prev: import ../pkgs { pkgs = final; }; additions = final: _prev: import ../pkgs { pkgs = final; };
# This one contains whatever you want to overlay # This one contains whatever you want to overlay
# You can change versions, add patches, set compilation flags, anything really. # You can change versions, add patches, set compilation flags, anything really.
# https://nixos.wiki/wiki/Overlays # https://nixos.wiki/wiki/Overlays
modifications = final: prev: { modifications = final: prev:
{
# example = prev.example.overrideAttrs (oldAttrs: rec { # example = prev.example.overrideAttrs (oldAttrs: rec {
# ... # ...
# }); # });

View file

@ -1,6 +1,7 @@
# Custom packages, that can be defined similarly to ones from nixpkgs # Custom packages, that can be defined similarly to ones from nixpkgs
# You can build them using 'nix build .#example' or (legacy) 'nix-build -A example' # You can build them using 'nix build .#example' or (legacy) 'nix-build -A example'
{ pkgs ? (import ../nixpkgs.nix) { } }: { { pkgs ? (import ../nixpkgs.nix) { } }:
{
# example = pkgs.callPackage ./example { }; # example = pkgs.callPackage ./example { };
} }

View file

@ -1,8 +1,6 @@
{ lib, stdenv, fetchFromGitHub }: { lib, stdenv, fetchFromGitHub }:
let let pname = "trekscii";
pname = "trekscii"; in stdenv.mkDerivation {
in
stdenv.mkDerivation {
inherit pname; inherit pname;
version = "unstable-2022-06-27"; version = "unstable-2022-06-27";
@ -17,7 +15,5 @@ stdenv.mkDerivation {
install -Dm 0755 bin/trekscii $out/bin/trekscii install -Dm 0755 bin/trekscii $out/bin/trekscii
''; '';
meta = with lib; { meta = with lib; { platforms = platforms.all; };
platforms = platforms.all;
};
} }