Merge remote-tracking branch 'origin/nixos' into nixos

nixos
Moritz Böhme 2023-05-02 09:07:21 +02:00
commit 82fa90d842
Signed by: moritz
GPG Key ID: 970C6E89EB0547A9
22 changed files with 247 additions and 44 deletions

View File

@ -9,6 +9,7 @@ in
(import ./catppuccin.nix (import ./catppuccin.nix
{ {
inherit config lib pkgs; inherit config lib pkgs;
flavor = "mocha";
rosewater = "f2d5cf"; rosewater = "f2d5cf";
flamingo = "eebebe"; flamingo = "eebebe";
pink = "f4b8e4"; pink = "f4b8e4";

View File

@ -9,6 +9,7 @@ in
(import ./catppuccin.nix (import ./catppuccin.nix
{ {
inherit config lib pkgs; inherit config lib pkgs;
flavor = "mocha";
rosewater = "dc8a78"; rosewater = "dc8a78";
flamingo = "dd7878"; flamingo = "dd7878";
pink = "ea76cb"; pink = "ea76cb";

View File

@ -9,6 +9,7 @@ in
(import ./catppuccin.nix (import ./catppuccin.nix
{ {
inherit config lib pkgs; inherit config lib pkgs;
flavor = "mocha";
rosewater = "f4dbd6"; rosewater = "f4dbd6";
flamingo = "f0c6c6"; flamingo = "f0c6c6";
pink = "f5bde6"; pink = "f5bde6";

View File

@ -9,6 +9,7 @@ in
(import ./catppuccin.nix (import ./catppuccin.nix
{ {
inherit config lib pkgs; inherit config lib pkgs;
flavor = "mocha";
rosewater = "f5e0dc"; rosewater = "f5e0dc";
flamingo = "f2cdcd"; flamingo = "f2cdcd";
pink = "f5c2e7"; pink = "f5c2e7";

View File

@ -1,4 +1,6 @@
{ config { config
, pkgs
, flavor
, rosewater , rosewater
, flamingo , flamingo
, pink , pink
@ -127,6 +129,12 @@
color7 #${subtext1} color7 #${subtext1}
color15 #${subtext0} color15 #${subtext0}
''; '';
tmux.plugins = with pkgs.tmuxPlugins; [
{
plugin = catppuccin;
extraConfig = "set -g @catppuccin_flavour '${flavor}'";
}
];
zathura.extraConfig = '' zathura.extraConfig = ''
set window-title-basename "true" set window-title-basename "true"
set selection-clipboard "clipboard" set selection-clipboard "clipboard"

View File

@ -1,5 +1,6 @@
{ config { config
, lib , lib
, pkgs
, ... , ...
}: }:
@ -97,6 +98,9 @@ in
active_border_color #f8f8f2 active_border_color #f8f8f2
inactive_border_color #6272a4 inactive_border_color #6272a4
''; '';
tmux.plugins = with pkgs.tmuxPlugins; [
dracula
];
zathura.extraConfig = '' zathura.extraConfig = ''
set window-title-basename "true" set window-title-basename "true"
set selection-clipboard "clipboard" set selection-clipboard "clipboard"

View File

@ -62,6 +62,21 @@ in
fish.enable = true; fish.enable = true;
git.enable = true; git.enable = true;
gpg.enable = true; gpg.enable = true;
navi.enable = true;
tmux.enable = true;
tmux.keybinds = {
prefix = {
"-" = "split-window -v";
"|" = "split-window -h";
"C-l" = "send-keys C-l";
"R" = "source-file $XDG_CONFIG_HOME/tmux/tmux.conf \\; display-message 'Reloaded tmux.conf'";
};
copy-mode-vi = {
"v" = "send -X begin-selection";
"V" = "send -X select-line";
"C-v" = "send -X rectangle-toggle";
};
};
}; };
}; };
@ -98,8 +113,8 @@ in
exa exa
gparted gparted
neofetch neofetch
reptyr
ripgrep ripgrep
tmux
up up
viu viu
wget wget
@ -143,7 +158,6 @@ in
]; ];
}; };
zoxide.enable = true; zoxide.enable = true;
navi.enable = true;
}; };
home = { home = {
username = "moritz"; username = "moritz";

View File

@ -48,7 +48,6 @@ with lib; {
pavucontrol pavucontrol
stable.libreoffice # HACK to fix build error stable.libreoffice # HACK to fix build error
stable.signal-desktop stable.signal-desktop
synology-drive-client
texlive.combined.scheme-full texlive.combined.scheme-full
thunderbird thunderbird
vlc vlc

View File

@ -3,7 +3,10 @@
with lib; with lib;
{ {
my = { my = {
services.openconnect.enable = true; services = {
openconnect.enable = true;
synology-drive.enable = true;
};
programs = { programs = {
ssh.includeSecrets = mkDefault [ ../../secrets/ssh-home.age ]; ssh.includeSecrets = mkDefault [ ../../secrets/ssh-home.age ];
git.signing = mkDefault true; git.signing = mkDefault true;

View File

@ -46,7 +46,6 @@ in
}; };
startupPrograms = [ startupPrograms = [
"randomWallpaper" "randomWallpaper"
"${pkgs.synology-drive-client}/bin/synology-drive"
]; ];
extraConfig = builtins.readFile ./bspwmrc; extraConfig = builtins.readFile ./bspwmrc;
}; };
@ -89,7 +88,6 @@ in
feh feh
pamixer pamixer
playerctl playerctl
synology-drive-client
]; ];
}; };
} }

View File

@ -18,6 +18,7 @@
./ledger ./ledger
./logseq.nix ./logseq.nix
./miracast.nix ./miracast.nix
./navi
./nvim ./nvim
./python.nix ./python.nix
./rofi ./rofi
@ -25,6 +26,7 @@
./ssh.nix ./ssh.nix
./sway.nix ./sway.nix
./thunar.nix ./thunar.nix
./tmux.nix
./zathura.nix ./zathura.nix
./zsh.nix ./zsh.nix
]; ];

View File

@ -224,6 +224,5 @@ in
bindm = $mainMod, mouse:272, movewindow bindm = $mainMod, mouse:272, movewindow
bindm = $mainMod, mouse:273, resizewindow bindm = $mainMod, mouse:273, resizewindow
exec-once=synology-drive
exec-once=randomWallpaper exec-once=randomWallpaper
'' ''

View File

@ -44,6 +44,7 @@ in
wayland.windowManager.hyprland = { wayland.windowManager.hyprland = {
enable = true; enable = true;
package = hyprland; package = hyprland;
recommendedEnvironment = true;
extraConfig = import ./config.nix args; extraConfig = import ./config.nix args;
}; };
}; };
@ -59,7 +60,7 @@ in
# start using systemd service # start using systemd service
systemd = { systemd = {
enable = true; enable = true;
target = "hyprland-session.target"; target = "graphical-session.target";
}; };
settings = { settings = {
@ -87,11 +88,11 @@ in
events = [ events = [
{ {
event = "before-sleep"; event = "before-sleep";
command = "${pkgs.swaylock-effects}/bin/swaylock -fF"; command = "${pkgs.swaylock}/bin/swaylock -fF";
} }
{ {
event = "lock"; event = "lock";
command = "${pkgs.swaylock-effects}/bin/swaylock -fF"; command = "${pkgs.swaylock}/bin/swaylock -fF";
} }
]; ];
timeouts = [ timeouts = [
@ -105,10 +106,8 @@ in
command = "${pkgs.systemd}/bin/loginctl lock-session"; command = "${pkgs.systemd}/bin/loginctl lock-session";
} }
]; ];
systemdTarget = "hyprland-session.target";
}; };
# start swayidle as part of hyprland, not sway
systemd.user.services.swayidle.Install.WantedBy = lib.mkForce [ "hyprland-session.target" ];
}; };
# adds pam module for swaylock # adds pam module for swaylock
@ -116,27 +115,28 @@ in
# start hyprpaper daemon using systemd unit (to set wallpaper) # start hyprpaper daemon using systemd unit (to set wallpaper)
systemd.user.services.hyprpaper = { systemd.user.services.hyprpaper =
enable = true; let
path = [ pkgs.hyprpaper ]; wallpaper = "/home/moritz/.config/wallpapers/a_short_walk.png";
wantedBy = [ "hyprland-session.target" ]; config = pkgs.writeTextFile {
after = [ "hyprland-session.target" ]; name = "hyprpaper.conf";
script = "hyprpaper"; text = ''
};
# set hyprpaper conf (for setting initial background)
home-manager.users.moritz.xdg.configFile."hypr/hyprpaper.conf" = {
text =
let
setWallpaper = wallpaper: ''
preload = ${wallpaper} preload = ${wallpaper}
wallpaper = ,${wallpaper} wallpaper = ,${wallpaper}
''; '';
in };
setWallpaper "/home/moritz/.config/wallpapers/a_short_walk.png"; in
onChange = "${pkgs.systemd}/bin/systemctl restart --user hyprpaper.service"; {
}; enable = true;
partOf = [ "graphical-session.target" ];
wantedBy = [ "graphical-session.target" ];
after = [ "graphical-session.target" ];
serviceConfig = {
ExecStart = "${pkgs.hyprpaper}/bin/hyprpaper -c ${config}";
RestartSec = "1s";
Restart = "on-failure";
};
};
# only consider graphical-session.target started when hyprland-sesstion.target is reached # only consider graphical-session.target started when hyprland-sesstion.target is reached
systemd.user.targets.hyprland-session = { systemd.user.targets.hyprland-session = {
@ -144,6 +144,17 @@ in
before = [ "graphical-session.target" ]; before = [ "graphical-session.target" ];
}; };
systemd.user.services.xdg-desktop-portal-hyprland = {
after = [ "hyprland-session.target" ];
wantedBy = [ "hyprland-session.target" ];
};
home-manager.users.moritz.systemd.user.services.nextcloud-client = {
Service = {
RestartSec = "1s";
Restart = "on-failure";
};
};
# add user packages for wayland and hyprland in particular # add user packages for wayland and hyprland in particular
users.users.moritz.packages = with pkgs; [ users.users.moritz.packages = with pkgs; [
@ -206,7 +217,7 @@ in
# dekstop portal (for screensharing) # dekstop portal (for screensharing)
xdg.portal = { xdg.portal = {
enable = true; enable = true;
wlr.enable = true; wlr.enable = mkForce false;
extraPortals = [ pkgs.xdg-desktop-portal-hyprland ]; extraPortals = [ pkgs.xdg-desktop-portal-hyprland ];
}; };
}; };

