move home-manager config to subdirectory

This commit is contained in:
Daniel Olsen
2024-08-17 03:17:40 +02:00
parent 08930ba021
commit a6f2ac0868
23 changed files with 1 additions and 7 deletions

35
home/profiles/audio.nix Normal file
View File

@@ -0,0 +1,35 @@
{pkgs, config, lib, ...}:
let
cfg = config.profiles.audio;
audio-plugins = pkgs.symlinkJoin { name = "audio-plugins"; paths = [ pkgs.lsp-plugins pkgs.speech-denoiser ];};
in
{
options.profiles.audio = {
enable = lib.mkOption {
default = config.profiles.xsession.enable;
defaultText = "xsession.enable";
};
fancy = lib.mkOption {
default = cfg.enable;
defaultText = "audio.enable";
};
};
config = lib.mkIf config.profiles.audio.enable {
home.packages = with pkgs; [
] ++ lib.optionals config.profiles.gui.enable (with pkgs; [
pavucontrol
]) ++ lib.optionals (config.nixpkgs.config.allowUnfree && config.profiles.gui.enable) (with pkgs; [
spotify
]) ++ lib.optionals cfg.fancy (with pkgs; [
carla
]);
home.file."audio-plugins" = lib.mkIf cfg.fancy {
source = "${audio-plugins}/lib";
target = "audio-plugins";
};
};
}

View File

@@ -0,0 +1,328 @@
{ config, lib, pkgs, ... }:
let
cfg = config.profiles.base;
in
{
options.machine = {
name = lib.mkOption {
type = lib.types.str;
};
cores = lib.mkOption {
type = lib.types.ints.positive;
default = 1;
};
systemd = lib.mkOption {
type = lib.types.bool;
default = true;
};
eth = lib.mkOption { };
wlan = lib.mkOption { };
secondary-fs = lib.mkOption {
type = lib.types.nullOr lib.types.nonEmptyStr;
default = null;
example = "''${env:HOME}";
};
};
options.profiles.base = {
enable = lib.mkEnableOption "The base profile, should be always enabled";
plus = lib.mkEnableOption "Useful things you arguably don't NEED";
};
config = lib.mkIf cfg.enable {
home.language = {
base = "nb_NO.utf8";
messages = "en_US.utf8";
};
home.packages = with pkgs; [
unstable.nix-output-monitor
nix-top
nix-index
nix-tree
unstable.comma
openvpn
ldns
mtr
nmap
inetutils
httpie
lsof
htop
progress
file
bintools
gh
tmux
timewarrior
unzip
p7zip
yt-dlp
parallel
sshfs
jq
ncdu
bat
eza
ripgrep
gregctl
] ++ lib.optionals cfg.plus [
ffmpeg-full
] ++ lib.optionals config.profiles.gui.enable [
mpv
sxiv
gnome3.eog
dolphin
plasma5Packages.dolphin-plugins
ffmpegthumbs
plasma5Packages.kdegraphics-thumbnailers
plasma5Packages.kio
plasma5Packages.kio-extras
krename
konsole # https://bugs.kde.org/show_bug.cgi?id=407990 reeee
gedit
gimp
] ++ lib.optionals (config.profiles.gui.enable && cfg.plus) [
mumble
# texlive.combined.scheme-full
# kile
libreoffice
thunderbird
kdenlive
frei0r
audacity
inkscape
blender
mkvtoolnix
] ++ lib.optionals (config.profiles.gui.enable && (config ? nixpkgs && config.nixpkgs.config.allowUnfree) ) [
# geogebra
];
programs.firefox = {
enable = config.profiles.gui.enable;
profiles = {
daniel = {
settings = {
"browser.startup.homepage" = "https://nixos.org";
};
bookmarks = {
"NixOS Options" = {
keyword = "nxo";
url = "https://search.nixos.org/options?query=%s";
};
"NixOS Packages" = {
keyword = "nxp";
url = "https://search.nixos.org/packages?query=%s";
};
"Home-Manager Options" = {
keyword = "hm";
url = "https://rycee.gitlab.io/home-manager/options.html#opt-%s";
};
};
extensions = with pkgs.nur.repos.rycee.firefox-addons; [ cookies-txt no-pdf-download sponsorblock ublock-origin ];
};
};
};
programs.obs-studio.enable = (config.profiles.gui.enable && cfg.plus);
programs.tealdeer.enable = true;
programs.helix = {
enable = true;
package = pkgs.helix;
settings = let
b = command: ":insert-output " + command;
c = chars: b "printf " + chars;
in {
editor.line-number = "relative";
editor.mouse = false;
keys.normal = {
# Empty keys: Ø, æ, Æ, å, Å, *, [ ]
"ø" = "collapse_selection"; # For ;
"minus" = "search"; # For /
"_" = "rsearch"; # for =
"+" = "trim_selections"; # for _
"å" = {
"d" = "goto_prev_diag"; # for [d
"D" = "goto_first_diag";
"f" = "goto_prev_function";
"c" = "goto_prev_class";
"a" = "goto_prev_parameter";
"o" = "goto_prev_comment";
"p" = "goto_prev_paragraph";
"space" = "add_newline_above";
};
"¨" = {
"d" = "goto_next_diag";
"D" = "goto_last_diag";
"f" = "goto_next_function";
"c" = "goto_next_class";
"a" = "goto_next_parameter";
"o" = "goto_next_comment";
"p" = "goto_next_paragraph";
"space" = "add_newline_below";
};
};
keys.insert = {
"S-tab" = "unindent";
# Poor man's US-Keyboard
"Å" = [(c "{}") "move_char_right"];
"º" = c "Å";
"^" = c "}";
"¤" = c "^";
};
};
};
programs.vscode = {
enable = config.profiles.gui.enable;
package = pkgs.vscodium;
extensions = with pkgs.vscode-extensions; [
bbenoist.nix
matklad.rust-analyzer
vadimcn.vscode-lldb
] ++ lib.optionals config.nixpkgs.config.allowUnfree [
ms-vsliveshare.vsliveshare
];
userSettings = {
"editor.insertSpaces" = false;
"terminal.integrated.fontFamily" = "MesloLGS NF";
};
};
programs.git = {
enable = true;
userEmail = "daniel.olsen99@gmail.com";
userName = "Daniel Olsen";
aliases = {
absorb = "!${pkgs.git-absorb}/bin/git-absorb";
revise = "!${pkgs.git-revise}/bin/git-revise";
rc = "rebase --continue";
n = "!git commit --all --amend --no-edit && git rc";
};
ignores = [
".envrc"
".direnv"
".devenv"
".vscode"
];
extraConfig = {
pull.rebase = true;
sequence.editor = let
# girt = pkgs.unstable.git-interactive-rebase-tool.overrideAttrs (old: rec {
# src = pkgs.fetchFromGitHub {
# owner = "Dali99";
# repo = "git-interactive-rebase-tool";
# rev = "590f87d8ed16992373e214bca5994f89c69fa942";
# sha256 = "sha256-vUjqnt5ZSpzoohkzDXEqTMhMEkYzPMUZiaYWS0ZQcPQ=";
# };
# cargoDeps = old.cargoDeps.overrideAttrs (oldB: {
# name = "${oldB.name}";
# inherit src;
# outputHash = "sha256-/I465/PlOckvov9PgSCg7CN5hEKeeQCw8rPsvpKJons=";
# });
# });
girt = pkgs.git-interactive-rebase-tool;
in "${girt}/bin/interactive-rebase-tool";
branch.sort = "-committerdate";
gpg.format = "ssh";
user.signingKey = "~/.ssh/id_rsa.pub";
};
delta.enable = true;
};
programs.ssh = {
enable = true;
matchBlocks = {
"lilith" = {
hostname = "lilith.daniel";
user = "dandellion";
};
"desktop" = {
hostname = "desktop.daniel";
user = "dan";
};
"ubuntu-ai" = {
hostname = "100.64.0.2";
port = 2222;
user = "daniel";
};
"laptop" = {
hostname = "laptop.daniel";
user = "daniel";
};
"pvv.ntnu.no" = {
user = "danio";
};
"*.pvv.ntnu.no" = {
user = "danio";
};
"pascal" = {
hostname = "wiki.wackattack.eu";
port = 1337;
user = "dandellion";
};
"ireul" = {
hostname = "62.92.111.85";
port = 1337;
user = "dandellion";
};
"gitlab.stud.idi.ntnu.no" = {
proxyJump = "login.pvv.ntnu.no";
};
};
};
services.gpg-agent = {
enable = true;
defaultCacheTtl = 1800;
enableSshSupport = true;
};
home.sessionVariables = {
EDITOR = "hx";
GRZEGORZ_DEFAULT_API_BASE = "https://georg.pvv.ntnu.no/api";
};
xdg.mimeApps = {
enable = true;
defaultApplications = {
"image/png" = [ "sxiv.desktop" "gimp.desktop" ];
"image/jpeg" = [ "sxiv.desktop" ];
"text/plain" = [ "Helix.desktop" "gedit.desktop" "code.desktop" ];
"video/x-matroska" = [ "mpv.desktop" ];
};
associations.removed = {
"text/plain" = [ "writer.desktop" ];
};
};
fonts.fontconfig.enable = config.profiles.gui.enable;
};
}

11
home/profiles/default.nix Normal file
View File

@@ -0,0 +1,11 @@
{
imports = [
./base
./xsession
./audio.nix
./zsh
./gui.nix
./non-nixos.nix
./games
];
}

View File

@@ -0,0 +1,33 @@
{ config, lib, pkgs, ... }:
let
cfg = config.profiles.games;
gui = config.profiles.gui;
in {
options.profiles.games = {
enable = lib.mkEnableOption "Whether or not to install video game software";
};
config = lib.mkIf cfg.enable {
home.packages = with pkgs; [
fortune
lolcat
neofetch
pipes
] ++ lib.optionals config.profiles.gui.enable [
steam
unstable.prismlauncher
# minetest
# dwarf-fortress-packages.dwarf-fortress-full
# superTuxKart
# warsow
# xonotic
# zeroad
# nur.repos.ivar.sm64ex
# dolphinEmuMaster
];
};
}

11
home/profiles/gui.nix Normal file
View File

@@ -0,0 +1,11 @@
{ config, lib, pkgs, ... }:
let
cfg = config.profiles.base;
in {
options.profiles.gui = {
enable = lib.mkEnableOption "Whether or not to install programs with user-interfaces";
};
}

View File

@@ -0,0 +1,11 @@
{ config, lib, pkgs, ... }:
let
cfg = config.profiles.non-nixos;
in {
options.profiles.non-nixos = {
enable = lib.mkEnableOption "Whether or not the profile is running on non-nixos";
};
}

View File

@@ -0,0 +1,188 @@
{ pkgs, config, lib, ... }:
let
cfg = config.profiles.xsession;
non-nixos = config.profiles.non-nixos;
mkGL = program: "${lib.strings.optionalString non-nixos.enable "${pkgs.nixgl.auto.nixGLDefault}/bin/nixGL "}${program}";
execScope = program: "exec bash -c \"systemd-run --user --scope --unit='app-i3-exec-$RANDOM' -p CollectMode=inactive-or-failed -p MemoryHigh=85% -p MemoryMax=92% -p MemorySwapMax=5G -p MemoryAccounting=true \"${program}\"\"";
in
{
imports = [ ./dunstrc.nix ./terminal.nix ./polybar.nix ];
options.profiles.xsession = {
enable = lib.mkEnableOption "Whether or not to control the xsession";
};
config = lib.mkIf cfg.enable {
profiles.gui.enable = true;
systemd.user.slices.app.Slice = {
MemoryHigh="90%";
MemoryMax="94%";
MemorySwapMax="8G";
CPUQuota="${toString ((config.machine.cores - 1)*100)}%";
MemoryAccounting = true;
};
home.keyboard = {
layout = "no";
variant = "nodeadkeys";
};
services.random-background = {
enable = false;
imageDirectory = "${pkgs.dan.wallpapers}";
interval = "30m";
};
services.dunst.enable = false;
xsession = {
enable = true;
initExtra = ''
export PATH="$HOME/.config/nixpkgs/nix-dotfiles/bin:$PATH"
export XDG_CURRENT_DESKTOP=kde
export DESKTOP_SESSION=kde
'';
windowManager = {
i3.enable = true;
i3.config = {
modifier = "Mod4";
terminal = "${pkgs.kitty}/bin/kitty";
keybindings = let
modifier = config.xsession.windowManager.i3.config.modifier;
dmenu = if config.machine.systemd then "${../../scripts/dmenu_run_systemd}" else "dmenu_run";
in lib.mkOptionDefault {
"${modifier}+0" = "workspace 10";
"${modifier}+Shift+0" = "move container to workspace 10";
"${modifier}+Tab" = "workspace next";
"${modifier}+Shift+Tab" = "workspace prev";
"XF86AudioRaiseVolume" = "exec --no-startup-id ${pkgs.pulseaudio}/bin/pactl set-sink-volume 0 +5%";
"XF86AudioLowerVolume" = "exec --no-startup-id ${pkgs.pulseaudio}/bin/pactl set-sink-volume 0 -5%";
"XF86AudioMute" = "exec --no-startup-id ${pkgs.pulseaudio}/bin/pactl set-sink-mute 0 toggle";
"XF86AudioMicMute" = "exec --no-startup-id ${pkgs.pulseaudio}/bin/pactl set-source-mute 1 toggle";
# Georg volume controls
"Shift+XF86AudioRaiseVolume" = "exec --no-startup-id ${lib.getExe pkgs.gregctl} set-volume -- +5%";
"Shift+XF86AudioLowerVolume" = "exec --no-startup-id ${lib.getExe pkgs.gregctl} set-volume -- -5%";
"Shift+XF86AudioMute" = "exec --no-startup-id ${lib.getExe pkgs.gregctl} toggle";
"XF86MonBrightnessUp" = "exec --no-startup-id brightnessctl set +5%";
"XF86MonBrightnessDown" = "exec --no-startup-id brightnessctl set 5%-";
"Print" = "exec scrot %Y-%m-%d_$wx$h_scrot.png -z -e 'mv $f /home/daniel/Pictures/screenshots/'";
"${modifier}+Print" = "exec scrot /home/daniel/Pictures/Screenshots/%Y-%m-%d_$wx$h_scrot.png -z";
"${modifier}+l" = "exec ${pkgs.writers.writeBash "hello_world" ''
dunstctl set-paused true
${pkgs.i3lock}/bin/i3lock -n -i ~/images/wallpapers/locked.png
dunstctl set-paused false
''}";
"XF86Display" = "exec arandr";
"${modifier}+Shift+U" = "exec $HOME/.config/nixpkgs/nix-dotfiles/scripts/dmenuunicode";
"${modifier}+Shift+s" = "exec $HOME/.config/nixpkgs/nix-dotfiles/scripts/dmenuaudio";
"${modifier}+Shift+v" = "exec ${pkgs.writers.writeBash "switch_audio" ''
if pw-link -l | grep "^VirtualMic:input_FL" -A 2 | grep FilteredMic; then
${pkgs.pipewire}/bin/pw-link -d "FilteredMic:capture_MONO" "VirtualMic:input_FL"
${pkgs.pipewire}/bin/pw-link -d "FilteredMic:capture_MONO" "VirtualMic:input_FR"
${pkgs.pipewire}/bin/pw-link "VoiceChanger:monitor_FL" "VirtualMic:input_FL"
${pkgs.pipewire}/bin/pw-link "VoiceChanger:monitor_FR" "VirtualMic:input_FR"
${pkgs.pipewire}/bin/pw-link "VoiceChanger:monitor_FL" "VirtualHeadset:playback_FL"
${pkgs.pipewire}/bin/pw-link "VoiceChanger:monitor_FR" "VirtualHeadset:playback_FR"
else
${pkgs.pipewire}/bin/pw-link "FilteredMic:capture_MONO" "VirtualMic:input_FL"
${pkgs.pipewire}/bin/pw-link "FilteredMic:capture_MONO" "VirtualMic:input_FR"
${pkgs.pipewire}/bin/pw-link -d "VoiceChanger:monitor_FL" "VirtualMic:input_FL"
${pkgs.pipewire}/bin/pw-link -d "VoiceChanger:monitor_FR" "VirtualMic:input_FR"
${pkgs.pipewire}/bin/pw-link -d "VoiceChanger:monitor_FL" "VirtualHeadset:playback_FL"
${pkgs.pipewire}/bin/pw-link -d "VoiceChanger:monitor_FR" "VirtualHeadset:playback_FR"
fi
''}";
"${modifier}+d" = "exec ${dmenu}";
"${modifier}+n" = execScope "dolphin";
"${modifier}+b" = execScope "firefox";
"${modifier}+t" = execScope "gedit";
"${modifier}+Return" = execScope "kitty";
"${modifier}+Shift+Return" = execScope "kitty -e ssh dandellion@lilith";
};
startup = [
{
command = "${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1";
always = false;
#notification = false;
}
];
window = {
titlebar = false;
hideEdgeBorders = "smart";
};
floating.criteria = [
{ title = "Steam - Update News"; }
];
};
i3.extraConfig = ''
for_window [title="Steam Big Picture Mode"] floating enable, resize set 1920 1080, move position 0 0, border pixel 0
'';
};
};
services.picom = {
enable = true;
backend = "xrender";
};
gtk = {
enable = true;
theme = {
package = pkgs.breeze-gtk;
name = "Breeze";
};
iconTheme = {
package = pkgs.breeze-icons;
name = "breeze";
};
};
# qt = {
# enable = true;
# platformTheme = "gtk";
# };
xsession.windowManager.command = lib.mkIf non-nixos.enable (lib.mkForce "${pkgs.nixgl.auto.nixGLDefault}/bin/nixGL ${config.xsession.windowManager.i3.package}/bin/i3");
home.packages = [
pkgs.brightnessctl
pkgs.xorg.xkill
pkgs.arandr
pkgs.dunst
pkgs.libnotify
pkgs.dmenu
pkgs.scrot
pkgs.neofetch
#pkgs.dan.colors
pkgs.xclip
pkgs.dejavu_fonts
pkgs.source-code-pro
pkgs.breeze-qt5
pkgs.breeze-icons
];
};
}

View File

@@ -0,0 +1,167 @@
{pkgs, config, lib, ...}:
{
config = lib.mkIf config.profiles.xsession.enable {
home.file.dunst = {
target = ".config/dunst/dunstrc";
text = ''
[global]
monitor = 0
follow = keyboard
geometry = "350x5-0+24"
indicate_hidden = yes
shrink = yes
transparency = 20
notification_height = 0
separator_height = 2
padding = 0
horizontal_padding = 8
frame_width = 3
frame_color = "#282828"
# Define a color for the separator.
# possible values are:
# * auto: dunst tries to find a color fitting to the background;
# * foreground: use the same color as the foreground;
# * frame: use the same color as the frame;
# * anything else will be interpreted as a X color.
separator_color = frame
# Sort messages by urgency.
sort = yes
idle_threshold = 120
font = Monospace 11
line_height = 0
markup = full
# The format of the message. Possible variables are:
# %a appname
# %s summary
# %b body
# %i iconname (including its path)
# %I iconname (without its path)
# %p progress value if set ([ 0%] to [100%]) or nothing
# %n progress value if set without any extra characters
# %% Literal %
# Markup is allowed
format = "%s\n%b"
alignment = left
show_age_threshold = 60
word_wrap = yes
ellipsize = middle
ignore_newline = no
stack_duplicates = true
hide_duplicate_count = true
show_indicators = yes
icon_position = left
max_icon_size = 40
#icon_path = /usr/share/icons/gnome/16x16/status/:/usr/share/icons/gnome/16x16/devices/:/usr/share/icons/Adwaita/256x256/status/
sticky_history = yes
history_length = 20
dmenu = ${pkgs.dmenu}/bin/dmenu -p dunst:
browser = ${pkgs.firefox}/bin/firefox -new-tab
# Always run rule-defined scripts, even if the notification is suppressed
always_run_script = true
title = Dunst
class = Dunst
startup_notification = false
force_xinerama = false
[experimental]
per_monitor_dpi = false
[shortcuts]
# Needs to change to alt/super
close = mod1+space
close_all = mod1+shift+space
history = mod1+bar
context = mod1+period
[urgency_low]
# IMPORTANT: colors have to be defined in quotation marks.
# Otherwise the "#" and following would be interpreted as a comment.
background = "#282828"
foreground = "#928374"
timeout = 5
# Icon for notifications with low urgency, uncomment to enable
#icon = /path/to/icon
[urgency_normal]
background = "#458588"
foreground = "#ebdbb2"
timeout = 5
[urgency_critical]
background = "#cc2421"
foreground = "#ebdbb2"
frame_color = "#fabd2f"
timeout = 0
# Every section that isn't one of the above is interpreted as a rules to
# override settings for certain messages.
# Messages can be matched by "appname", "summary", "body", "icon", "category",
# "msg_urgency" and you can override the "timeout", "urgency", "foreground",
# "background", "new_icon" and "format".
# Shell-like globbing will get expanded.
#
# SCRIPTING
# You can specify a script that gets run when the rule matches by
# setting the "script" option.
# The script will be called as follows:
# script appname summary body icon urgency
# where urgency can be "LOW", "NORMAL" or "CRITICAL".
#
# NOTE: if you don't want a notification to be displayed, set the format
# to "".
# NOTE: It might be helpful to run dunst -print in a terminal in order
# to find fitting options for rules.
#[espeak]
# summary = "*"
# script = dunst_espeak.sh
#[script-test]
# summary = "*script*"
# script = dunst_test.sh
#[ignore]
# # This notification will not be displayed
# summary = "foobar"
# format = ""
#[history-ignore]
# # This notification will not be saved in history
# summary = "foobar"
# history_ignore = yes
#[signed_on]
# appname = Pidgin
# summary = "*signed on*"
# urgency = low
#
#[signed_off]
# appname = Pidgin
# summary = *signed off*
# urgency = low
#
#[says]
# appname = Pidgin
# summary = *says*
# urgency = critical
#
#[twitter]
# appname = Pidgin
# summary = *twitter.com*
# urgency = normal
#
# vim: ft=cfg
'';
};
};
}

View File

@@ -0,0 +1,267 @@
{ pkgs, config, lib, ... }:
let
cfg = config.profiles.xsession;
in
{
config = lib.mkIf cfg.enable {
xsession.windowManager.i3.config = {
bars = [];
startup = [
{ command = "systemctl --user restart polybar"; always = true; notification = false; }
];
};
services.polybar = {
enable = true;
package = pkgs.polybar.override {
i3Support = true;
};
script = "polybar bot &";
config = {
"colors" = {
background = "#B2000000";
background-alt = "#444";
foreground = "#dfdfdf";
foreground-alt = "#BBB";
primary = "#ffb52a";
secondary = "#e60053";
alert = "#bd2c40";
};
"bar/bot" = {
bottom = true;
width = "100%";
height = 27;
font-0 = "MesloLGS NF:fontformat=truetype:pixelsize=11;1";
font-1 = "Kozuka Mincho Pro:pixelsize=11;1";
background = "\${colors.background}";
foreground = "\${colors.foreground}";
padding-left = "0";
padding-right = "2";
module-margin-left = "1";
module-margin-right = "2";
modules-left = "i3 title";
modules-right = "countdown minecraft wlan eth filesystem uquota cpu memory battery date";
};
"module/i3" = {
type = "internal/i3";
format = "<label-state> <label-mode>";
scroll-up = "i3wm-wsnext";
scroll-down = "i3wm-wsprev";
label-mode-padding = "0";
label-mode-foreground = "#000";
label-mode-background = "\${colors.primary}";
label-focused = "%index%";
label-focused-background = "\${colors.background-alt}";
label-focused-underline= "\${colors.primary}";
label-focused-padding = "1";
label-unfocused = "%index%";
label-unfocused-padding = "1";
label-visible = "%index%";
label-visible-background = "\${self.label-focused-background}";
label-visible-underline = "\${self.label-focused-underline}";
label-visible-padding = "\${self.label-focused-padding}";
label-urgent = "%index%";
label-urgent-background = "\${colors.alert}";
label-urgent-padding = "1";
};
"module/title" = {
type = "internal/xwindow";
label-maxlen = 40;
};
"module/wlan" = lib.mkIf (config.machine.wlan != null) {
type = "internal/network";
interface = config.machine.wlan;
interval = "3.0";
format-connected = "<ramp-signal> <label-connected>";
format-connected-underline = "#9f78e1";
label-connected = "(%signal%% on %essid%) %local_ip%";
format-disconnected = "";
ramp-signal-0 = "";
ramp-signal-1 = "";
ramp-signal-2 = "";
ramp-signal-3 = "";
ramp-signal-4 = "";
ramp-signal-foreground = "\${colors.foreground-alt}";
};
"module/eth" = lib.mkIf (config.machine.eth != null)
{
type = "internal/network";
interface = "${config.machine.eth}";
interval = "3.0";
format-connected-underline = "#55aa55";
format-connected-prefix = " ";
format-connected-prefix-foreground = "\${colors.foreground-alt}";
label-connected = "%local_ip%";
format-disconnected = "";
};
"module/filesystem" = {
type = "internal/fs";
interval = 25;
mount-0 = "/";
mount-1 = lib.mkIf (config.machine.secondary-fs != null) config.machine.secondary-fs;
label-mounted = "%{F#0a81f5}%mountpoint%%{F-}: %free%";
label-unmounted = "%mountpoint% not mounted";
label-unmounted-foreground = "\${colors.foreground-alt}";
};
"module/cpu" = {
type = "internal/cpu";
interval = 2;
format-prefix = " ";
format-prefix-foreground = "\${colors.foreground-alt}";
format-underline = "#f90000";
label = "%percentage:2%%";
};
"module/memory" = {
type = "internal/memory";
interval = "2";
format-prefix = " ";
format-prefix-foreground = "\${colors.foreground-alt}";
format-underline = "#4bffdc";
label = "%percentage_used%%";
};
"module/battery" = {
type = "internal/battery";
battery = "BAT0";
adapter = "AC";
format-charging = "<animation-charging> <label-charging>";
format-charging-underline = "#ffb52a";
format-discharging = "<animation-discharging> <label-discharging>";
format-discharging-underline = "\${self.format-charging-underline}";
format-full-prefix-foreground = "\${colors.foreground-alt}";
format-full-underline = "\${self.format-charging-underline}";
ramp-capacity-foreground = "\${colors.foreground-alt}";
format-full-prefix = " ";
ramp-capacity-0 = "";
ramp-capacity-1 = "";
ramp-capacity-2 = "";
animation-charging-0 = "";
animation-charging-1 = "";
animation-charging-2 = "";
animation-charging-foreground = "\${colors.foreground-alt}";
animation-charging-framerate = "750";
animation-discharging-0 = "";
animation-discharging-1 = "";
animation-discharging-2 = "";
animation-discharging-foreground = "\${colors.foreground-alt}";
animation-discharging-framerate = "750";
};
"module/date" = {
type = "internal/date";
internal = 5;
date = "%Y-%m-%d";
time = "%H:%M:%S";
label = "%date% %time%";
};
"module/countdown" = {
type = "custom/script";
exec-if = "test -f $HOME/countdown";
exec = "" + pkgs.writers.writeBash "countdown" ''
secs=$(( $(${pkgs.coreutils}/bin/date +%s -d $(${pkgs.coreutils}/bin/cat $HOME/countdown)) - $( ${pkgs.coreutils}/bin/date +%s ) ))
printf '%d:%02d:%02d:%02d\n' $((secs/86400)) $((secs%86400/3600)) $((secs%3600/60)) $((secs%60))
'';
interval = 1;
};
"module/minecraft" = {
type = "custom/script";
exec = "" + pkgs.writers.writePython3 "minecraft_status" {
libraries = with pkgs.python3.pkgs; [ mcstatus notify2 ];
flakeIgnore = [ "E722" ];
} ''
from mcstatus import JavaServer
import signal
from time import sleep
import notify2
pvv = JavaServer.lookup("minecraft.pvv.ntnu.no")
dods = JavaServer.lookup("mc.dodsorf.as")
def getPlayers(server):
try:
status = server.status()
except:
return []
else:
return status.players.sample or []
def build_players(list, server):
result = ""
if len(list) > 0:
result += server + ": "
for player in list:
result += player.name + " "
return result + "\n"
def display_players(pvv, dods):
result = build_players(getPlayers(pvv), "PVV")
result += build_players(getPlayers(dods), "DODS")
return result
def peek(*_):
result = display_players(pvv, dods)
notify2.init('Minecraft Server Status')
n = notify2.Notification("Minecraft Server Status", result)
n.show()
main()
signal.signal(signal.SIGUSR1, peek)
def main():
while True:
result = ""
pvvs = getPlayers(pvv)
dodss = getPlayers(dods)
if len(pvvs) > 0:
result += "P" + str(len(pvvs))
if len(dodss) > 0:
result += "D" + str(len(dodss))
print(result, flush=True)
sleep(5)
main()
'';
click-left = "kill -USR1 %pid%";
# interval =
tail = true;
format = " <label>";
};
};
};
};
}

View File

@@ -0,0 +1,32 @@
{ pkgs, config, lib, ...}:
{
config = lib.mkIf config.profiles.xsession.enable {
home.file.kitty = {
target = ".config/kitty/kitty.conf";
text = ''
#term xterm-256color
font_family MesloLGS NF
font_size 12.0
background_opacity 0.7
clear_all_shortcuts yes
map ctrl+shift+c copy_to_clipboard
map ctrl+shift+v paste_from_clipboard
map ctrl+plus change_font_size all +2.0
map ctrl+shift+plus change_font_size all -2.0
'';
};
home.packages = [
pkgs.kitty
pkgs.ncurses.dev
];
};
}

View File

@@ -0,0 +1,87 @@
{ pkgs, config, lib, ... }:
let
cfg = config.profiles.zsh;
in
{
options.profiles.zsh = {
enable = lib.mkEnableOption "Manage zsh from hm";
};
config = lib.mkIf cfg.enable {
programs.zsh = {
enable = true;
dotDir = ".config/zsh";
autosuggestion.enable = true;
enableCompletion = true;
history = {
expireDuplicatesFirst = true;
ignoreDups = true;
share = false;
};
shellAliases = {
cat = "bat -pp";
ls = "eza";
tree = "eza -T";
df = "df -h";
sysu = "systemctl --user";
jnlu = "journalctl --user";
mpvav1 = "mpv --vd-queue-enable=yes --ad-queue-enable=yes --vd-queue-max-bytes=4000MiB --vd-queue-max-samples=2000000 --vd-queue-max-secs=50";
gst = "git status -sb";
gcm = "git commit -m";
gca = "git commit --amend --no-edit";
grc = "git rc";
gne = "git n";
gds = "git diff --staged";
glg = "git log --oneline";
nano = "hx"; # Behavioral training
};
initExtra = ''
source ${pkgs.zsh-powerlevel10k}/share/zsh-powerlevel10k/powerlevel10k.zsh-theme
source ${./p10k.zsh}
autoload -U down-line-or-beginning-search
autoload -U up-line-or-beginning-search
zle -N down-line-or-beginning-search
zle -N up-line-or-beginning-search
bindkey '^[OA' up-line-or-beginning-search
bindkey '^[OB' down-line-or-beginning-search
bindkey '^[[1;5D' backward-word
bindkey '^[[1;5C' forward-word
bindkey '^H' backward-kill-word
bindkey '^[OH' beginning-of-line
bindkey '^[OF' end-of-line
bindkey '^[[3~' delete-char
ZLE_RPROMPT_INDENT=0
'';
};
programs.direnv = {
enable = true;
};
programs.atuin = {
enable = true;
enableZshIntegration = true;
settings = {
filter_mode = "directory";
filter_mode_shell_up_key_binding = "session";
};
};
programs.zoxide.enable = true;
home.packages = lib.optionals (config.profiles.gui.enable && config ? nixpkgs) [
pkgs.dan.mesloNFp10k
];
};
}

1639
home/profiles/zsh/p10k.zsh Normal file

File diff suppressed because it is too large Load Diff