chore: refactor user modules
This commit is contained in:
@@ -5,9 +5,9 @@
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.modules.bat;
|
||||
cfg = config.home.cli.bat;
|
||||
in {
|
||||
options.modules.bat.extras = mkEnableOption "Enables extra packages for bat.";
|
||||
options.home.cli.bat.extras = mkEnableOption "Enables extra packages for bat.";
|
||||
config.programs.bat = {
|
||||
enable = true;
|
||||
config = {
|
||||
29
users/modules/cli/default.nix
Normal file
29
users/modules/cli/default.nix
Normal file
@@ -0,0 +1,29 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.home.cli;
|
||||
in {
|
||||
imports = [
|
||||
./bat.nix
|
||||
./btop.nix
|
||||
./direnv.nix
|
||||
./eza.nix
|
||||
./mu.nix
|
||||
./nh.nix
|
||||
./nix-index.nix
|
||||
./scripts
|
||||
./tealdeer.nix
|
||||
./yt-dlp.nix
|
||||
];
|
||||
|
||||
options.home.cli.fullDesktop = mkEnableOption "Enable all optional modules and options";
|
||||
config.home.cli = {
|
||||
bat.extras = mkDefault cfg.fullDesktop;
|
||||
mu.enable = mkDefault cfg.fullDesktop;
|
||||
scripts.enable = mkDefault cfg.fullDesktop;
|
||||
yt-dlp.enable = mkDefault cfg.fullDesktop;
|
||||
};
|
||||
}
|
||||
11
users/modules/cli/mu.nix
Normal file
11
users/modules/cli/mu.nix
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.home.cli.mu;
|
||||
in {
|
||||
options.home.cli.mu.enable = mkEnableOption "Enable mu";
|
||||
config.programs.mu.enable = cfg.enable;
|
||||
}
|
||||
@@ -4,9 +4,9 @@
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.modules.nh;
|
||||
cfg = config.home.cli.nh;
|
||||
in {
|
||||
options.modules.nh.flake = mkOption {
|
||||
options.home.cli.nh.flake = mkOption {
|
||||
type = types.path;
|
||||
default = "/home/phundrak/.dotfiles";
|
||||
example = "/etc/nixos";
|
||||
10
users/modules/cli/nix-index.nix
Normal file
10
users/modules/cli/nix-index.nix
Normal file
@@ -0,0 +1,10 @@
|
||||
{inputs, ...}: {
|
||||
imports = [
|
||||
inputs.nix-index-database.homeModules.nix-index
|
||||
];
|
||||
|
||||
programs = {
|
||||
nix-index.enable = true;
|
||||
nix-index-database.comma.enable = true;
|
||||
};
|
||||
}
|
||||
3
users/modules/cli/scripts/askpass.nix
Normal file
3
users/modules/cli/scripts/askpass.nix
Normal file
@@ -0,0 +1,3 @@
|
||||
{pkgs, ...}:
|
||||
pkgs.writeShellScriptBin "askpass" ''
|
||||
${pkgs.wofi}/bin/wofi -d -P -L 1 -p "$(printf $1 | sed s/://)"''
|
||||
3
users/modules/cli/scripts/backup.nix
Normal file
3
users/modules/cli/scripts/backup.nix
Normal file
@@ -0,0 +1,3 @@
|
||||
{pkgs, ...}:
|
||||
pkgs.writeShellScriptBin "backup" ''
|
||||
cp -r "$1" "$1.bak.$(date +%Y%m%d%H%M%S)"''
|
||||
15
users/modules/cli/scripts/default.nix
Normal file
15
users/modules/cli/scripts/default.nix
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.home.cli.scripts;
|
||||
files = filesystem.listFilesRecursive ./.;
|
||||
scriptFiles = builtins.filter (path: baseNameOf path != "default.nix") files;
|
||||
scripts = map (file: (import file {inherit pkgs config;})) scriptFiles;
|
||||
in {
|
||||
options.home.cli.scripts.enable = mkEnableOption "Add custom scripts to PATH";
|
||||
config.home.packages = mkIf cfg.enable scripts;
|
||||
}
|
||||
3
users/modules/cli/scripts/keygen.nix
Normal file
3
users/modules/cli/scripts/keygen.nix
Normal file
@@ -0,0 +1,3 @@
|
||||
{pkgs, ...}:
|
||||
pkgs.writeShellScriptBin "keygen"
|
||||
"tr -cd '[:alnum:]' < /dev/urandom | fold -w 64 | head -n 1 | tr -d '\n'"
|
||||
10
users/modules/cli/scripts/launch-with-emacsclient.nix
Normal file
10
users/modules/cli/scripts/launch-with-emacsclient.nix
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
pkgs.writeShellScriptBin "launch-with-emacsclient" ''
|
||||
filename="$1"
|
||||
line="$2"
|
||||
column="$3"
|
||||
${config.home.dev.editors.emacs.package}/bin/emacsclient +$line:$column "$filename"''
|
||||
3
users/modules/cli/scripts/mp42webm.nix
Normal file
3
users/modules/cli/scripts/mp42webm.nix
Normal file
@@ -0,0 +1,3 @@
|
||||
{pkgs, ...}:
|
||||
pkgs.writeShellScriptBin "mp42webm" ''
|
||||
${pkgs.ffmpeg}/bin/ffmpeg -i "$1" -c:v libvpx -crf 10 -b:v 1M -c:a libvorbis "$1".webm''
|
||||
16
users/modules/cli/scripts/plock.nix
Normal file
16
users/modules/cli/scripts/plock.nix
Normal file
@@ -0,0 +1,16 @@
|
||||
{pkgs, ...}:
|
||||
pkgs.writeShellScriptBin "plock" ''
|
||||
TMPBG="/tmp/screen.png"
|
||||
if [ "$XDG_SESSION_TYPE" = "wayland" ]; then
|
||||
SCREENER=${pkgs.grim}/bin/grim
|
||||
LOCKER="${pkgs.swaylock}/bin/swaylock -feF"
|
||||
else
|
||||
SCREENER=${pkgs.scrot}/bin/scrot
|
||||
LOCKER="${pkgs.i3lock}/bin/i3lock -ef"
|
||||
fi
|
||||
|
||||
$SCREENER "$TMPBG"
|
||||
${pkgs.corrupter}/bin/corrupter -add 0 "$TMPBG" "$TMPBG"
|
||||
$LOCKER -ti "$TMPBG"
|
||||
rm "$TMPBG"
|
||||
''
|
||||
18
users/modules/cli/scripts/rofi-emoji.nix
Normal file
18
users/modules/cli/scripts/rofi-emoji.nix
Normal file
@@ -0,0 +1,18 @@
|
||||
{pkgs, ...}:
|
||||
pkgs.writeShellScriptBin "rofi-emoji" ''
|
||||
SELECTED_EMOJI=$(grep -v "#" ~/.config/emoji | ${pkgs.wofi}/bin/wofi --dmenu -p "Select emoji" -i | awk '{print $1}' | tr -d '\n')
|
||||
if [ "$XDG_SESSION_TYPE" = "wayland" ]; then
|
||||
printf "%s" "$SELECTED_EMOJI" | ${pkgs.wl-clipboard-rs}/bin/wl-copy
|
||||
else
|
||||
printf "%s" "$SELECTED_EMOJI" | ${pkgs.xclip}/bin/xclip -sel clip
|
||||
fi
|
||||
|
||||
if [ "$XDG_SESSION_TYPE" = "wayland" ]
|
||||
then EMOJI=$(${pkgs.wl-clipboard-rs}/bin/wl-paste)
|
||||
else EMOJI=$(${pkgs.xclip}/bin/xclip -o)
|
||||
fi
|
||||
|
||||
test -z "$EMOJI" && notify-send "No emoji copied" -u low && exit
|
||||
EMOJI="$EMOJI copied to clipboard"
|
||||
${pkgs.libnotify}/bin/notify-send -u low "$EMOJI"
|
||||
''
|
||||
56
users/modules/cli/scripts/screenshot.nix
Normal file
56
users/modules/cli/scripts/screenshot.nix
Normal file
@@ -0,0 +1,56 @@
|
||||
{pkgs, ...}:
|
||||
pkgs.writeShellScriptBin "screenshot" ''
|
||||
OUTFILE_BASE="$HOME/Pictures/Screenshots/Screenshot_$(date +%Y-%m-%d_%H.%M.%S)"
|
||||
OUTFILE="$OUTFILE_BASE.png"
|
||||
SUFFIX=0
|
||||
|
||||
while getopts ':cd:egs' OPTION; do
|
||||
case "$OPTION" in
|
||||
c )
|
||||
COPY="yes"
|
||||
;;
|
||||
d )
|
||||
DELAY="$OPTARG"
|
||||
;;
|
||||
e )
|
||||
EDIT="yes"
|
||||
;;
|
||||
g )
|
||||
GIMP="yes"
|
||||
;;
|
||||
s )
|
||||
SELECT="yes"
|
||||
;;
|
||||
? )
|
||||
echo "Usage: $(basename "$0") [-c] [-d DELAY] [-e] [-g] [-s]"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ "$SELECT" = "yes" ]; then
|
||||
AREA="$(${pkgs.slurp}/bin/slurp)"
|
||||
fi
|
||||
|
||||
if [ -n "$DELAY" ]; then
|
||||
sleep "$DELAY"
|
||||
fi
|
||||
|
||||
if [ "$SELECT" = "yes" ]; then
|
||||
${pkgs.grim}/bin/grim -g "$AREA" "$OUTFILE"
|
||||
else
|
||||
${pkgs.grim}/bin/grim "$OUTFILE"
|
||||
fi
|
||||
|
||||
if [ "$EDIT" = "yes" ];then
|
||||
${pkgs.swappy}/bin/swappy -f "$OUTFILE" -o "$OUTFILE"
|
||||
fi
|
||||
|
||||
if [ "$GIMP" = "yes" ]; then
|
||||
${pkgs.gimp}/bin/gimp "$OUTFILE"
|
||||
fi
|
||||
|
||||
if [ "$COPY" = "yes" ]; then
|
||||
${pkgs.wl-clipboard-rs}/bin/wl-copy < "$OUTFILE"
|
||||
fi
|
||||
''
|
||||
3
users/modules/cli/scripts/sshbind.nix
Normal file
3
users/modules/cli/scripts/sshbind.nix
Normal file
@@ -0,0 +1,3 @@
|
||||
{pkgs, ...}:
|
||||
pkgs.writeShellScriptBin "sshbind" ''
|
||||
ssh -L "$1:$3:$1" "$2" -N''
|
||||
16
users/modules/cli/scripts/ytplay.nix
Normal file
16
users/modules/cli/scripts/ytplay.nix
Normal file
@@ -0,0 +1,16 @@
|
||||
{pkgs, ...}:
|
||||
pkgs.writeShellScriptBin "ytplay" ''
|
||||
URL=$(${pkgs.wofi}/bin/wofi --dmenu -i -p "Video URL")
|
||||
if [ -z "$URL" ]; then
|
||||
echo "You need to provide a URL"
|
||||
exit 1
|
||||
fi
|
||||
RESOLUTION_CHOICE=$(${pkgs.yt-dlp}/bin/yt-dlp --list-formats "$URL" | \
|
||||
grep -E "webm.*[0-9]+x[0-9]" | \
|
||||
awk '{print $3 " " $1}' | \
|
||||
sort -gu | \
|
||||
${pkgs.wofi}/bin/wofi --dmenu -i -p "Resolution")
|
||||
mapfile -t RESOLUTION <<< "$RESOLUTION_CHOICE"
|
||||
RESOLUTION_CODE=''${RESOLUTION[0]}
|
||||
${pkgs.mpv}/bin/mpv --ytdl-format="''${RESOLUTION_CODE}+bestaudio/best" "$URL"
|
||||
''
|
||||
18
users/modules/cli/yt-dlp.nix
Normal file
18
users/modules/cli/yt-dlp.nix
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.home.cli.yt-dlp;
|
||||
in {
|
||||
options.home.cli.yt-dlp.enable = mkEnableOption "Enable yt-dlp";
|
||||
config.programs.yt-dlp = mkIf cfg.enable {
|
||||
inherit (cfg) enable;
|
||||
settings = {
|
||||
embed-thumbnail = true;
|
||||
embed-subs = true;
|
||||
sub-langs = "all";
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -1,17 +1,29 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.home;
|
||||
in {
|
||||
imports = [
|
||||
./basics.nix
|
||||
./bat.nix
|
||||
./btop.nix
|
||||
./direnv.nix
|
||||
./eza.nix
|
||||
./gpg.nix
|
||||
./mopidy.nix
|
||||
./nh.nix
|
||||
./nix-index.nix
|
||||
./cli
|
||||
./desktop
|
||||
./dev
|
||||
./media
|
||||
./services
|
||||
./security
|
||||
./shell
|
||||
./ssh.nix
|
||||
./tealdeer.nix
|
||||
./vcs
|
||||
];
|
||||
|
||||
options.home.fullDesktop = mkEnableOption "Enable most modules";
|
||||
config.home = {
|
||||
cli.fullDesktop = mkDefault cfg.fullDesktop;
|
||||
desktop.fullDesktop = mkDefault cfg.fullDesktop;
|
||||
dev.fullDesktop = mkDefault cfg.fullDesktop;
|
||||
media.fullDesktop = mkDefault cfg.fullDesktop;
|
||||
security.fullDesktop = mkDefault cfg.fullDesktop;
|
||||
services.fullDesktop = mkDefault cfg.fullDesktop;
|
||||
};
|
||||
}
|
||||
|
||||
32
users/modules/desktop/default.nix
Normal file
32
users/modules/desktop/default.nix
Normal file
@@ -0,0 +1,32 @@
|
||||
{
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.home.desktop;
|
||||
in {
|
||||
imports = [
|
||||
./emoji.nix
|
||||
./eww.nix
|
||||
./hyprland.nix
|
||||
./kdeconnect.nix
|
||||
./kitty.nix
|
||||
./obs.nix
|
||||
./qt.nix
|
||||
./swaync.nix
|
||||
./waybar.nix
|
||||
./wlsunset.nix
|
||||
./wofi.nix
|
||||
];
|
||||
|
||||
options.home.desktop.fullDesktop = mkEnableOption "Enable options for graphical environments";
|
||||
config.home.desktop = {
|
||||
eww.enable = mkDefault cfg.fullDesktop;
|
||||
hyprland.enable = mkDefault cfg.fullDesktop;
|
||||
kdeconnect.enable = mkDefault cfg.fullDesktop;
|
||||
kitty.enable = mkDefault cfg.fullDesktop;
|
||||
obs.enable = mkDefault cfg.fullDesktop;
|
||||
qt.enable = mkDefault cfg.fullDesktop;
|
||||
};
|
||||
}
|
||||
14
users/modules/desktop/eww.nix
Normal file
14
users/modules/desktop/eww.nix
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.home.desktop.eww;
|
||||
in {
|
||||
options.home.desktop.eww.enable = mkEnableOption "Enable eww support";
|
||||
config.programs.eww = mkIf cfg.enable {
|
||||
inherit (cfg) enable;
|
||||
configDir = ./eww-config;
|
||||
};
|
||||
}
|
||||
@@ -5,8 +5,9 @@
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.modules.hyprland;
|
||||
rofi-emoji = import ../scripts/rofi-emoji.nix {inherit pkgs;};
|
||||
cfg = config.home.desktop.hyprland;
|
||||
rofi-emoji = import ../cli/scripts/rofi-emoji.nix {inherit pkgs;};
|
||||
laptops = ["gampo"];
|
||||
in {
|
||||
imports = [
|
||||
./swaync.nix
|
||||
@@ -14,33 +15,34 @@ in {
|
||||
./wlsunset.nix
|
||||
];
|
||||
|
||||
options.modules.hyprland = {
|
||||
options.home.desktop.hyprland = {
|
||||
enable = mkEnableOption "Enables Hyprland";
|
||||
swaync = mkEnableOption "Enables swaync";
|
||||
emacsPkg = mkOption {
|
||||
type = types.package;
|
||||
default = pkgs.emacs;
|
||||
default = config.home.dev.editors.emacs.package or pkgs.emacs;
|
||||
# default = pkgs.emacs;
|
||||
example = pkgs.emacs;
|
||||
};
|
||||
host = mkOption {
|
||||
type = types.enum ["tilo" "gampo"];
|
||||
default = "tilo";
|
||||
type = types.enum ["gampo" "marpa"];
|
||||
description = ''
|
||||
Which host is Hyprland running on.
|
||||
|
||||
This helps determine the monitors layout.
|
||||
This helps determine the monitors layout and enable battery support in waybar.
|
||||
'';
|
||||
};
|
||||
waybar = {
|
||||
enable = mkEnableOption "Enables waybar.";
|
||||
battery = mkEnableOption "Enables battery support.";
|
||||
style = mkOption {
|
||||
type = types.path;
|
||||
example = ./style.css;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.desktop = {
|
||||
swaync.enable = mkDefault true;
|
||||
waybar = {
|
||||
enable = mkDefault true;
|
||||
battery = mkDefault (builtins.elem cfg.host laptops);
|
||||
};
|
||||
wlsunset.enable = mkDefault true;
|
||||
wofi.enable = mkDefault true;
|
||||
};
|
||||
wayland.windowManager.hyprland = {
|
||||
enable = true;
|
||||
xwayland.enable = true;
|
||||
@@ -58,7 +60,7 @@ in {
|
||||
};
|
||||
monitor =
|
||||
{
|
||||
"tilo" = [
|
||||
"marpa" = [
|
||||
"DP-1, 3440x1440@144, 1080x550, 1"
|
||||
"DP-2, 2560x1080@60, 0x0, 1, transform, 1"
|
||||
];
|
||||
@@ -286,12 +288,5 @@ in {
|
||||
};
|
||||
};
|
||||
};
|
||||
modules = {
|
||||
swaync.enable = cfg.swaync;
|
||||
waybar = mkIf cfg.waybar.enable {
|
||||
inherit (cfg.waybar) enable battery style;
|
||||
};
|
||||
wlsunset.enable = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
14
users/modules/desktop/kdeconnect.nix
Normal file
14
users/modules/desktop/kdeconnect.nix
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.home.desktop.kdeconnect;
|
||||
in {
|
||||
options.home.desktop.kdeconnect.enable = mkEnableOption "Enable KDE Connect";
|
||||
config.services.kdeconnect = mkIf cfg.enable {
|
||||
enable = true;
|
||||
indicator = true;
|
||||
};
|
||||
}
|
||||
@@ -1,6 +1,15 @@
|
||||
{pkgs, ...}: {
|
||||
programs.kitty = {
|
||||
enable = true;
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.home.desktop.kitty;
|
||||
in {
|
||||
options.home.desktop.kitty.enable = mkEnableOption "Enable kitty terminal";
|
||||
config.programs.kitty = mkIf cfg.enable {
|
||||
inherit (cfg) enable;
|
||||
themeFile = "Nord";
|
||||
font = {
|
||||
package = pkgs.cascadia-code;
|
||||
23
users/modules/desktop/obs.nix
Normal file
23
users/modules/desktop/obs.nix
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.home.desktop.obs;
|
||||
in {
|
||||
options.home.desktop.obs.enable = mkEnableOption "Enables OBS Studio";
|
||||
config.programs.obs-studio = mkIf cfg.enable {
|
||||
inherit (cfg) enable;
|
||||
plugins = with pkgs.obs-studio-plugins; [
|
||||
input-overlay
|
||||
obs-backgroundremoval
|
||||
obs-mute-filter
|
||||
obs-pipewire-audio-capture
|
||||
obs-source-clone
|
||||
obs-source-record
|
||||
obs-tuna
|
||||
];
|
||||
};
|
||||
}
|
||||
11
users/modules/desktop/qt.nix
Normal file
11
users/modules/desktop/qt.nix
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.home.desktop.qt;
|
||||
in {
|
||||
options.home.desktop.qt.enable = mkEnableOption "Enable Qt support";
|
||||
config.qt.enable = cfg.enable;
|
||||
}
|
||||
@@ -5,12 +5,9 @@
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.modules.swaync;
|
||||
cfg = config.home.desktop.swaync;
|
||||
in {
|
||||
options.modules.swaync = {
|
||||
enable = mkEnableOption "Enables swaync";
|
||||
};
|
||||
|
||||
options.home.desktop.swaync.enable = mkEnableOption "Enables swaync";
|
||||
config = mkIf cfg.enable {
|
||||
services.swaync.enable = true;
|
||||
home.packages = [pkgs.swaynotificationcenter];
|
||||
@@ -4,9 +4,9 @@
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.modules.waybar;
|
||||
cfg = config.home.desktop.waybar;
|
||||
in {
|
||||
options.modules.waybar = {
|
||||
options.home.desktop.waybar = {
|
||||
enable = mkEnableOption "Enables waybar.";
|
||||
battery = mkEnableOption "Enables battery support.";
|
||||
style = mkOption {
|
||||
@@ -4,9 +4,9 @@
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.modules.wlsunset;
|
||||
cfg = config.home.desktop.wlsunset;
|
||||
in {
|
||||
options.modules.wlsunset = {
|
||||
options.home.desktop.wlsunset = {
|
||||
enable = mkEnableOption "Enables wlsunset";
|
||||
latitude = mkOption {
|
||||
type = with types; nullOr (oneOf [str ints.unsigned float]);
|
||||
@@ -1,10 +1,18 @@
|
||||
{
|
||||
programs.wofi = {
|
||||
enable = true;
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.home.desktop.wofi;
|
||||
in {
|
||||
options.home.desktop.wofi.enable = mkEnableOption "Enable wofi support";
|
||||
config.programs.wofi = mkIf cfg.enable {
|
||||
inherit (cfg) enable;
|
||||
settings = {
|
||||
modi = "ssh,drun,combi";
|
||||
sidebar-mode = false;
|
||||
width = 30;
|
||||
width = 50;
|
||||
line-margin = 10;
|
||||
lines = 6;
|
||||
columns = 2;
|
||||
20
users/modules/dev/default.nix
Normal file
20
users/modules/dev/default.nix
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.home.dev;
|
||||
in {
|
||||
imports = [
|
||||
./editors
|
||||
./ollama.nix
|
||||
./vcs
|
||||
];
|
||||
|
||||
options.home.dev.fullDesktop = mkEnableOption "Enables everything except AI";
|
||||
config.home.dev = {
|
||||
vcs.fullDesktop = mkDefault cfg.fullDesktop;
|
||||
editors.fullDesktop = mkDefault cfg.fullDesktop;
|
||||
};
|
||||
}
|
||||
20
users/modules/dev/editors/default.nix
Normal file
20
users/modules/dev/editors/default.nix
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.home.dev.editors;
|
||||
in {
|
||||
imports = [
|
||||
./emacs.nix
|
||||
];
|
||||
|
||||
options.home.dev.editors.fullDesktop = mkEnableOption "Enable all editors";
|
||||
config.home.dev.editors.emacs = {
|
||||
enable = mkDefault cfg.fullDesktop;
|
||||
service = mkDefault cfg.fullDesktop;
|
||||
mu4eMime = mkDefault cfg.fullDesktop;
|
||||
org-protocol = mkDefault cfg.fullDesktop;
|
||||
};
|
||||
}
|
||||
@@ -11,9 +11,9 @@ with lib; let
|
||||
epkgs.pdf-tools
|
||||
]
|
||||
));
|
||||
cfg = config.modules.emacs;
|
||||
cfg = config.home.dev.editors.emacs;
|
||||
in {
|
||||
options.modules.emacs = {
|
||||
options.home.dev.editors.emacs = {
|
||||
enable = mkEnableOption "enables Emacs";
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
@@ -25,6 +25,7 @@ in {
|
||||
};
|
||||
|
||||
config = {
|
||||
home.packages = [pkgs.emacs-all-the-icons-fonts];
|
||||
programs.emacs = mkIf cfg.enable {
|
||||
enable = true;
|
||||
inherit (cfg) package;
|
||||
@@ -4,9 +4,9 @@
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.modules.ollama;
|
||||
cfg = config.home.dev.ollama;
|
||||
in {
|
||||
options.modules.ollama = {
|
||||
options.home.dev.ollama = {
|
||||
enable = mkEnableOption "Enables Ollama";
|
||||
gpu = mkOption {
|
||||
type = types.nullOr types.enum ["none" "amd" "nvidia"];
|
||||
53
users/modules/dev/vcs/default.nix
Normal file
53
users/modules/dev/vcs/default.nix
Normal file
@@ -0,0 +1,53 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.home.dev.vcs;
|
||||
in {
|
||||
imports = [./git.nix ./jujutsu.nix];
|
||||
|
||||
options.home.dev.vcs = {
|
||||
fullDesktop = mkEnableOption "Enable all optional values";
|
||||
name = mkOption {
|
||||
type = types.str;
|
||||
default = "Lucien Cartier-Tilet";
|
||||
};
|
||||
email = mkOption {
|
||||
type = types.str;
|
||||
default = "lucien@phundrak.com";
|
||||
};
|
||||
editor = mkOption {
|
||||
type = types.str;
|
||||
default = "${pkgs.emacs}/bin/emacsclient -c -a ${pkgs.emacs}/bin/emacs";
|
||||
};
|
||||
publicKey = {
|
||||
content = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
example = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGj+J6N6SO+4P8dOZqfR1oiay2yxhhHnagH52avUqw5h";
|
||||
default = null;
|
||||
};
|
||||
file = mkOption {
|
||||
type = with types; nullOr path;
|
||||
default = "/home/phundrak/.ssh/id_ed25519.pub";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config.home.dev.vcs = {
|
||||
git = {
|
||||
enable = mkDefault true;
|
||||
inherit (cfg) name email editor;
|
||||
publicKeyFile = cfg.publicKey.file;
|
||||
cliff = mkDefault cfg.fullDesktop;
|
||||
completeConfig = mkDefault cfg.fullDesktop;
|
||||
};
|
||||
jj = {
|
||||
enable = mkDefault true;
|
||||
inherit (cfg) name email editor;
|
||||
signing.sshKey = mkDefault (cfg.publicKey.file or cfg.publicKey.content);
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -5,9 +5,9 @@
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.modules.git;
|
||||
cfg = config.home.dev.vcs.git;
|
||||
in {
|
||||
options.modules.git = {
|
||||
options.home.dev.vcs.git = {
|
||||
enable = mkEnableOption "enables git";
|
||||
email = mkOption {
|
||||
type = types.str;
|
||||
@@ -57,7 +57,11 @@ in {
|
||||
};
|
||||
completeConfig = mkEnableOption "Complete configuration for workstations";
|
||||
emacs = {
|
||||
integration = mkEnableOption "enables Emacs integration";
|
||||
integration = mkOption {
|
||||
description = "enables Emacs integration";
|
||||
type = types.bool;
|
||||
default = config.home.dev.editors.emacs.enable;
|
||||
};
|
||||
pkg = mkOption {
|
||||
type = types.package;
|
||||
default = pkgs.emacs;
|
||||
@@ -111,7 +115,7 @@ in {
|
||||
};
|
||||
commit.gpgsign = cfg.publicKeyFile != null;
|
||||
gpg.format = "ssh";
|
||||
gpg.ssh.allowedSignersFile = (mkIf (cfg.publicKeyFile != null)) "~/.ssh/allowed_signers";
|
||||
gpg.ssh.allowedSignersFile = "${config.home.homeDirectory}/.ssh/allowed_signers";
|
||||
init.defaultBranch = "main";
|
||||
pull.rebase = true;
|
||||
push = {
|
||||
@@ -5,9 +5,9 @@
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.modules.jj;
|
||||
cfg = config.home.dev.vcs.jj;
|
||||
in {
|
||||
options.modules.jj = {
|
||||
options.home.dev.vcs.jj = {
|
||||
enable = mkEnableOption "enables jj";
|
||||
name = mkOption {
|
||||
type = types.str;
|
||||
@@ -19,7 +19,10 @@ in {
|
||||
};
|
||||
editor = mkOption {
|
||||
type = types.str;
|
||||
default = "${pkgs.emacs}/bin/emacsclient -c -a ${pkgs.emacs}/bin/emacs";
|
||||
default =
|
||||
if config.home.dev.editors.emacs.enable
|
||||
then "${pkgs.emacs}/bin/emacsclient -c -a ${pkgs.emacs}/bin/emacs"
|
||||
else "${pkgs.nano}/bin/nano";
|
||||
};
|
||||
signing = {
|
||||
enable = mkEnableOption "enables signing jj commits";
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
programs.eww = {
|
||||
enable = true;
|
||||
configDir = ./eww-config;
|
||||
};
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
services.flatpak.enable = true;
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
{pkgs, ...}: {
|
||||
programs.gpg = {
|
||||
enable = true;
|
||||
mutableKeys = true;
|
||||
mutableTrust = true;
|
||||
};
|
||||
services.gpg-agent = {
|
||||
enable = true;
|
||||
enableSshSupport = true;
|
||||
pinentry.package = pkgs.pinentry-emacs;
|
||||
};
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
services.kdeconnect = {
|
||||
enable = true;
|
||||
indicator = true;
|
||||
};
|
||||
}
|
||||
22
users/modules/media/default.nix
Normal file
22
users/modules/media/default.nix
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.home.media;
|
||||
in {
|
||||
imports = [
|
||||
./mopidy.nix
|
||||
./mpd.nix
|
||||
./mpd-mpris.nix
|
||||
./mpv.nix
|
||||
];
|
||||
|
||||
options.home.media.fullDesktop = mkEnableOption "Enables everything";
|
||||
config.home.media = {
|
||||
mopidy.enable = mkDefault cfg.fullDesktop;
|
||||
mpd.enable = mkDefault (cfg.fullDesktop or cfg.mpd-mpris.enable);
|
||||
mpv.enable = mkDefault cfg.fullDesktop;
|
||||
};
|
||||
}
|
||||
@@ -5,9 +5,9 @@
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.modules.mopidy;
|
||||
cfg = config.home.media.mopidy;
|
||||
in {
|
||||
options.modules.mopidy = {
|
||||
options.home.media.mopidy = {
|
||||
enable = mkEnableOption "Enables Mopidy.";
|
||||
};
|
||||
|
||||
16
users/modules/media/mpd-mpris.nix
Normal file
16
users/modules/media/mpd-mpris.nix
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.home.media.mpd-mpris;
|
||||
cfgMpd = config.home.media.mpd;
|
||||
in {
|
||||
options.home.media.mpd-mpris.enable = mkOption {
|
||||
type = types.bool;
|
||||
default = cfgMpd.enable;
|
||||
example = false;
|
||||
};
|
||||
config.services.mpd-mpris.enable = cfg.enable;
|
||||
}
|
||||
30
users/modules/media/mpd.nix
Normal file
30
users/modules/media/mpd.nix
Normal file
@@ -0,0 +1,30 @@
|
||||
{
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.home.media.mpd;
|
||||
in {
|
||||
options.home.media.mpd.enable = mkEnableOption "Enables MPD";
|
||||
config.services.mpd = mkIf cfg.enable {
|
||||
inherit (cfg) enable;
|
||||
musicDirectory = "${config.home.homeDirectory}/Music";
|
||||
playlistDirectory = "${config.home.homeDirectory}/Music/playlists";
|
||||
network.startWhenNeeded = true;
|
||||
extraConfig = ''
|
||||
follow_outside_symlinks "yes"
|
||||
follow_inside_symlinks "yes"
|
||||
|
||||
bind_to_address "localhost"
|
||||
auto_update "yes"
|
||||
|
||||
audio_output {
|
||||
type "fifo"
|
||||
name "my_fifo"
|
||||
path "/tmp/mpd.fifo"
|
||||
format "44100:16:2"
|
||||
}
|
||||
'';
|
||||
};
|
||||
}
|
||||
@@ -1,6 +1,15 @@
|
||||
{pkgs, ...}: {
|
||||
programs.mpv = {
|
||||
enable = true;
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.home.media.mpv;
|
||||
in {
|
||||
options.home.media.mpv.enable = mkEnableOption "Enable MPV";
|
||||
config.programs.mpv = mkIf cfg.enable {
|
||||
inherit (cfg) enable;
|
||||
config = {
|
||||
force-window = "immediate";
|
||||
force-seekable = true; # force streams to be seekable
|
||||
@@ -16,7 +25,7 @@
|
||||
screenshot-format = "png";
|
||||
screenshot-high-bit-depth = true;
|
||||
screenshot-png-compression = 6;
|
||||
screenshot-directory = "~/Pictures/Screenshots/mpv";
|
||||
screenshot-directory = "${config.home.homeDirectory}/Pictures/Screenshots/mpv";
|
||||
|
||||
deband = true;
|
||||
deband-iterations = 2;
|
||||
@@ -1,21 +0,0 @@
|
||||
{
|
||||
services.mpd = {
|
||||
enable = true;
|
||||
musicDirectory = "/home/phundrak/Music";
|
||||
playlistDirectory = "/home/phundrak/Music/playlists";
|
||||
extraConfig = ''
|
||||
follow_outside_symlinks "yes"
|
||||
follow_inside_symlinks "yes"
|
||||
|
||||
bind_to_address "localhost"
|
||||
auto_update "yes"
|
||||
|
||||
audio_output {
|
||||
type "fifo"
|
||||
name "my_fifo"
|
||||
path "/tmp/mpd.fifo"
|
||||
format "44100:16:2"
|
||||
}
|
||||
'';
|
||||
};
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
{inputs, ...}: {
|
||||
imports = [
|
||||
inputs.nix-index-database.homeModules.nix-index
|
||||
];
|
||||
|
||||
programs.nix-index.enable = true;
|
||||
programs.nix-index-database.comma.enable = true;
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
qt.enable = true;
|
||||
}
|
||||
18
users/modules/security/default.nix
Normal file
18
users/modules/security/default.nix
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.home.security;
|
||||
in {
|
||||
imports = [
|
||||
./gpg.nix
|
||||
./ssh.nix
|
||||
];
|
||||
options.home.security.fullDesktop = mkEnableOption "Enable all modules";
|
||||
config.home.security = {
|
||||
gpg.enable = mkDefault cfg.fullDesktop;
|
||||
ssh.enable = mkDefault cfg.fullDesktop;
|
||||
};
|
||||
}
|
||||
32
users/modules/security/gpg.nix
Normal file
32
users/modules/security/gpg.nix
Normal file
@@ -0,0 +1,32 @@
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.home.security.gpg;
|
||||
in {
|
||||
options.home.security.gpg = {
|
||||
enable = mkEnableOption "Enable GPG";
|
||||
pinentry.package = mkOption {
|
||||
type = types.package;
|
||||
default =
|
||||
if config.home.dev.editors.emacs.enable
|
||||
then pkgs.pinentry-emacs
|
||||
else pkgs.pinentry-gtk2;
|
||||
};
|
||||
};
|
||||
config = mkIf cfg.enable {
|
||||
programs.gpg = {
|
||||
inherit (cfg) enable;
|
||||
mutableKeys = true;
|
||||
mutableTrust = true;
|
||||
};
|
||||
services.gpg-agent = {
|
||||
enable = true;
|
||||
enableSshSupport = true;
|
||||
pinentry.package = cfg.pinentry.package;
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -4,9 +4,9 @@
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.modules.ssh;
|
||||
cfg = config.home.security.ssh;
|
||||
in {
|
||||
options.modules.ssh = {
|
||||
options.home.security.ssh = {
|
||||
enable = mkEnableOption "enables SSH";
|
||||
hosts = mkOption {
|
||||
type = types.nullOr types.path;
|
||||
@@ -17,7 +17,7 @@ in {
|
||||
config = {
|
||||
programs.ssh = mkIf cfg.enable {
|
||||
enable = true;
|
||||
includes = mkIf (cfg.hosts != null) [cfg.hosts];
|
||||
includes = lists.optional (cfg.hosts != null) cfg.hosts;
|
||||
};
|
||||
};
|
||||
}
|
||||
11
users/modules/services/blanket.nix
Normal file
11
users/modules/services/blanket.nix
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.home.services.blanket;
|
||||
in {
|
||||
options.home.services.blanket.enable = mkEnableOption "Enable blanket";
|
||||
config.services.blanket.enable = cfg.enable;
|
||||
}
|
||||
22
users/modules/services/default.nix
Normal file
22
users/modules/services/default.nix
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.home.services;
|
||||
in {
|
||||
imports = [
|
||||
./blanket.nix
|
||||
./mbsync.nix
|
||||
./mpris-proxy.nix
|
||||
./playerctld.nix
|
||||
];
|
||||
options.home.services.fullDesktop = mkEnableOption "Enable all modules";
|
||||
config.home.services = {
|
||||
blanket.enable = mkDefault cfg.fullDesktop;
|
||||
mbsync.enable = mkDefault cfg.fullDesktop;
|
||||
mpris-proxy.enable = mkDefault cfg.fullDesktop;
|
||||
playerctld.enable = mkDefault cfg.fullDesktop;
|
||||
};
|
||||
}
|
||||
@@ -4,26 +4,14 @@
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.modules.mbsync;
|
||||
cfg = config.home.services.mbsync;
|
||||
in {
|
||||
options.modules.mbsync = {
|
||||
options.home.services.mbsync = {
|
||||
enable = mkEnableOption "Enables mbsync";
|
||||
passwordFile = mkOption {
|
||||
type = types.str;
|
||||
example = "/var/email/password";
|
||||
};
|
||||
service.enable = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
};
|
||||
host = mkOption {
|
||||
type = types.str;
|
||||
default = "mail.phundrak.com";
|
||||
};
|
||||
user = mkOption {
|
||||
type = types.str;
|
||||
default = "lucien@phundrak.com";
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
11
users/modules/services/mpris-proxy.nix
Normal file
11
users/modules/services/mpris-proxy.nix
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.home.services.mpris-proxy;
|
||||
in {
|
||||
options.home.services.mpris-proxy.enable = mkEnableOption "Enable MPRIS forwarding towards bluetooth and MIDI";
|
||||
config.services.mpris-proxy.enable = cfg.enable;
|
||||
}
|
||||
11
users/modules/services/playerctld.nix
Normal file
11
users/modules/services/playerctld.nix
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.home.services.playerctld;
|
||||
in {
|
||||
options.home.services.playerctld.enable = mkEnableOption "Enable playerctld daemon";
|
||||
config.services.playerctld.enable = cfg.enable;
|
||||
}
|
||||
@@ -4,9 +4,9 @@
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.modules.bash;
|
||||
cfg = config.home.shell.bash;
|
||||
in {
|
||||
options.modules.bash = {
|
||||
options.home.shell.bash = {
|
||||
enable = mkEnableOption "Enables bash";
|
||||
aliases = mkOption {
|
||||
type = types.attrsOf types.str;
|
||||
|
||||
@@ -61,7 +61,7 @@ with lib; let
|
||||
please = "sudo -A";
|
||||
wget = "wget --hsts-file=\"$XDG_DATA_HOME/wget-hsts\" -c";
|
||||
};
|
||||
cfg = config.modules.shell;
|
||||
cfg = config.home.shell;
|
||||
in {
|
||||
imports = [
|
||||
./bash.nix
|
||||
@@ -69,73 +69,22 @@ in {
|
||||
./starship.nix
|
||||
./tmux.nix
|
||||
./zsh.nix
|
||||
./zoxide.nix
|
||||
];
|
||||
|
||||
options.modules.shell = {
|
||||
eatIntegration = mkEnableOption "Enable Emacs Eat integration in Bash or Zsh";
|
||||
enableBash = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Enables bash";
|
||||
options.home.shell.fullDesktop = mkEnableOption "Enable all shells";
|
||||
config.home.shell = {
|
||||
enableShellIntegration = cfg.bash.enable or cfg.zsh.enable or cfg.fish.enable;
|
||||
bash = {
|
||||
aliases = mkDefault aliases;
|
||||
enable = mkDefault cfg.fullDesktop;
|
||||
};
|
||||
enableFish = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Enables fish";
|
||||
fish = {
|
||||
abbrs = mkDefault aliases;
|
||||
enable = mkDefault cfg.fullDesktop;
|
||||
};
|
||||
enableZsh = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Enables zsh";
|
||||
};
|
||||
starship = {
|
||||
enable = mkEnableOption "Enables the starship prompt.";
|
||||
jjIntegration = mkEnableOption "Enables Jujutsu integration in starship.";
|
||||
};
|
||||
tmux.enable = mkEnableOption "Enables tmux";
|
||||
zoxide = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "enables zoxide";
|
||||
};
|
||||
replaceCd = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "makes zoxide replace cd";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
home.shell = {
|
||||
enableFishIntegration = mkDefault cfg.enableFish;
|
||||
enableBashIntegration = mkDefault cfg.enableBash;
|
||||
enableZshIntegration = mkDefault cfg.enableZsh;
|
||||
};
|
||||
|
||||
modules = {
|
||||
fish = {
|
||||
enable = mkDefault cfg.enableFish;
|
||||
abbrs = mkDefault aliases;
|
||||
};
|
||||
bash = {
|
||||
enable = mkDefault cfg.enableBash;
|
||||
aliases = mkDefault aliases;
|
||||
};
|
||||
zsh = {
|
||||
enable = mkDefault cfg.enableZsh;
|
||||
abbrs = mkDefault aliases;
|
||||
};
|
||||
tmux.enable = cfg.tmux.enable;
|
||||
inherit (cfg) starship;
|
||||
};
|
||||
|
||||
programs.zoxide = mkIf cfg.zoxide.enable {
|
||||
enable = true;
|
||||
options = mkIf cfg.zoxide.replaceCd [
|
||||
"--cmd cd"
|
||||
];
|
||||
zsh = {
|
||||
abbrs = mkDefault aliases;
|
||||
enable = mkDefault cfg.fullDesktop;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.modules.fish;
|
||||
cfg = config.home.shell.fish;
|
||||
in {
|
||||
options.modules.fish = {
|
||||
options.home.shell.fish = {
|
||||
enable = lib.mkEnableOption "enables fish";
|
||||
abbrs = lib.mkOption {
|
||||
type = types.attrsOf types.str;
|
||||
|
||||
@@ -4,17 +4,21 @@
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.modules.starship;
|
||||
cfg = config.home.shell.starship;
|
||||
in {
|
||||
options.modules.starship = {
|
||||
options.home.shell.starship = {
|
||||
enable = mkEnableOption "Enables the starship prompt.";
|
||||
jjIntegration = mkEnableOption "Enables Jujutsu integration in starship.";
|
||||
jjIntegration = mkOption {
|
||||
description = "Enable Jujutsu integration in starship";
|
||||
default = config.programs.jujutsu.enable;
|
||||
type = types.bool;
|
||||
};
|
||||
};
|
||||
|
||||
config.programs.starship = mkIf cfg.enable {
|
||||
inherit (cfg) enable;
|
||||
enableTransience = true;
|
||||
settings = {
|
||||
settings = mkIf cfg.jjIntegration {
|
||||
custom.jj = {
|
||||
description = "The current jj status";
|
||||
detect_folders = [".jj"];
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.modules.tmux;
|
||||
cfg = config.home.shell.tmux;
|
||||
in {
|
||||
options.modules.tmux.enable = mkEnableOption "Enable tmux";
|
||||
options.home.shell.tmux.enable = mkEnableOption "Enable tmux";
|
||||
config.programs.tmux = mkIf cfg.enable {
|
||||
inherit (cfg) enable;
|
||||
baseIndex = 1;
|
||||
|
||||
19
users/modules/shell/zoxide.nix
Normal file
19
users/modules/shell/zoxide.nix
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.home.shell.zoxide;
|
||||
in {
|
||||
options.home.shell.zoxide = {
|
||||
enable = mkEnableOption "Enable zoxide";
|
||||
replaceCd = mkEnableOption "Replace cd with zoxide";
|
||||
};
|
||||
config.programs.zoxide = mkIf cfg.enable {
|
||||
inherit (cfg) enable;
|
||||
options = mkIf cfg.replaceCd [
|
||||
"--cmd cd"
|
||||
];
|
||||
};
|
||||
}
|
||||
@@ -5,9 +5,9 @@
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.modules.zsh;
|
||||
cfg = config.home.shell.zsh;
|
||||
in {
|
||||
options.modules.zsh = {
|
||||
options.home.shell.zsh = {
|
||||
enable = lib.mkEnableOption "Enables zsh";
|
||||
abbrs = lib.mkOption {
|
||||
type = types.attrsOf types.str;
|
||||
@@ -24,70 +24,73 @@ in {
|
||||
};
|
||||
};
|
||||
|
||||
config.programs.zsh = lib.mkIf cfg.enable {
|
||||
enable = true;
|
||||
autocd = true;
|
||||
autosuggestion = {
|
||||
config = lib.mkIf cfg.enable {
|
||||
programs.zsh = {
|
||||
enable = true;
|
||||
strategy = ["match_prev_cmd" "completion"];
|
||||
};
|
||||
enableCompletion = true;
|
||||
history = {
|
||||
findNoDups = true;
|
||||
ignoreAllDups = true;
|
||||
ignoreDups = true;
|
||||
ignoreSpace = true;
|
||||
path = "${config.xdg.dataHome}/zsh/zsh_history";
|
||||
saveNoDups = true;
|
||||
};
|
||||
historySubstringSearch.enable = true;
|
||||
initContent = with lib;
|
||||
concatLines [
|
||||
''
|
||||
bindkey -e
|
||||
bindkey '^p' history-search-backward
|
||||
bindkey '^n' history-search-forward
|
||||
autocd = true;
|
||||
autosuggestion = {
|
||||
enable = true;
|
||||
strategy = ["match_prev_cmd" "completion"];
|
||||
};
|
||||
enableCompletion = true;
|
||||
enableVteIntegration = true;
|
||||
history = {
|
||||
findNoDups = true;
|
||||
ignoreAllDups = true;
|
||||
ignoreDups = true;
|
||||
ignoreSpace = true;
|
||||
path = "${config.xdg.dataHome}/zsh/zsh_history";
|
||||
saveNoDups = true;
|
||||
};
|
||||
historySubstringSearch.enable = true;
|
||||
initContent = with lib;
|
||||
concatLines [
|
||||
''
|
||||
bindkey -e
|
||||
bindkey '^p' history-search-backward
|
||||
bindkey '^n' history-search-forward
|
||||
|
||||
# Completion styling
|
||||
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}'
|
||||
zstyle ':completion:*' list-colors "''${(s.:.)LS_COLORS}"
|
||||
zstyle ':completion:*' menu no
|
||||
zstyle ':fzf-tab:complete:cd:*' fzf-preview '${pkgs.eza}/bin/eza $realpath'
|
||||
''
|
||||
(strings.optionalString cfg.eatIntegration ''[ -n "$EAT_SHELL_INTEGRATION_DIR" ] && source "$EAT_SHELL_INTEGRATION_DIR/zsh"'')
|
||||
cfg.zshrcExtra
|
||||
];
|
||||
oh-my-zsh = {
|
||||
enable = true;
|
||||
# Completion styling
|
||||
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}'
|
||||
zstyle ':completion:*' list-colors "''${(s.:.)LS_COLORS}"
|
||||
zstyle ':completion:*' menu no
|
||||
zstyle ':fzf-tab:complete:cd:*' fzf-preview '${pkgs.eza}/bin/eza $realpath'
|
||||
''
|
||||
(strings.optionalString cfg.eatIntegration ''[ -n "$EAT_SHELL_INTEGRATION_DIR" ] && source "$EAT_SHELL_INTEGRATION_DIR/zsh"'')
|
||||
cfg.zshrcExtra
|
||||
];
|
||||
oh-my-zsh = {
|
||||
enable = true;
|
||||
plugins = [
|
||||
"dirhistory"
|
||||
"sudo"
|
||||
];
|
||||
};
|
||||
plugins = [
|
||||
"dirhistory"
|
||||
"sudo"
|
||||
{
|
||||
name = "fzf-tab";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "Aloxaf";
|
||||
repo = "fzf-tab";
|
||||
rev = "v1.2.0";
|
||||
sha256 = "sha256-q26XVS/LcyZPRqDNwKKA9exgBByE0muyuNb0Bbar2lY=";
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "zsh-autopair";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "hlissner";
|
||||
repo = "zsh-autopair";
|
||||
rev = "449a7c3d095bc8f3d78cf37b9549f8bb4c383f3d";
|
||||
sha256 = "sha256-3zvOgIi+q7+sTXrT+r/4v98qjeiEL4Wh64rxBYnwJvQ=";
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
plugins = [
|
||||
{
|
||||
name = "fzf-tab";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "Aloxaf";
|
||||
repo = "fzf-tab";
|
||||
rev = "v1.2.0";
|
||||
sha256 = "sha256-q26XVS/LcyZPRqDNwKKA9exgBByE0muyuNb0Bbar2lY=";
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "zsh-autopair";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "hlissner";
|
||||
repo = "zsh-autopair";
|
||||
rev = "449a7c3d095bc8f3d78cf37b9549f8bb4c383f3d";
|
||||
sha256 = "sha256-3zvOgIi+q7+sTXrT+r/4v98qjeiEL4Wh64rxBYnwJvQ=";
|
||||
};
|
||||
}
|
||||
];
|
||||
syntaxHighlighting.enable = true;
|
||||
zsh-abbr = {
|
||||
enable = true;
|
||||
abbreviations = cfg.abbrs;
|
||||
syntaxHighlighting.enable = true;
|
||||
zsh-abbr = {
|
||||
enable = true;
|
||||
abbreviations = cfg.abbrs;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,113 +0,0 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.modules.vcs;
|
||||
in {
|
||||
imports = [./git.nix ./jujutsu.nix];
|
||||
|
||||
options.modules.vcs = {
|
||||
git = {
|
||||
enable = mkEnableOption "enables git";
|
||||
cliff = mkEnableOption "enables git-cliff support";
|
||||
sendmail = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
};
|
||||
server = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = "mail.phundrak.com";
|
||||
};
|
||||
user = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
};
|
||||
encryption = mkOption {
|
||||
type = types.enum ["tls" "ssl" "none"];
|
||||
default = "none";
|
||||
};
|
||||
port = mkOption {
|
||||
type = types.nullOr types.int;
|
||||
default = 587;
|
||||
};
|
||||
passwordFile = mkOption {
|
||||
type = types.nullOr types.path;
|
||||
default = null;
|
||||
description = ''
|
||||
Path to a file containing the password necessary for authenticating
|
||||
against the mailserver.
|
||||
|
||||
This file should contain the password only, with no newline.
|
||||
'';
|
||||
};
|
||||
};
|
||||
browser = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
example = "${pkgs.firefox}/bin/firefox";
|
||||
default = null;
|
||||
};
|
||||
completeConfig = mkEnableOption "Complete configuration for workstations";
|
||||
mergeTool = mkOption {
|
||||
type = types.str;
|
||||
default = "ediff";
|
||||
};
|
||||
emacs = {
|
||||
integration = mkEnableOption "enables Emacs integration";
|
||||
pkg = mkOption {
|
||||
type = types.package;
|
||||
default = pkgs.emacs;
|
||||
};
|
||||
};
|
||||
};
|
||||
jj.enable = mkEnableOption "enables jujutsu";
|
||||
name = mkOption {
|
||||
type = types.str;
|
||||
default = "Lucien Cartier-Tilet";
|
||||
};
|
||||
email = mkOption {
|
||||
type = types.str;
|
||||
default = "lucien@phundrak.com";
|
||||
};
|
||||
editor = mkOption {
|
||||
type = types.str;
|
||||
default = "${pkgs.emacs}/bin/emacsclient -c -a ${pkgs.emacs}/bin/emacs";
|
||||
};
|
||||
publicKey = {
|
||||
content = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
example = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGj+J6N6SO+4P8dOZqfR1oiay2yxhhHnagH52avUqw5h";
|
||||
default = null;
|
||||
};
|
||||
file = mkOption {
|
||||
type = with types; nullOr path;
|
||||
default = "/home/phundrak/.ssh/id_ed25519.pub";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf (cfg.git.enable || cfg.jj.enable) {
|
||||
home.file.".ssh/allowed_signers".text = mkIf (cfg.publicKey.content != null) (mkDefault ''
|
||||
${cfg.email} namespaces="git" ${cfg.publicKey.content}
|
||||
'');
|
||||
modules = {
|
||||
git = mkIf cfg.git.enable {
|
||||
inherit (cfg.git) enable cliff sendmail browser completeConfig emacs mergeTool;
|
||||
inherit (cfg) email name editor;
|
||||
publicKeyFile = cfg.publicKey.file;
|
||||
};
|
||||
jj = mkIf cfg.jj.enable {
|
||||
inherit (cfg.jj) enable;
|
||||
inherit (cfg) name email editor;
|
||||
signing.enable = cfg.publicKey.content != null;
|
||||
signing.sshKey =
|
||||
if (cfg.publicKey.file == null)
|
||||
then cfg.publicKey.content
|
||||
else cfg.publicKey.file;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
{
|
||||
programs.yt-dlp = {
|
||||
enable = true;
|
||||
settings = {
|
||||
embed-thumbnail = true;
|
||||
embed-subs = true;
|
||||
sub-langs = "all";
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user