Initial Commit

This commit is contained in:
Tyler Mayoff 2024-09-30 18:06:03 -04:00
commit e726aebd5b
22 changed files with 1098 additions and 0 deletions

View file

@ -0,0 +1,224 @@
{
inputs,
outputs,
# lib,
config,
pkgs,
...
}: let
nixGLIntel = inputs.nixgl.packages."${pkgs.system}".nixGLIntel;
in rec {
nixpkgs.config.allowUnfree = true;
home.username = "tyler";
home.homeDirectory = "/home/tyler";
home.enableNixpkgsReleaseCheck = false;
xdg.enable = true;
imports = [
./fish.nix
./nushell.nix
# ./nom.nix
# ./neovim.nix
(builtins.fetchurl {
url = "https://raw.githubusercontent.com/Smona/home-manager/nixgl-compat/modules/misc/nixgl.nix";
sha256 = "01dkfr9wq3ib5hlyq9zq662mp0jl42fw3f6gd2qgdf8l8ia78j7i";
})
];
nixGL.prefix = "${nixGLIntel}/bin/nixGLIntel";
nixpkgs = {
overlays = [
outputs.overlays.additions
outputs.overlays.modifications
outputs.overlays.unstable-packages
];
};
fonts.fontconfig.enable = true;
home.packages = with pkgs; [
# Gnome
gnome.gnome-tweaks
adw-gtk3
nixGLIntel
# Fonts
(nerdfonts.override {fonts = ["JetBrainsMono"];})
unstable.nix-output-monitor
chezmoi
# backup
restic
libnotify
distrobox
discord
wl-clipboard
usbutils
yadm
# Shell
bash
starship
ripgrep
fh
fd
glow
unstable.helix
gitoxide
lnav
fzf
zoxide
# Software Dev
tig
mold
# Office
libreoffice
obsidian
# language servers
efm-langserver
sumneko-lua-language-server
nil
alejandra
lemminx
pylyzer
ltex-ls # Spell checker
];
programs.gnome-shell = {
enable = true;
extensions = [
# {package = pkgs.gnomeExtensions.appindicator;}
{package = pkgs.gnomeExtensions.ddterm;}
{package = pkgs.gnomeExtensions.gsconnect;}
{package = pkgs.gnomeExtensions.paperwm;}
{package = pkgs.gnomeExtensions.night-theme-switcher;}
{package = pkgs.gnomeExtensions.blur-my-shell;}
];
};
programs.alacritty = {
enable = true;
package = config.lib.nixGL.wrap pkgs.alacritty;
};
programs.wezterm = {
enable = true;
package = config.lib.nixGL.wrap pkgs.wezterm;
extraConfig = ''
return {
font_size=9.25,
color_scheme="catppuccin-latte",
hide_tab_bar_if_only_one_tab = true,
window_frame = {
font_size = 10
},
}
'';
};
programs.bat = {
enable = true;
config = {
theme = "GitHub";
};
};
programs.zellij = {
enable = true;
};
programs.broot = {
enable = true;
enableFishIntegration = true;
};
programs.starship = {
enable = true;
};
programs.eza = {
enable = true;
enableFishIntegration = true;
};
programs.direnv = {
enable = true;
};
programs.thefuck = {
enable = true;
enableFishIntegration = true;
enableInstantMode = true;
};
programs.yazi = {
enable = true;
package = pkgs.unstable.yazi;
enableFishIntegration = true;
shellWrapperName = "y";
};
systemd.user.services = {
daily_backup = {
Unit = {
Description = "Run a backup script";
};
Install = {
WantedBy = ["default.target"];
};
Service = {
Type = "oneshot";
ExecStart = "${home.homeDirectory}/.local/bin/,daily_backup";
};
};
};
services.darkman = {
enable = true;
package = pkgs.unstable.darkman;
settings = {
lat = 45.408;
lng = -74.159;
};
darkModeScripts = {
helix-editor = ''
sed -i 's/theme = ".*"/theme = "catppuccin_macchiato"/' $HOME/.config/helix/config.toml
'';
alacritty = ''
ln -fs ~/.config/alacritty/themes/catppuccin_macchiato.toml ~/.config/alacritty/themes/_active.toml
touch ~/.config/alacritty/alacritty.toml
'';
};
lightModeScripts = {
helix-editor = ''
sed -i 's/theme = ".*"/theme = "catppuccin_latte"/' $HOME/.config/helix/config.toml
'';
alacritty = ''
ln -fs ~/.config/alacritty/themes/catppuccin_latte.toml ~/.config/alacritty/themes/_active.toml
touch ~/.config/alacritty/alacritty.toml
'';
};
};
home.stateVersion = "23.11";
programs.home-manager.enable = true;
}

