refactor
This commit is contained in:
parent
66c05f9093
commit
45d6f4b0f3
205 changed files with 9040 additions and 342 deletions
27
modules/home/cli-apps/bash/default.nix
Normal file
27
modules/home/cli-apps/bash/default.nix
Normal file
|
@ -0,0 +1,27 @@
|
|||
{ lib
|
||||
, config
|
||||
, pkgs
|
||||
, ...
|
||||
}:
|
||||
let
|
||||
inherit (lib) mkEnableOption mkIf;
|
||||
|
||||
cfg = config.plusultra.cli-apps.bash;
|
||||
in
|
||||
{
|
||||
options.plusultra.cli-apps.bash = {
|
||||
enable = mkEnableOption "BASH shell";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = with pkgs; [
|
||||
bashInteractive
|
||||
];
|
||||
programs.bash = {
|
||||
enable = true;
|
||||
initExtra = ''
|
||||
function msh() { mosh "$@" -- bash -c 'if type -f tmux; then tmux new-session -A -s 0; else screen -R; fi;' ; };
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
22
modules/home/cli-apps/bat/default.nix
Normal file
22
modules/home/cli-apps/bat/default.nix
Normal file
|
@ -0,0 +1,22 @@
|
|||
{ lib
|
||||
, config
|
||||
, pkgs
|
||||
, ...
|
||||
}:
|
||||
with lib;
|
||||
with lib.plusultra; let
|
||||
cfg = config.plusultra.cli-apps.bat;
|
||||
in
|
||||
{
|
||||
options.plusultra.cli-apps.bat = {
|
||||
enable = mkEnableOption "bat";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
programs.bat = {
|
||||
enable = true;
|
||||
config.theme = "ansi";
|
||||
extraPackages = with pkgs.bat-extras; [ batdiff batman batgrep batwatch ];
|
||||
};
|
||||
};
|
||||
}
|
53
modules/home/cli-apps/fish/default.nix
Normal file
53
modules/home/cli-apps/fish/default.nix
Normal file
|
@ -0,0 +1,53 @@
|
|||
{ lib
|
||||
, config
|
||||
, pkgs
|
||||
, ...
|
||||
}:
|
||||
let
|
||||
inherit (lib) mkEnableOption mkIf;
|
||||
|
||||
cfg = config.plusultra.cli-apps.fish;
|
||||
in
|
||||
{
|
||||
options.plusultra.cli-apps.fish = {
|
||||
enable = mkEnableOption "FISH shell";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
programs.fish = {
|
||||
enable = true;
|
||||
interactiveShellInit = ''
|
||||
function msh --wraps mosh --description 'mosh with tmux'
|
||||
if not set -q argv[1]
|
||||
echo 'Usage: msh [user@]host [command]'
|
||||
else
|
||||
${pkgs.mosh}/bin/mosh $argv -- tmux new-session -A -s 0
|
||||
end
|
||||
end
|
||||
'';
|
||||
|
||||
plugins = [{
|
||||
name = "foreign-env";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "oh-my-fish";
|
||||
repo = "plugin-foreign-env";
|
||||
rev = "dddd9213272a0ab848d474d0cbde12ad034e65bc";
|
||||
sha256 = "00xqlyl3lffc5l0viin1nyp819wf81fncqyz87jx8ljjdhilmgbs";
|
||||
};
|
||||
}];
|
||||
|
||||
shellInit =
|
||||
''
|
||||
# nix
|
||||
if test -e /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
|
||||
fenv source /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
|
||||
end
|
||||
|
||||
# home-manager
|
||||
if test -e $HOME/.nix-profile/etc/profile.d/hm-session-vars.sh
|
||||
fenv source $HOME/.nix-profile/etc/profile.d/hm-session-vars.sh
|
||||
end
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
49
modules/home/cli-apps/git/default.nix
Normal file
49
modules/home/cli-apps/git/default.nix
Normal file
|
@ -0,0 +1,49 @@
|
|||
{ lib
|
||||
, config
|
||||
, pkgs
|
||||
, ...
|
||||
}:
|
||||
with lib;
|
||||
with lib.plusultra; let
|
||||
cfg = config.plusultra.cli-apps.git;
|
||||
in
|
||||
{
|
||||
options.plusultra.cli-apps.git = {
|
||||
enable = mkEnableOption "git";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = with pkgs; [
|
||||
delta
|
||||
gh
|
||||
];
|
||||
programs.git = {
|
||||
enable = true;
|
||||
userName = "Harald Hoyer";
|
||||
userEmail = "harald@hoyer.xyz";
|
||||
extraConfig = {
|
||||
init.defaultBranch = "main";
|
||||
"credential \"https://github.com\"" = {
|
||||
helper = "!gh auth git-credential";
|
||||
};
|
||||
alias = {
|
||||
co = "checkout";
|
||||
ci = "commit";
|
||||
};
|
||||
pull.ff = "only";
|
||||
core.pager = "delta";
|
||||
delta = {
|
||||
features = "side-by-side line-numbers decorations";
|
||||
syntax-theme = "DarkNeon";
|
||||
light = "false";
|
||||
line-numbers = "true";
|
||||
navigate = "true";
|
||||
};
|
||||
interactive.diffFilter = "${pkgs.delta}/bin/delta --color-only";
|
||||
merge.conflictStyle = "diff3";
|
||||
diff.colorMoved = "default";
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
}
|
33
modules/home/cli-apps/home-manager/default.nix
Normal file
33
modules/home/cli-apps/home-manager/default.nix
Normal file
|
@ -0,0 +1,33 @@
|
|||
{ lib, config, pkgs, ... }:
|
||||
|
||||
let
|
||||
inherit (lib) mkEnableOption mkIf;
|
||||
inherit (lib.plusultra) enabled;
|
||||
|
||||
cfg = config.plusultra.cli-apps.home-manager;
|
||||
in
|
||||
{
|
||||
options.plusultra.cli-apps.home-manager = {
|
||||
enable = mkEnableOption "home-manager";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
programs.home-manager = enabled;
|
||||
home.sessionVariables = {
|
||||
EDITOR = "${pkgs.vim}/bin/vim";
|
||||
BATDIFF_USE_DELTA = "true";
|
||||
};
|
||||
|
||||
home.shellAliases = {
|
||||
cat = "${pkgs.bat}/bin/bat --decorations never";
|
||||
less = ''${pkgs.bat}/bin/bat --decorations never --paging=always --pager "${pkgs.less}/bin/less -RF"'';
|
||||
man = "${pkgs.bat-extras.batman}/bin/batman";
|
||||
};
|
||||
|
||||
home.packages = with pkgs; [
|
||||
bat
|
||||
vim
|
||||
cachix
|
||||
];
|
||||
};
|
||||
}
|
230
modules/home/cli-apps/neovim/default.nix
Normal file
230
modules/home/cli-apps/neovim/default.nix
Normal file
|
@ -0,0 +1,230 @@
|
|||
{ lib, config, pkgs, ... }:
|
||||
|
||||
let
|
||||
inherit (lib) mkEnableOption mkIf;
|
||||
|
||||
cfg = config.plusultra.cli-apps.neovim;
|
||||
in
|
||||
{
|
||||
options.plusultra.cli-apps.neovim = {
|
||||
enable = mkEnableOption "Neovim";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
programs.neovim-flake = {
|
||||
enable = true;
|
||||
# your settings need to go into the settings attrset
|
||||
settings = {
|
||||
vim = {
|
||||
viAlias = false;
|
||||
vimAlias = false;
|
||||
debugMode = {
|
||||
enable = false;
|
||||
level = 20;
|
||||
logFile = "/tmp/nvim.log";
|
||||
};
|
||||
};
|
||||
|
||||
vim.lsp = {
|
||||
formatOnSave = true;
|
||||
lspkind.enable = false;
|
||||
lightbulb.enable = true;
|
||||
lspsaga.enable = false;
|
||||
nvimCodeActionMenu.enable = true;
|
||||
trouble.enable = true;
|
||||
lspSignature.enable = true;
|
||||
lsplines.enable = true;
|
||||
};
|
||||
|
||||
vim.debugger = {
|
||||
nvim-dap = {
|
||||
enable = true;
|
||||
ui.enable = true;
|
||||
};
|
||||
};
|
||||
|
||||
vim.languages = {
|
||||
enableLSP = true;
|
||||
enableFormat = true;
|
||||
enableTreesitter = true;
|
||||
enableExtraDiagnostics = true;
|
||||
|
||||
nix = {
|
||||
enable = true;
|
||||
format.type = "nixpkgs-fmt";
|
||||
};
|
||||
html.enable = true;
|
||||
clang = {
|
||||
enable = true;
|
||||
lsp.server = "clangd";
|
||||
};
|
||||
sql.enable = false;
|
||||
rust = {
|
||||
enable = true;
|
||||
crates.enable = true;
|
||||
};
|
||||
java.enable = true;
|
||||
ts.enable = true;
|
||||
svelte.enable = true;
|
||||
go.enable = true;
|
||||
zig.enable = true;
|
||||
python.enable = true;
|
||||
dart.enable = true;
|
||||
elixir.enable = false;
|
||||
};
|
||||
|
||||
vim.visuals = {
|
||||
enable = true;
|
||||
nvimWebDevicons.enable = true;
|
||||
scrollBar.enable = true;
|
||||
smoothScroll.enable = true;
|
||||
cellularAutomaton.enable = true;
|
||||
fidget-nvim.enable = true;
|
||||
indentBlankline = {
|
||||
enable = true;
|
||||
fillChar = null;
|
||||
eolChar = null;
|
||||
showCurrContext = true;
|
||||
};
|
||||
cursorline = {
|
||||
enable = true;
|
||||
lineTimeout = 0;
|
||||
};
|
||||
};
|
||||
|
||||
vim.statusline = {
|
||||
lualine = {
|
||||
enable = true;
|
||||
theme = "catppuccin";
|
||||
};
|
||||
};
|
||||
|
||||
vim.theme = {
|
||||
enable = true;
|
||||
name = "catppuccin";
|
||||
style = "mocha";
|
||||
transparent = false;
|
||||
};
|
||||
|
||||
vim.autopairs.enable = true;
|
||||
|
||||
vim.autocomplete = {
|
||||
enable = true;
|
||||
type = "nvim-cmp";
|
||||
};
|
||||
|
||||
vim.filetree = {
|
||||
nvimTree = {
|
||||
enable = true;
|
||||
};
|
||||
};
|
||||
|
||||
vim.tabline = {
|
||||
nvimBufferline.enable = true;
|
||||
};
|
||||
|
||||
vim.treesitter.context.enable = true;
|
||||
|
||||
vim.binds = {
|
||||
whichKey.enable = true;
|
||||
cheatsheet.enable = true;
|
||||
};
|
||||
|
||||
vim.telescope.enable = true;
|
||||
|
||||
vim.git = {
|
||||
enable = true;
|
||||
gitsigns.enable = true;
|
||||
gitsigns.codeActions = false; # throws an annoying debug message
|
||||
};
|
||||
|
||||
vim.minimap = {
|
||||
minimap-vim.enable = false;
|
||||
codewindow.enable = true; # lighter, faster, and uses lua for configuration
|
||||
};
|
||||
|
||||
vim.dashboard = {
|
||||
dashboard-nvim.enable = false;
|
||||
alpha.enable = true;
|
||||
};
|
||||
|
||||
vim.notify = {
|
||||
nvim-notify.enable = true;
|
||||
};
|
||||
|
||||
vim.projects = {
|
||||
project-nvim.enable = true;
|
||||
};
|
||||
|
||||
vim.utility = {
|
||||
ccc.enable = true;
|
||||
vim-wakatime.enable = false;
|
||||
icon-picker.enable = true;
|
||||
surround.enable = true;
|
||||
diffview-nvim.enable = true;
|
||||
motion = {
|
||||
hop.enable = true;
|
||||
leap.enable = true;
|
||||
};
|
||||
};
|
||||
|
||||
vim.notes = {
|
||||
obsidian.enable = false; # FIXME neovim fails to build if obsidian is enabled
|
||||
orgmode.enable = false;
|
||||
mind-nvim.enable = true;
|
||||
todo-comments.enable = true;
|
||||
};
|
||||
|
||||
vim.terminal = {
|
||||
toggleterm = {
|
||||
enable = true;
|
||||
lazygit.enable = true;
|
||||
};
|
||||
};
|
||||
|
||||
vim.ui = {
|
||||
borders.enable = true;
|
||||
noice.enable = true;
|
||||
colorizer.enable = true;
|
||||
modes-nvim.enable = false; # the theme looks terrible with catppuccin
|
||||
illuminate.enable = true;
|
||||
breadcrumbs = {
|
||||
enable = true;
|
||||
navbuddy.enable = true;
|
||||
};
|
||||
smartcolumn = {
|
||||
enable = true;
|
||||
columnAt.languages = {
|
||||
# this is a freeform module, it's `buftype = int;` for configuring column position
|
||||
nix = 110;
|
||||
ruby = 120;
|
||||
java = 130;
|
||||
go = [ 90 130 ];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
vim.assistant = {
|
||||
copilot = {
|
||||
enable = true;
|
||||
cmp.enable = true;
|
||||
};
|
||||
};
|
||||
|
||||
vim.session = {
|
||||
nvim-session-manager.enable = false;
|
||||
};
|
||||
|
||||
vim.gestures = {
|
||||
gesture-nvim.enable = false;
|
||||
};
|
||||
|
||||
vim.comments = {
|
||||
comment-nvim.enable = true;
|
||||
};
|
||||
|
||||
vim.spellChecking.languages = [ "en" "de" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
32
modules/home/cli-apps/starship/default.nix
Normal file
32
modules/home/cli-apps/starship/default.nix
Normal file
|
@ -0,0 +1,32 @@
|
|||
{ lib
|
||||
, config
|
||||
, pkgs
|
||||
, ...
|
||||
}:
|
||||
let
|
||||
inherit (lib) mkEnableOption mkIf;
|
||||
|
||||
cfg = config.plusultra.cli-apps.starship;
|
||||
in
|
||||
{
|
||||
options.plusultra.cli-apps.starship = {
|
||||
enable = mkEnableOption "starship";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = with pkgs; [
|
||||
(pkgs.nerdfonts.override { fonts = [ "FiraCode" "DroidSansMono" "JetBrainsMono" ]; })
|
||||
];
|
||||
programs.starship = {
|
||||
enable = true;
|
||||
settings = {
|
||||
container.format = "[\\[$name\\]]($style) ";
|
||||
git_status = {
|
||||
ahead = "⇡$\{count}";
|
||||
diverged = "⇕⇡$\{ahead_count}⇣$\{behind_count}";
|
||||
behind = "⇣$\{count}";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
20
modules/home/cli-apps/tmux/default.nix
Normal file
20
modules/home/cli-apps/tmux/default.nix
Normal file
|
@ -0,0 +1,20 @@
|
|||
{ lib
|
||||
, config
|
||||
, pkgs
|
||||
, ...
|
||||
}:
|
||||
with lib;
|
||||
with lib.plusultra; let
|
||||
cfg = config.plusultra.cli-apps.tmux;
|
||||
in
|
||||
{
|
||||
options.plusultra.cli-apps.tmux = {
|
||||
enable = mkEnableOption "Tmux";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = with pkgs; [
|
||||
tmux
|
||||
];
|
||||
};
|
||||
}
|
11
modules/home/host/default.nix
Normal file
11
modules/home/host/default.nix
Normal file
|
@ -0,0 +1,11 @@
|
|||
{ lib, config, pkgs, host ? null, format ? "unknown", ... }:
|
||||
|
||||
let
|
||||
inherit (lib) types;
|
||||
inherit (lib.plusultra) mkOpt;
|
||||
in
|
||||
{
|
||||
options.plusultra.host = {
|
||||
name = mkOpt (types.nullOr types.str) host "The host name.";
|
||||
};
|
||||
}
|
18
modules/home/tools/direnv/default.nix
Normal file
18
modules/home/tools/direnv/default.nix
Normal file
|
@ -0,0 +1,18 @@
|
|||
{ options, config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
with lib.plusultra;
|
||||
let cfg = config.plusultra.tools.direnv;
|
||||
in
|
||||
{
|
||||
options.plusultra.tools.direnv = with types; {
|
||||
enable = mkBoolOpt false "Whether or not to enable direnv.";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
programs.direnv = {
|
||||
enable = true;
|
||||
nix-direnv = enabled;
|
||||
};
|
||||
};
|
||||
}
|
40
modules/home/tools/git/default.nix
Normal file
40
modules/home/tools/git/default.nix
Normal file
|
@ -0,0 +1,40 @@
|
|||
{ lib, config, pkgs, ... }:
|
||||
|
||||
let
|
||||
inherit (lib) types mkEnableOption mkIf;
|
||||
inherit (lib.plusultra) mkOpt enabled;
|
||||
|
||||
cfg = config.plusultra.tools.git;
|
||||
user = config.plusultra.user;
|
||||
in
|
||||
{
|
||||
options.plusultra.tools.git = {
|
||||
enable = mkEnableOption "Git";
|
||||
userName = mkOpt types.str user.fullName "The name to configure git with.";
|
||||
userEmail = mkOpt types.str user.email "The email to configure git with.";
|
||||
signingKey =
|
||||
mkOpt types.str "9762169A1B35EA68" "The key ID to sign commits with.";
|
||||
signByDefault = mkOpt types.bool true "Whether to sign commits by default.";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
programs.git = {
|
||||
enable = true;
|
||||
inherit (cfg) userName userEmail;
|
||||
lfs = enabled;
|
||||
signing = {
|
||||
key = cfg.signingKey;
|
||||
inherit (cfg) signByDefault;
|
||||
};
|
||||
extraConfig = {
|
||||
init = { defaultBranch = "main"; };
|
||||
pull = { rebase = true; };
|
||||
push = { autoSetupRemote = true; };
|
||||
core = { whitespace = "trailing-space,space-before-tab"; };
|
||||
safe = {
|
||||
directory = "${user.home}/work/config";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
21
modules/home/tools/jetbrains/default.nix
Normal file
21
modules/home/tools/jetbrains/default.nix
Normal file
|
@ -0,0 +1,21 @@
|
|||
{ options, config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
with lib.plusultra;
|
||||
let cfg = config.plusultra.tools.jetbrains;
|
||||
in
|
||||
{
|
||||
options.plusultra.tools.jetbrains = with types; {
|
||||
enable = mkBoolOpt false "Whether or not to enable jetbrains.";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.sessionPath = [
|
||||
"$HOME/.local/share/JetBrains/Toolbox/scripts"
|
||||
];
|
||||
home.packages = with pkgs; [
|
||||
jetbrains-toolbox
|
||||
(pkgs.nerdfonts.override { fonts = [ "FiraCode" "DroidSansMono" "JetBrainsMono" ]; })
|
||||
];
|
||||
};
|
||||
}
|
20
modules/home/tools/ssh/default.nix
Normal file
20
modules/home/tools/ssh/default.nix
Normal file
|
@ -0,0 +1,20 @@
|
|||
{ lib, config, pkgs, ... }:
|
||||
|
||||
let
|
||||
inherit (lib) types mkEnableOption mkIf;
|
||||
cfg = config.plusultra.tools.ssh;
|
||||
in
|
||||
{
|
||||
options.plusultra.tools.ssh = {
|
||||
enable = mkEnableOption "SSH";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
programs.ssh = {
|
||||
extraConfig = ''
|
||||
Host *
|
||||
HostKeyAlgorithms +ssh-rsa
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
50
modules/home/user/default.nix
Normal file
50
modules/home/user/default.nix
Normal file
|
@ -0,0 +1,50 @@
|
|||
{ lib, config, pkgs, osConfig ? { }, ... }:
|
||||
|
||||
let
|
||||
inherit (lib) types mkIf mkDefault mkMerge;
|
||||
inherit (lib.plusultra) mkOpt;
|
||||
|
||||
cfg = config.plusultra.user;
|
||||
|
||||
is-linux = pkgs.stdenv.isLinux;
|
||||
is-darwin = pkgs.stdenv.isDarwin;
|
||||
|
||||
home-directory =
|
||||
if cfg.name == null then
|
||||
null
|
||||
else if is-darwin then
|
||||
"/Users/${cfg.name}"
|
||||
else
|
||||
"/home/${cfg.name}";
|
||||
in
|
||||
{
|
||||
options.plusultra.user = {
|
||||
enable = mkOpt types.bool false "Whether to configure the user account.";
|
||||
name = mkOpt (types.nullOr types.str) config.snowfallorg.user.name "The user account.";
|
||||
|
||||
fullName = mkOpt types.str "Jake Hamilton" "The full name of the user.";
|
||||
email = mkOpt types.str "jake.hamilton@hey.com" "The email of the user.";
|
||||
|
||||
home = mkOpt (types.nullOr types.str) home-directory "The user's home directory.";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable (mkMerge [
|
||||
{
|
||||
assertions = [
|
||||
{
|
||||
assertion = cfg.name != null;
|
||||
message = "plusultra.user.name must be set";
|
||||
}
|
||||
{
|
||||
assertion = cfg.home != null;
|
||||
message = "plusultra.user.home must be set";
|
||||
}
|
||||
];
|
||||
|
||||
home = {
|
||||
username = mkDefault cfg.name;
|
||||
homeDirectory = mkDefault cfg.home;
|
||||
};
|
||||
}
|
||||
]);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue