remake dir structure for home-manager

This commit is contained in:
insects 2024-08-21 15:55:14 +02:00
parent 9415d40508
commit 3151b79560
26 changed files with 9 additions and 9 deletions

View file

@ -0,0 +1,17 @@
# Configures programs that primarily run via the command line
{ pkgs, ... }:
{
imports = [
./fish.nix # fish shell configuration
./neovim.nix # neovim configuration, my "escape" editor
./lazygit.nix # my preferred git porcellain
./direnv.nix # smart cding
./mise.nix # version management for tools
];
# stuff that doesn't fit into any other files
home.packages = with pkgs; [
comma # nix-shell a package by prefixing it with `,`
ripgrep # well, it's grep
];
}

View file

@ -0,0 +1,7 @@
{ ... }:
{
programs.direnv = {
enable = true;
nix-direnv.enable = true;
};
}

144
home/features/cli/fish.nix Normal file
View file

@ -0,0 +1,144 @@
{ pkgs, ... }:
{
programs.fish = {
enable = true;
functions = {
setpath = "test -e $argv[1]; and fish_add_path $argv[1]";
};
interactiveShellInit = ''
if test -z "$XDG_RUNTIME_DIR"
set -x XDG_RUNTIME_DIR "/tmp/$USER-runtime-dir"
if test ! -e "$XDG_RUNTIME_DIR"
mkdir "$XDG_RUNTIME_DIR"
chmod 0700 "$XDG_RUNTIME_DIR"
end
end
setpath /opt/local/bin
setpath /opt/homebrew/bin
setpath ~/.cargo/bin
setpath ~/.ghcup/bin
setpath ~/.cabal/bin
setpath ~/.local/bin
setpath ~/.bun/bin
setpath ~/Projects/Checkouts/arcanist/bin
set -x EDITOR nvim
set -x USER lu
set -x SHELL (which fish)
set -x TERM xterm-256color
set -x LANG en_US.UTF-8
set -x LC_ALL en_US.UTF-8
set -x LC_CTYPE en_US.UTF-8
set -x LANGUAGE en_US.UTF-8
'';
shellAbbrs = {
# General aliases
c = "clear";
ll = "ls -lahF --color=always";
e = "$EDITOR";
se = "sudoedit";
"cd.." = "cd ../";
rmrf = "rm -rf";
# overrides of defaults
mkdir = "mkdir -p";
cp = "cp -r";
scp = "scp -r";
apt = "sudo apt";
doc = "sudo docker";
docker = "sudo docker";
sctl = "sudo systemctl";
usctl = "systemctl --user";
doco = "sudo docker-compose";
# z is a weird key to hit frequently, j is much better
j = "z";
# cargoes and rust-s
cg = "cargo";
cr = "cargo run";
cb = "cargo build";
ct = "cargo test";
cwr = "cargo watch -x run";
# rubies
be = "bundle exec";
# cd into a temp directory, very useful!
mkt = "cd (mktemp -d)";
# tmux aliases
tx = "tmux";
txls = "tmux list-sessions";
txa = "tmux attach";
# git aliases
lg = "lazygit";
g = "git";
ga = "git add";
gs = "git status --short";
gl = "git log --color --graph --abbrev-commit --oneline";
gqp = "git add --all; and git commit; and git push";
gqc = "git add --all; and git commit";
gpl = "git pull";
gps = "git push";
gc = "git commit";
gb = "git branch";
gaa = "git add --all";
gco = "git checkout";
editorigin = "git remote set-url origin";
# nix aliases
n = "nix";
nd = "nix develop";
ns = "nix shell";
np = "nix profile";
ngc = "nix-collect-garbage";
hm = "home-manager";
hmreload = "cd ~/nix-config && home-manager switch --flake .#(whoami)@(hostname) && cd -";
hminplace = "home-manager switch --flake .#(whoami)@(hostname)";
nmreload = "cd ~/nix-config && sudo nixos-rebuild switch --flake .";
nminplace = "sudo nixos-rebuild switch --flake .";
};
plugins = [
{
name = "done";
src = pkgs.fishPlugins.done.src;
}
{
name = "pisces";
src = pkgs.fishPlugins.pisces.src;
}
{
name = "plugin-foreign-env";
src = pkgs.fetchFromGitHub {
owner = "oh-my-fish";
repo = "plugin-foreign-env";
rev = "7f0cf099ae1e1e4ab38f46350ed6757d54471de7";
sha256 = "0d16mdgjdwln41zk44qa5vcilmlia4w15r8z2rc3p49i5ankksg3";
};
}
];
};
programs.starship = {
enable = true;
enableFishIntegration = true;
settings = {
character = {
success_symbol = "[~](green)";
error_symbol = "[~](red)";
};
};
};
programs.zoxide = {
enable = true;
enableFishIntegration = true;
};
}