View file

@ -0,0 +1,74 @@
{pkgs, ...}: {
programs.fish = {
enable = true;
interactiveShellInit = ''
set -gx EDITOR hx
set -gx GIT_EDITOR $EDITOR
set -gx DEBEMAIL "tyler@tylermayoff.com"
fish_add_path $HOME/.local/bin
source $HOME/.config/fish/variables-$(hostname).fish
bind \cz 'fg 2>/dev/null; commandline -f repaint'
zoxide init fish | source
'';
shellInit = ''
set -gx EDITOR hx
set -gx GIT_EDITOR $EDITOR
set -gx DEBEMAIL "tyler@tylermayoff.com"
set -xg XDG_DATA_DIRS "$HOME/.nix-profile/share:$XDG_DATA_DIRS"
fish_add_path $HOME/.local/bin
source $HOME/.config/fish/variables-$(hostname).fish
'';
# functions = {
# yupdate = {
# body = ''
# echo "Hello world"
# '';
# };
# };
plugins = [
{
name = "forgit";
src = pkgs.fishPlugins.forgit.src;
}
];
shellAliases = {
# ls
ls = "eza $eza_params";
l = "eza --git-ignore $eza_params";
ll = "eza --all --header --long $eza_params";
llm = "eza --all --header --long --sort=modified $eza_params";
la = "eza -lbhHigUmuSa";
lx = "eza -lbhHigUmuSa@";
lt = "eza --tree $eza_params";
tree = "eza --tree $eza_params";
# Git
gc = "git commit";
gcm = "git commit -m";
gac = "git add . && git commit";
gacp = "gac && git push";
gs = "git status";
# yac = "yadm add . && yadm commit";
# yacp = "yac && yadm push";
yc = "pushd $HOME/.local/share/yadm/repo.git && git-forgit add && yadm commit && popd";
yd = "pushd $HOME/.local/share/yadm/repo.git && git-forgit diff && popd";
# nix
flake = "nix flake";
# home-manager
hm-upgrade = "nix flake update --flake ~/.config/home-manager#";
hm-update = "home-manager switch";
};
};
}

View file

@ -0,0 +1,16 @@
{
inputs,
outputs,
lib,
config,
pkgs,
...
}: {
imports = [../common.nix];
home.packages = with pkgs; [
# clang_17
# clang-tools
just
];
}

View file