View File

@ -0,0 +1,6 @@
% tmux, reptyr
# send background process to tmux
bg <process> && disown <process> && tmux new -d "$SHELL -c 'reptyr <process>'"
$ process: ps x -eo pid,tty,stat | awk '$2 ~ /pts/' | awk '$3 ~ /T/' | cut -d" " -f1 --- --preview "ps -p {} -o cmd"

View File

@ -0,0 +1,20 @@
{ config, lib, ... }:
with lib;
let
cfg = config.my.programs.navi;
in
{
options.my.programs.navi.enable = mkEnableOption "navi";
config = mkIf cfg.enable {
home-manager.users.moritz = {
programs.navi.enable = true;
xdg.dataFile."navi/cheats/personal" = {
enable = true;
recursive = true;
source = ./cheats;
};
};
};
}

View File

@ -88,6 +88,7 @@ in
promise-async promise-async
vim-fugitive vim-fugitive
vim-lion vim-lion
vim-tmux-navigator
] ++ pluginsWithConfig; ] ++ pluginsWithConfig;
}; };
}; };

View File

@ -26,14 +26,6 @@ require("which-key").register({
}, },
}, { prefix = "<leader>" }) }, { prefix = "<leader>" })
-- fast window move
require("which-key").register({
["<C-h>"] = { "<C-w>h", "Move window left" },
["<C-j>"] = { "<C-w>j", "Move window down" },
["<C-k>"] = { "<C-w>k", "Move window up" },
["<C-l>"] = { "<C-w>l", "Move window right" },
})
-- tab -- tab
require("which-key").register({ require("which-key").register({
["<tab>"] = { ["<tab>"] = {

View File

@ -2,5 +2,4 @@ require("nvim-autopairs").setup()
-- If you want insert `(` after select function or method item -- If you want insert `(` after select function or method item
local cmp_autopairs = require("nvim-autopairs.completion.cmp") local cmp_autopairs = require("nvim-autopairs.completion.cmp")
local cmp = require("cmp") require("cmp").event:on("confirm_done", cmp_autopairs.on_confirm_done())
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done())

View File

@ -71,7 +71,6 @@ in
command = "systemctl --user restart waybar"; command = "systemctl --user restart waybar";
always = true; always = true;
} }
{ command = "synology-drive"; }
{ command = "randomWallpaper"; } { command = "randomWallpaper"; }
]; ];
}; };

111
modules/programs/tmux.nix Normal file
View File

@ -0,0 +1,111 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.my.programs.tmux;
tmux-sessionizer = pkgs.writeShellApplication {
name = "ts";
runtimeInputs = with pkgs; [ tmux findutils coreutils procps fd ];
text = ''
#!/usr/bin/env bash
options=$(fd -HIg '.git' ~/ --min-depth 1 --max-depth 5 --type d --prune --exec dirname {} | fzf --filter "''$*")
if [[ -z $options ]]; then
exit 1
elif [[ $(wc -l <<< "$options") -eq 1 ]]; then
selected="$options"
else
selected=$(echo "$options" | fzf --query="$*")
fi
if [[ -z $selected ]]; then
exit 0
fi
selected_name=$(basename "$selected" | tr . _)
if ! tmux has-session -t="$selected_name" 2> /dev/null; then
tmux new-session -ds "$selected_name" -c "$selected"
fi
if [[ -z ''${TMUX+x} ]]; then
tmux attach -t "$selected_name"
else
tmux switch-client -t "$selected_name"
fi
'';
};
in
{
options.my.programs.tmux = {
enable = mkEnableOption "tmux";
autoAttach = mkEnableOption "autoAttach";
keybinds = mkOption {
type = with types; attrsOf (attrsOf string);
default = { };
description = "Keybinds for tmux";
example = literalExample ''
{
prefix = {
"-" = "split-window -v";
"|" = "split-window -h";
};
copy-mode-vi = {
"v" = "send -X begin-selection";
};
}
'';
};
};
config = mkIf cfg.enable {
my.shell.abbreviations.t = "tmux";
home-manager.users.moritz.home.packages = [ tmux-sessionizer ];
home-manager.users.moritz.programs = {
tmux = {
enable = true;
clock24 = true;
customPaneNavigationAndResize = true;
keyMode = "vi";
mouse = true;
newSession = true;
prefix = "C-Space";
sensibleOnTop = false;
plugins = with pkgs.tmuxPlugins; [
sensible
tmux-fzf
vim-tmux-navigator
yank
];
extraConfig =
let
mkKeybind = table: mapAttrsToList (keybind: value: "bind-key -T ${table} '${keybind}' ${value}");
keybinds = flatten (mapAttrsToList mkKeybind cfg.keybinds);
in
''
# Keybinds
${concatStringsSep "\n" keybinds}
'';
};
fzf.tmux.enableShellIntegration = true;
fish.interactiveShellInit =
let
insideVariables = [ "$TMUX" "$INSIDE_EMACS" "$EMACS" "$VIM" "$VSCODE_RESOLVING_ENVIRONMENT" ];
insideVariableMissing = concatStringsSep " && " (map (x: "test -z ${x}") insideVariables);
in
mkIf cfg.autoAttach
''
if ! fish_is_root_user && test "$TERM_PROGRAM" != 'vscode' && ${insideVariableMissing}
if test -z $tmux_autostarted
set -x tmux_autostarted true
ts
end
end
'';
};
};
}