View file

@ -0,0 +1,4 @@
{ ... }:
{
programs.lazygit.enable = true;
}

View file

@ -0,0 +1,16 @@
{ pkgs, ... }:
{
home.packages = with pkgs; [
python3 # needed for installing node.js
];
programs.mise = {
enable = true;
enableFishIntegration = true;
globalConfig = {
tools = {
node = "lts";
};
};
};
}

View file

@ -0,0 +1,25 @@
{ pkgs, ... }:
{
programs.neovim = {
enable = true;
extraPackages = with pkgs; [
# LazyVim
lua-language-server
stylua
# Telescope
ripgrep
];
plugins = with pkgs.vimPlugins; [
lazy-nvim
];
};
home.sessionVariables.EDITOR = "nvim";
xdg.configFile."nvim/init.lua".source = ../../../dotfiles/nvim/init.lua;
xdg.configFile."nvim/stylua.toml".source = ../../../dotfiles/nvim/stylua.toml;
xdg.configFile."nvim/.neoconf.json".source = ../../../dotfiles/nvim/.neoconf.json;
xdg.configFile."nvim/lua".source = ../../../dotfiles/nvim/lua;
}

View file

@ -0,0 +1,6 @@
{ pkgs, ... }:
{
home.packages = with pkgs; [
_1password-gui
];
}

View file

@ -0,0 +1,16 @@
{ config, lib, ... }:
{
programs.alacritty = {
enable = true;
settings = {
window.padding = {
x = 10;
y = 10;
};
font = lib.mkForce {
normal.family = config.fontProfiles.bitmap.family;
size = 12;
};
};
};
}

View file

@ -0,0 +1,24 @@
{ pkgs, ... }:
{
imports = [
./font.nix
./firefox.nix
./alacritty.nix
./gtk.nix
./vscode.nix
./1password.nix
];
home.packages = with pkgs; [
vesktop
zed-editor
];
home.sessionVariables = {
MOZ_ENABLE_WAYLAND = 1;
QT_QPA_PLATFORM = "wayland";
LIBSEAT_BACKEND = "logind";
};
xdg.mimeApps.enable = true;
}

View file

@ -0,0 +1,19 @@
{ pkgs, ... }:
{
home.packages = with pkgs; [
fira
];
programs.firefox = {
enable = true;
profiles = {
"user" = {
userChrome = ''
* {
font-family: "Fira Sans";
}
'';
};
};
};
}

View file

@ -0,0 +1,18 @@
{ pkgs, ... }:
{
fontProfiles = {
enable = true;
monospace = {
family = "JetBrains Mono Nerd Font";
package = pkgs.nerdfonts.override { fonts = [ "JetBrainsMono" ]; };
};
regular = {
family = "Fira Sans";
package = pkgs.fira;
};
bitmap = {
family = "TamzenForPowerline";
package = pkgs.tamzen;
};
};
}

View file

@ -0,0 +1,6 @@
{ pkgs, ... }:
{
home.packages = with pkgs; [
xivlauncher
];
}

View file

@ -0,0 +1,6 @@
{ ... }:
{
gtk = {
enable = true;
};
}

View file

@ -0,0 +1,218 @@
{
lib,
config,
pkgs,
...
}:
{
imports = [
../default.nix
../wlr
./swaylock.nix
./swayidle.nix
];
home.packages = with pkgs; [
grimblast
pamixer
playerctl
];
wayland.windowManager.hyprland = {
enable = true;
systemd = {
enable = true;
};
settings = {
general = {
gaps_in = 15;
gaps_out = 20;
border_size = 1;
};
cursor.inactive_timeout = 4;
device = [
{
name = "royuan-akko-keyboard";
kb_layout = "us_intl";
}
];
dwindle = {
split_width_multiplier = 1.35;
pseudotile = true;
};
layerrule = [
"animation fade,hyprpicker"
"animation fade,selection"
"blur,^(wofi)$"
"ignorezero,^(wofi)$"
];
decoration = {
active_opacity = 1.0;
inactive_opacity = 0.85;
fullscreen_opacity = 1.0;
rounding = 7;
blur = {
enabled = true;
size = 4;
passes = 3;
new_optimizations = true;
ignore_opacity = true;
};
drop_shadow = true;
shadow_range = 12;
shadow_offset = "3 3";
};
animations = {
enabled = true;
bezier = [
"easein,0.1, 0, 0.5, 0"
"easeinback,0.35, 0, 0.95, -0.3"
"easeout,0.5, 1, 0.9, 1"
"easeoutback,0.35, 1.35, 0.65, 1"
"easeinout,0.45, 0, 0.55, 1"
];
animation = [
"fadeIn,1,3,easeout"
"fadeLayersIn,1,3,easeoutback"
"layersIn,1,3,easeoutback,slide"
"windowsIn,1,3,easeoutback,slide"
"fadeLayersOut,1,3,easeinback"
"fadeOut,1,3,easein"
"layersOut,1,3,easeinback,slide"
"windowsOut,1,3,easeinback,slide"
"border,1,3,easeout"
"fadeDim,1,3,easeinout"
"fadeShadow,1,3,easeinout"
"fadeSwitch,1,3,easeinout"
"windowsMove,1,3,easeoutback"
"workspaces,1,2.6,easeoutback,slide"
];
};
bindm = [
"SUPER,mouse:272,movewindow"
"SUPER,mouse:273,resizewindow"
];
bind =
let
terminal = "${pkgs.alacritty}/bin/alacritty";
grimblast = lib.getExe pkgs.grimblast;
workspaces = [
"1"
"2"
"3"
"4"
"5"
];
directions = rec {
left = "l";
right = "r";
up = "u";
down = "d";
h = left;
l = right;
k = up;
j = down;
};
in
[
"SUPER,Return,exec,${terminal}"
"SUPERSHIFT,q,killactive" # exit program
"SUPERSHIFT,e,exit" # exit hyprland
"SUPERSHIFT,r,exec,hyprctl reload" # reload currently running hyprland
"SUPER,s,togglesplit" # horizontal split
"SUPER,f,fullscreen,1" # borderless window
"SUPERSHIFT,f,fullscreen,0" # proper fullscreen
"ALTSHIFT,space,togglefloating" # floating window
"SUPER,minus,splitratio,-0.25" # split gets slightly smaller
"SUPERSHIFT,minus,splitratio,-0.3333333" # split gets smaller
"SUPER,equal,splitratio,0.25" # split gets slightly larger
"SUPERSHIFT,equal,splitratio,0.3333333" # split gets larger
"SUPER,g,togglegroup" # make a window group
"SUPER,t,lockactivegroup,toggle" # lock/unlock the current group
"SUPER,tab,changegroupactive,f" # switch to next window in group
"SUPERSHIFT,tab,changegroupactive,p" # switch to prev window in group
"SUPER,dead_grave,workspace,previous" # prev workspace
"SUPER,dead_grave,workspace,next" # next workspace
"SUPER,u,togglespecialworkspace" # toggle special workspace
"SUPERSHIFT,u,movetoworkspacesilent,special" # move to special workspace
",Print,exec,${grimblast} --notify --freeze copy area" # screenshot area
"SHIFT,Print,exec,${grimblast} --notify --freeze copy output" # screenshot all
",XF86AudioRaiseVolume,exec,pamixer -i 5" # raise volume
",XF86AudioLowerVolume,exec,pamixer -d 5" # lower volume
",XF86AudioPlay,exec,playerctl play-pause" # play/pause
",XF86AudioNext,exec,playerctl next" # next song
",XF86AudioPrev,exec,playerctl previous" # previous song
]
++
# change workspace
(map (n: "SUPER,${n},workspace,name:${n}") workspaces)
++
# move window to workspace
(map (n: "SUPERSHIFT,${n},movetoworkspacesilent,name:${n}") workspaces)
++
# move focus
(lib.mapAttrsToList (key: direction: "SUPER,${key},movefocus,${direction}") directions)
++
# swap windows
(lib.mapAttrsToList (key: direction: "SUPERSHIFT,${key},swapwindow,${direction}") directions)
++
# move windows
(lib.mapAttrsToList (
key: direction: "SUPERCONTROL,${key},movewindoworgroup,${direction}"
) directions)
++
# move monitor focus
(lib.mapAttrsToList (key: direction: "SUPERALT,${key},focusmonitor,${direction}") directions)
++
# move workspace to other monitor
(lib.mapAttrsToList (
key: direction: "SUPERALTSHIFT,${key},movecurrentworkspacetomonitor,${direction}"
) directions)
++
# launcher
(
let
wofi = lib.getExe pkgs.wofi;
in
lib.optionals config.programs.wofi.enable [
"SUPER,Space,exec,${wofi} -S drun -W 20% -H 15%"
"SHIFTSUPER,Space,exec,${wofi} -S run -W 20% -H 15%"
]
);
monitor = map (
m:
"${m.name},${
if m.enabled then
"${toString m.width}x${toString m.height}@${toString m.refreshRate},${m.position},${m.scale}"
else
"disable"
}"
) config.monitors;
workspace = map (m: "name:${m.workspace},monitor:${m.name}") (
lib.filter (m: m.enabled && m.workspace != null) config.monitors
);
};
};
}

View file