@ -0,0 +1,187 @@
{ config, pkgs, lib, ... }:
let
collectPathArgs = ''
paths=()
while [ "$#" -gt 0 ]; do
arg="$1"
[[ "$arg" =~ ^--?.+ ]] && break
paths+=("$arg"); shift
done
'';
pathArgs = ''"''${paths[@]}"'';
collectFlakeFlags = ''
flakeFlags=()
while [ "$#" -gt 0 ]; do
arg="$1"
case "$arg" in
${
builtins.concatStringsSep "|" [
"build"
"bundle"
"copy"
"daemon"
"derivation"
"develop"
"doctor"
"edit"
"eval"
"flake"
"fmt"
"hash"
"help"
"help-stores"
"key"
"log"
"nar"
"path-info"
"print-dev-env"
"profile"
"realisation"
"registry"
"repl"
"run"
"search"
"shell"
"show-config"
"store"
"upgrade-nix"
"why-depends"
]
})
break
;;
*)
flakeFlags+=("$arg"); shift
;;
esac
done
'';
flakeFlags = ''"''${flakeFlags[@]}"'';
nixNomArgs = "--log-format internal-json --verbose";
nixBuildCmdWithNomArgs = buildCmd: ''
${collectPathArgs}
${buildCmd} ${pathArgs} ${nixNomArgs} "$@"
'';
nixShellCmdWithNomArgs = shellCmd: ''
${shellCmd} ${nixNomArgs} "$@"
'';
nixStoreCmdWithNomArgs = storeCmd: ''
operation="$1"; shift
case "$operation" in
--realise|-r)
${collectPathArgs}
${storeCmd} "$operation" ${pathArgs} ${nixNomArgs} "$@"
;;
*)
${storeCmd} "$operation" "$@"
;;
esac
'';
nixWithNomArgs = nix:
pkgs.symlinkJoin {
name = "nix-with-nom-args-${nix.version}";
paths = (lib.attrsets.mapAttrsToList pkgs.writeShellScriptBin {
nix = ''
program="$(basename $0)"
case "$program" in
nix)
${collectFlakeFlags}
command="$1"; shift
case "$command" in
build)
${nixBuildCmdWithNomArgs "${nix}/bin/nix ${flakeFlags} build"}
;;
shell)
${nixShellCmdWithNomArgs "${nix}/bin/nix ${flakeFlags} shell"}
;;
store)
${nixStoreCmdWithNomArgs "${nix}/bin/nix ${flakeFlags} store"}
;;
*)
${nix}/bin/nix ${flakeFlags} "$command" "$@"
;;
esac
;;
*)
"${nix}/bin/$program" "$@"
;;
esac
'';
# nix-build = nixBuildCmdWithNomArgs "${nix}/bin/nix-build";
nix-shell = nixShellCmdWithNomArgs "${nix}/bin/nix-shell";
nix-store = nixStoreCmdWithNomArgs "${nix}/bin/nix-store";
}) ++ [ nix ];
};
nixNomPkgs = { nix ? null, nixos-rebuild ? null, home-manager ? null }:
lib.attrsets.mapAttrs pkgs.writeShellScriptBin ((if nix != null then {
nix = ''
program="$(basename $0)"
case "$program" in
nix)
${collectFlakeFlags}
command="$1"; shift
case "$command" in
build|shell|develop)
${pkgs.nix-output-monitor}/bin/nom ${flakeFlags} "$command" "$@"
;;
*)
${nix}/bin/nix ${flakeFlags} "$command" "$@"
;;
esac
;;
*)
"${nix}/bin/$program" "$@"
;;
esac
'';
# nix-build = ''
# ${pkgs.nix-output-monitor}/bin/nom-build "$@"
# '';
nix-shell = ''
${pkgs.nix-output-monitor}/bin/nom-shell "$@"
'';
nix-store = ''
${nixWithNomArgs nix}/bin/nix-store "$@" \
|& ${pkgs.nix-output-monitor}/bin/nom --json
'';
} else
{ }) // (if nixos-rebuild != null then {
nixos-rebuild = ''
${pkgs.expect}/bin/unbuffer \
${
nixos-rebuild.override (old: { nix = nixWithNomArgs old.nix; })
}/bin/nixos-rebuild "$@" \
|& ${pkgs.nix-output-monitor}/bin/nom --json
'';
} else
{ }) // (if home-manager != null then {
home-manager = ''
PATH="${nixWithNomArgs pkgs.nix}/bin:$PATH" \
${pkgs.expect}/bin/unbuffer \
${home-manager}/bin/home-manager "$@" \
|& ${pkgs.nix-output-monitor}/bin/nom --json
'';
} else
{ }));
nomAliases = pkgs:
lib.attrsets.mapAttrs (name: pkg: "${pkg}/bin/${name}") (nixNomPkgs pkgs);
wrapWithNom = let inherit (pkgs) symlinkJoin;
in (pkgs:
symlinkJoin {
name = "wrapped-with-nom";
paths = (builtins.attrValues (nixNomPkgs pkgs))
++ (builtins.attrValues pkgs);
});
in {
# home.shellAliases =
# nomAliases { inherit (pkgs) nix nixos-rebuild home-manager; };
# or
# home.packages = [
# (lib.hiPrio
# (wrapWithNom { inherit (pkgs) nix nixos-rebuild home-manager; }))
# ];
}

View file

@ -0,0 +1,44 @@
{pkgs, ...}: {
programs.nushell = {
enable = true;
envFile = {
text = ''
$env.EDITOR = hx
$env.GIT_EDITOR = $env.EDITOR
$env.DEBMAIL = "tyler@tylermayoff.com"
$env.XDG_CONFIG_HOME = "$HOME/.config"
$env.XDG_CACHE_HOME = "$HOME/.cache"
$env.XDG_DATA_HOME = "$HOME/.local/share"
$env.XDG_STATE_HOME = "$HOME/.local/state"
zoxide init nushell | save -f ~/.config/nushell/zoxide.nu
'';
};
shellAliases = {
# Git
gc = "git commit";
gcm = "git commit -m";
gac = "git add . and git commit";
gacp = "gac and git push";
gs = "git status";
yac = "yadm add --interactive and yadm commit";
yacp = "yac and yadm push";
# nix
flake = "nix flake";
# home-manager
hm-upgrade = "nix flake update --flake ~/.config/home-manager/";
hm-update = "home-manager switch --impure";
};
configFile = {
text = ''
source ~/.config/nushell/zoxide.nu
'';
};
};
}

View file

@ -0,0 +1,7 @@
{pkgs, ...}: {
imports = [../common.nix];
home.packages = with pkgs; [
ventoy
];
}