View File

@ -1,12 +1,13 @@
{ {
imports = [ imports = [
./dunst.nix ./dunst.nix
./gammastep.nix
./kdeconnect.nix ./kdeconnect.nix
./mullvad.nix ./mullvad.nix
./openconnect.nix ./openconnect.nix
./picom.nix ./picom.nix
./printing.nix ./printing.nix
./gammastep.nix ./synology-drive.nix
./wireguard.nix ./wireguard.nix
]; ];
} }

View File

@ -0,0 +1,32 @@
{ lib, config, pkgs, ... }:
with lib;
let
cfg = config.my.services.synology-drive;
in
{
options.my.services.synology-drive = {
enable = mkEnableOption "synology-drive";
package = mkOption {
type = types.package;
default = pkgs.synology-drive-client;
description = "The package to use for synology-drive";
};
};
config = mkIf cfg.enable {
systemd.user.services.synology-drive = {
after = [ "graphical-session.target" "network.target" ];
partOf = [ "graphical-session.target" ];
wantedBy = [ "graphical-session.target" ];
serviceConfig = {
ExitType = "cgroup";
Restart = "on-failure";
RestartSec = "1s";
ExecStartPre = "${pkgs.coreutils}/bin/rm -rf %h/.SynologyDrive/SynologyDrive.app %h/.SynologyDrive/cloud-connect.pid";
ExecStart = "${cfg.package}/bin/synology-drive";
};
};
environment.systemPackages = [ cfg.package ];
};
}