@ -0,0 +1,22 @@
{ config, ... }:
let
swaylock = "${config.programs.swaylock.package}/bin/swaylock";
in
{
services.swayidle = {
enable = true;
systemdTarget = "graphical-session.target";
events = [
{
event = "before-sleep";
command = "${swaylock} --daemonize";
}
];
# timeouts = [
# {
# timeout = 4 * 60;
# command = "${swaylock} --daemonize --grace 15";
# }
# ];
};
}

View file

@ -0,0 +1,10 @@
{ pkgs, ... }:
{
programs.swaylock = {
enable = true;
package = pkgs.swaylock-effects;
settings = {
effect-blur = "20x3";
};
};
}

View file

@ -0,0 +1,6 @@
{ pkgs, ... }:
{
home.packages = with pkgs; [
vscode
];
}

View file

@ -0,0 +1,30 @@
{ pkgs, ... }:
{
imports = [
./mako.nix
./wofi.nix
./waybar.nix
];
home.packages = with pkgs; [
wf-recorder
wl-clipboard
xdg-utils
nautilus
adwaita-icon-theme
];
programs.imv.enable = true;
xdg.portal = {
enable = true;
extraPortals = [ pkgs.xdg-desktop-portal-wlr ];
config = {
common = {
default = [
"wlr"
];
};
};
};
}

View file

@ -0,0 +1,14 @@
{ config, lib, ... }:
{
services.mako = {
enable = true;
font = lib.mkForce "${config.fontProfiles.regular.family} 12";
padding = "10,20";
anchor = "top-center";
width = 400;
height = 150;
borderSize = 1;
defaultTimeout = 12000;
layer = "overlay";
};
}

View file

@ -0,0 +1,136 @@
{ config, pkgs, ... }:
{
# additional deps for cava support
home.packages = with pkgs; [
iniparser
fftw
];
systemd.user.services.waybar = {
Unit.StartLimitBurst = 30;
# this fixes fonts for some reason
Service.Environment = "PATH=${config.home.profileDirectory}/bin";
};
programs.waybar = {
enable = true;
systemd.enable = true;
settings = {
primary = {
height = 30;
position = "top";
margin-top = 10;
margin-left = 20;
margin-right = 20;
modules-left = [
"hyprland/workspaces"
"hyprland/language"
];
modules-center = [
"cpu"
"clock"
"memory"
];
modules-right = [
"mpris"
"network"
"pulseaudio"
"battery"
"tray"
];
cpu = {
format = "CPU {usage}%";
};
memory = {
format = "MEM {}%";
};
tray = {
spacing = 10;
};
pulseaudio = {
format = "AUD {volume}%";
};
network = {
format = "NET {ipaddr}";
format-disconnected = "NET X";
};
mpris = {
format = "{dynamic}";
interval = 1;
};
"hyprland/language" = {
format = "KBD {}";
format-en = "EN";
format-de = "DE";
};
};
};
style =
let
inherit (config.lib.stylix.colors) withHashtag;
in
''
* {
font-family: ${config.fontProfiles.bitmap.family}, ${config.fontProfiles.monospace.family};
font-size: 11pt;
padding: 0;
}
window#waybar {
padding: 0;
border-radius: 0.5em;
}
#workspaces {
transition: background-color .5s, color .5s;
}
#workspaces button {
padding: 0 6px;
}
#workspaces button.active,
#workspaces button.focused {
background-color: ${withHashtag.base05};
color: ${withHashtag.base00};
}
#cpu,
#memory {
color: ${withHashtag.base04};
}
#mpris {
font-size: 10pt;
margin-right: 6px;
}
#tray {
padding: 0 5px;
background-color: ${withHashtag.base02};
}
#pulseaudio {
color: ${withHashtag.base0D};
}
#network {
color: ${withHashtag.base0C};
}
#language {
color: ${withHashtag.base02};
margin-left: 10px;
}
'';
};
}

View file

@ -0,0 +1,26 @@
{ config, lib, ... }:
{
programs.wofi = {
enable = true;
settings = {
insensitive = true;
allow_markup = true;
run-always_parse_args = true;
run-cache_file = "/dev/null";
run-exec_search = true;
matching = "multi-contains";
};
style = ''
#window {
border: 1px solid ${config.lib.stylix.colors.withHashtag.base05};
font-family: ${config.fontProfiles.bitmap.family};
}
#input {
border-radius: 0;
border: 1px solid ${config.lib.stylix.colors.withHashtag.base05};
border-bottom: 0;
}
'';
};
}

View file

@ -0,0 +1,14 @@
{ pkgs, ... }:
{
imports = [
./php.nix
];
home.packages = with pkgs; [
gcc
gnumake
unzip
openssl
autoconf
];
}

View file

@ -0,0 +1,8 @@
# install php from nixpkgs because mise wants to compile it from source,
# and that's a whole can of beans i'm not getting into
{ pkgs, ... }:
{
home.packages = with pkgs; [
php83
];
}