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
{
inherit config lib pkgs;
flavor = "mocha";
rosewater = "f2d5cf";
flamingo = "eebebe";
pink = "f4b8e4";

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -62,6 +62,21 @@ in
fish.enable = true;
git.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
gparted
neofetch
reptyr
ripgrep
tmux
up
viu
wget
@ -143,7 +158,6 @@ in
];
};
zoxide.enable = true;
navi.enable = true;
};
home = {
username = "moritz";

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -44,6 +44,7 @@ in
wayland.windowManager.hyprland = {
enable = true;
package = hyprland;
recommendedEnvironment = true;
extraConfig = import ./config.nix args;
};
};
@ -59,7 +60,7 @@ in
# start using systemd service
systemd = {
enable = true;
target = "hyprland-session.target";
target = "graphical-session.target";
};
settings = {
@ -87,11 +88,11 @@ in
events = [
{
event = "before-sleep";
command = "${pkgs.swaylock-effects}/bin/swaylock -fF";
command = "${pkgs.swaylock}/bin/swaylock -fF";
}
{
event = "lock";
command = "${pkgs.swaylock-effects}/bin/swaylock -fF";
command = "${pkgs.swaylock}/bin/swaylock -fF";
}
];
timeouts = [
@ -105,10 +106,8 @@ in
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
@ -116,27 +115,28 @@ in
# start hyprpaper daemon using systemd unit (to set wallpaper)
systemd.user.services.hyprpaper = {
enable = true;
path = [ pkgs.hyprpaper ];
wantedBy = [ "hyprland-session.target" ];
after = [ "hyprland-session.target" ];
script = "hyprpaper";
};
# set hyprpaper conf (for setting initial background)
home-manager.users.moritz.xdg.configFile."hypr/hyprpaper.conf" = {
text =
let
setWallpaper = wallpaper: ''
systemd.user.services.hyprpaper =
let
wallpaper = "/home/moritz/.config/wallpapers/a_short_walk.png";
config = pkgs.writeTextFile {
name = "hyprpaper.conf";
text = ''
preload = ${wallpaper}
wallpaper = ,${wallpaper}
'';
in
setWallpaper "/home/moritz/.config/wallpapers/a_short_walk.png";
onChange = "${pkgs.systemd}/bin/systemctl restart --user hyprpaper.service";
};
};
in
{
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
systemd.user.targets.hyprland-session = {
@ -144,6 +144,17 @@ in
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
users.users.moritz.packages = with pkgs; [
@ -206,7 +217,7 @@ in
# dekstop portal (for screensharing)
xdg.portal = {
enable = true;
wlr.enable = true;
wlr.enable = mkForce false;
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
vim-fugitive
vim-lion
vim-tmux-navigator
] ++ pluginsWithConfig;
};
};

View File

@ -26,14 +26,6 @@ require("which-key").register({
},
}, { 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
require("which-key").register({
["<tab>"] = {

View File

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

View File

@ -71,7 +71,6 @@ in
command = "systemctl --user restart waybar";
always = true;
}
{ command = "synology-drive"; }
{ 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 = [
./dunst.nix
./gammastep.nix
./kdeconnect.nix
./mullvad.nix
./openconnect.nix
./picom.nix
./printing.nix
./gammastep.nix
./synology-drive.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 ];
};
}