From ee3dfbdceea0dff23f9581cb54c50d0e920fcdd0 Mon Sep 17 00:00:00 2001 From: Simon Cornet Date: Sun, 24 Mar 2024 16:15:15 +0100 Subject: [PATCH] [nix] initial commit --- README.md | 3 - clipse/custom_theme.json | 15 ++ flake.lock | 65 +++++++ flake.nix | 109 +++++++++++ hyprland/centre_app.sh | 36 ++++ hyprland/conf.d/bindings.conf | 84 +++++++++ hyprland/conf.d/executions.conf | 41 ++++ hyprland/conf.d/general.conf | 23 +++ hyprland/conf.d/graphics.conf | 51 +++++ hyprland/conf.d/input.conf | 19 ++ hyprland/conf.d/variables.conf | 8 + hyprland/conf.d/window_rules.conf | 69 +++++++ hyprland/hyprland.conf | 7 + hyprland/monitor.sh | 41 ++++ hyprland/nmtui.sh | 3 + hyprland/startup/nextcloud_desktop.sh | 10 + hyprland/startup/solaar.sh | 10 + nix/home/alacritty/alacritty.nix | 109 +++++++++++ nix/home/alacritty/default.nix | 1 + nix/home/default.nix | 25 +++ nix/home/git/default.nix | 1 + nix/home/git/git.nix | 39 ++++ nix/home/mpv/default.nix | 1 + nix/home/mpv/mpv.nix | 13 ++ nix/home/ssh/default.nix | 1 + nix/home/ssh/ssh.nix | 9 + nix/home/theme/default.nix | 6 + nix/home/theme/gtk.nix | 48 +++++ nix/home/theme/qt.nix | 9 + nix/home/xdg/default.nix | 1 + nix/home/xdg/xdg.nix | 83 ++++++++ nix/home/zsh/default.nix | 1 + nix/home/zsh/zsh.nix | 53 ++++++ nix/systems/bootloader.nix | 30 +++ nix/systems/default.nix | 19 ++ nix/systems/desktop.nix | 36 ++++ nix/systems/hardware.nix | 17 ++ nix/systems/itclt75/configuration.nix | 21 +++ .../itclt75/hardware-configuration.nix | 48 +++++ nix/systems/locality.nix | 20 ++ nix/systems/networking.nix | 7 + nix/systems/nix.nix | 31 +++ nix/systems/packages.nix | 73 +++++++ nix/systems/phaedra/configuration.nix | 21 +++ .../phaedra/hardware-configuration.nix | 30 +++ nix/systems/security.nix | 13 ++ nix/systems/simon.nix | 14 ++ nix/systems/sound.nix | 24 +++ nix/systems/talathiel/configuration.nix | 21 +++ .../talathiel/hardware-configuration.nix | 30 +++ readme.md | 99 ++++++++++ ssh/config | 24 +++ swaylock/lock.sh | 54 ++++++ wallpaper/startup.sh | 16 ++ waybar/spotify.py | 178 ++++++++++++++++++ waybar/startup.sh | 10 + waybar/style.css | 89 +++++++++ waybar/waybar.conf | 156 +++++++++++++++ wireguard/wireguard.sh | 50 +++++ wofi/style.css | 51 +++++ wofi/wofi.sh | 15 ++ zsh/.zshrc | 84 +++++++++ 62 files changed, 2272 insertions(+), 3 deletions(-) delete mode 100644 README.md create mode 100644 clipse/custom_theme.json create mode 100644 flake.lock create mode 100644 flake.nix create mode 100755 hyprland/centre_app.sh create mode 100644 hyprland/conf.d/bindings.conf create mode 100644 hyprland/conf.d/executions.conf create mode 100644 hyprland/conf.d/general.conf create mode 100644 hyprland/conf.d/graphics.conf create mode 100644 hyprland/conf.d/input.conf create mode 100644 hyprland/conf.d/variables.conf create mode 100644 hyprland/conf.d/window_rules.conf create mode 100644 hyprland/hyprland.conf create mode 100755 hyprland/monitor.sh create mode 100755 hyprland/nmtui.sh create mode 100755 hyprland/startup/nextcloud_desktop.sh create mode 100755 hyprland/startup/solaar.sh create mode 100644 nix/home/alacritty/alacritty.nix create mode 100644 nix/home/alacritty/default.nix create mode 100644 nix/home/default.nix create mode 100644 nix/home/git/default.nix create mode 100644 nix/home/git/git.nix create mode 100644 nix/home/mpv/default.nix create mode 100644 nix/home/mpv/mpv.nix create mode 100644 nix/home/ssh/default.nix create mode 100644 nix/home/ssh/ssh.nix create mode 100644 nix/home/theme/default.nix create mode 100644 nix/home/theme/gtk.nix create mode 100644 nix/home/theme/qt.nix create mode 100644 nix/home/xdg/default.nix create mode 100644 nix/home/xdg/xdg.nix create mode 100644 nix/home/zsh/default.nix create mode 100644 nix/home/zsh/zsh.nix create mode 100644 nix/systems/bootloader.nix create mode 100644 nix/systems/default.nix create mode 100644 nix/systems/desktop.nix create mode 100644 nix/systems/hardware.nix create mode 100644 nix/systems/itclt75/configuration.nix create mode 100644 nix/systems/itclt75/hardware-configuration.nix create mode 100644 nix/systems/locality.nix create mode 100644 nix/systems/networking.nix create mode 100644 nix/systems/nix.nix create mode 100644 nix/systems/packages.nix create mode 100644 nix/systems/phaedra/configuration.nix create mode 100644 nix/systems/phaedra/hardware-configuration.nix create mode 100644 nix/systems/security.nix create mode 100644 nix/systems/simon.nix create mode 100644 nix/systems/sound.nix create mode 100644 nix/systems/talathiel/configuration.nix create mode 100644 nix/systems/talathiel/hardware-configuration.nix create mode 100644 readme.md create mode 100644 ssh/config create mode 100755 swaylock/lock.sh create mode 100755 wallpaper/startup.sh create mode 100644 waybar/spotify.py create mode 100755 waybar/startup.sh create mode 100644 waybar/style.css create mode 100644 waybar/waybar.conf create mode 100755 wireguard/wireguard.sh create mode 100644 wofi/style.css create mode 100755 wofi/wofi.sh create mode 100644 zsh/.zshrc diff --git a/README.md b/README.md deleted file mode 100644 index bad24fb..0000000 --- a/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# dotfiles-nix - -NixOS configuration \ No newline at end of file diff --git a/clipse/custom_theme.json b/clipse/custom_theme.json new file mode 100644 index 0000000..63ae1e7 --- /dev/null +++ b/clipse/custom_theme.json @@ -0,0 +1,15 @@ +{ + "useCustomTheme": true, + "DimmedDesc": "#ffffff", + "DimmedTitle": "#ffffff", + "FilteredMatch": "#528bff", + "NormalDesc": "#ffffff", + "NormalTitle": "#ffffff", + "SelectedDesc": "#3465a4", + "SelectedTitle": "#528bff", + "SelectedBorder": "#528bff", + "SelectedDescBorder": "#528bff", + "TitleFore": "#ffffff", + "Titleback": "#528bff", + "StatusMsg": "#ffffff" +} diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..ef50242 --- /dev/null +++ b/flake.lock @@ -0,0 +1,65 @@ +{ + "nodes": { + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1710888565, + "narHash": "sha256-s9Hi4RHhc6yut4EcYD50sZWRDKsugBJHSbON8KFwoTw=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "f33900124c23c4eca5831b9b5eb32ea5894375ce", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "release-23.11", + "repo": "home-manager", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1711048004, + "narHash": "sha256-fI9nyTXbQsZYNre67OXz0nNgcXXlNfN470WJv8Qw3eE=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "8c2a8f922ff4eb12bc2d6d1486f247ee3f02279e", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "release-23.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-unstable": { + "locked": { + "lastModified": 1710806803, + "narHash": "sha256-qrxvLS888pNJFwJdK+hf1wpRCSQcqA6W5+Ox202NDa0=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "b06025f1533a1e07b6db3e75151caa155d1c7eb3", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "ref": "nixos-unstable", + "type": "indirect" + } + }, + "root": { + "inputs": { + "home-manager": "home-manager", + "nixpkgs": "nixpkgs", + "nixpkgs-unstable": "nixpkgs-unstable" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..6706240 --- /dev/null +++ b/flake.nix @@ -0,0 +1,109 @@ +{ + description = "siempie's special"; + + # inputs + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/release-23.11"; + nixpkgs-unstable.url = "nixpkgs/nixos-unstable"; + home-manager = { + url = "github:nix-community/home-manager/release-23.11"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + # outputs + outputs = { self, nixpkgs, nixpkgs-unstable,home-manager, ...} @ inputs: let + inherit (self) outputs; + system = "x86_64-linux"; + pkgs = import nixpkgs { + inherit system; + config.allowUnfree = true; + }; + unstableOverlay = final: prev: { + unstable = import nixpkgs-unstable { + system = "x86_64-linux"; + config.allowUnfree = true; + }; + }; + + lib = nixpkgs.lib; + in { + nixosConfigurations = { + + # laptop - itclt75 + itclt75 = lib.nixosSystem { + specialArgs = {inherit inputs outputs;}; + specialArgs.channels = { inherit nixpkgs nixpkgs-unstable; }; + inherit system; + modules = [ + ({ + nixpkgs = { + overlays = [ unstableOverlay ]; + config.allowUnfree = true; + }; + }) + ./nix/systems/itclt75/configuration.nix + home-manager.nixosModules.home-manager { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.users.simon = { + imports = [ + ./nix/home + ]; + }; + } + ]; + }; + + # laptop - talathiel + talathiel = lib.nixosSystem { + specialArgs = {inherit inputs outputs;}; + specialArgs.channels = { inherit nixpkgs nixpkgs-unstable; }; + inherit system; + modules = [ + ({ + nixpkgs = { + overlays = [ unstableOverlay ]; + config.allowUnfree = true; + }; + }) + ./nix/systems/talathiel/configuration.nix + home-manager.nixosModules.home-manager { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.users.simon = { + imports = [ + ./nix/home + ]; + }; + } + ]; + }; + + # desktop - phaedra + phaedra = lib.nixosSystem { + specialArgs = {inherit inputs outputs;}; + specialArgs.channels = { inherit nixpkgs nixpkgs-unstable; }; + inherit system; + modules = [ + ({ + nixpkgs = { + overlays = [ unstableOverlay ]; + config.allowUnfree = true; + }; + }) + ./nix/systems/phaedra/configuration.nix + home-manager.nixosModules.home-manager { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.users.simon = { + imports = [ + ./nix/home + ]; + }; + } + ]; + }; + }; + }; +} diff --git a/hyprland/centre_app.sh b/hyprland/centre_app.sh new file mode 100755 index 0000000..e0e1717 --- /dev/null +++ b/hyprland/centre_app.sh @@ -0,0 +1,36 @@ +#!/usr/bin/env bash + +# manage arguments +while [[ $# -gt 0 ]]; do + case "$1" in + --class) + app_class="$2" + shift 2 + ;; + --title) + app_title="$2" + shift 2 + ;; + *) + echo "Invalid option: $1" + exit 1 + ;; + esac +done + + +# function to center the app +handle() { + event="${1%%>>*}" + edata="${1#*>>}" + IFS=',' read -ra array <<< "$edata" + + if [[ $event = "openwindow" && ${array[2]} = "${app_class}" && ${array[3]} = "${app_title}" ]]; then + hyprctl dispatch centerwindow + fi +} + +# read the socket and activate the function +while IFS= read -r line; do + handle "$line" +done < <(socat -U - UNIX-CONNECT:/tmp/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock) diff --git a/hyprland/conf.d/bindings.conf b/hyprland/conf.d/bindings.conf new file mode 100644 index 0000000..ee1c0f4 --- /dev/null +++ b/hyprland/conf.d/bindings.conf @@ -0,0 +1,84 @@ +binds { + workspace_back_and_forth = true +} + +# bindings +$mainMod = SUPER + +# basic key bindings +bind = $mainMod, Return, exec, alacritty +bind = $mainMod, B, exec, blueman-manager +bind = $mainMod, C, exec, alacritty --class clipse --command clipse $PPID +bind = $mainMod, D, exec, ~/.dotfiles/wofi/wofi.sh +bind = $mainMod, E, exec, nautilus --new-window +bind = $mainMod, F, fullscreen +bind = $mainMod, J, togglesplit +bind = $mainMod, K, exec, alacritty --class scratchbox +bind = $mainMod, M, exit, +bind = $mainMod, N, exec, alacritty --class nmtui --command ~/.dotfiles/hyprland/nmtui.sh +bind = $mainMod, P, pseudo +bind = $mainMod, Q, killactive +bind = $mainMod, S, exec, $screenshot +bind = $mainMod, T, exec, alacritty --class nostt --command nostt +bind = $mainMod, V, togglefloating + +# manage lockscreen +bind = $mainMod, L, exec, ~/.dotfiles/swaylock/lock.sh +bindl = ,switch:on:Lid Switch, exec, ~/.dotfiles/swaylock/lock.sh + +# focus bindings +bind = $mainMod, up, movefocus, u +bind = $mainMod, down, movefocus, d +bind = $mainMod, left, movefocus, l +bind = $mainMod, right, movefocus, r + +# switch workspace bindings +bind = $mainMod, 1, workspace, 1 +bind = $mainMod, 2, workspace, 2 +bind = $mainMod, 3, workspace, 3 +bind = $mainMod, 4, workspace, 4 +bind = $mainMod, 5, workspace, 5 +bind = $mainMod, 6, workspace, 6 +bind = $mainMod, 7, workspace, 7 +bind = $mainMod, 8, workspace, 8 +bind = $mainMod, 9, workspace, 9 +bind = $mainMod, 0, workspace, 10 + +# move window to workspaces bindings +bind = $mainMod SHIFT, 1, movetoworkspace, 1 +bind = $mainMod SHIFT, 2, movetoworkspace, 2 +bind = $mainMod SHIFT, 3, movetoworkspace, 3 +bind = $mainMod SHIFT, 4, movetoworkspace, 4 +bind = $mainMod SHIFT, 5, movetoworkspace, 5 +bind = $mainMod SHIFT, 6, movetoworkspace, 6 +bind = $mainMod SHIFT, 7, movetoworkspace, 7 +bind = $mainMod SHIFT, 8, movetoworkspace, 8 +bind = $mainMod SHIFT, 9, movetoworkspace, 9 +bind = $mainMod SHIFT, 0, movetoworkspace, 10 + +# move workspaces using the mouse +bind = $mainMod, mouse_up, workspace, e+1 +bind = $mainMod, mouse_down, workspace, e-1 + +# move window using keys +bind = ALT SHIFT, up, movewindow, u +bind = ALT SHIFT, down, movewindow, d +bind = ALT SHIFT, left, movewindow, l +bind = ALT SHIFT, right, movewindow, r + +# move windows using the mouse +bindm = $mainMod, mouse:272, movewindow +bindm = $mainMod, mouse:273, resizewindow + +# resize window bindings +bind = $mainMod SHIFT, up, resizeactive, 0 -50 +bind = $mainMod SHIFT, down, resizeactive, 0 50 +bind = $mainMod SHIFT, left, resizeactive, -50 0 +bind = $mainMod SHIFT, right, resizeactive, 50 0 + +# multimedia key bindings +bind = ,XF86AudioMute, exec, wpctl set-mute @DEFAULT_SINK@ toggle +bind = ,XF86AudioRaiseVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+ +bind = ,XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%- +bind = ,XF86MonBrightnessDown, exec, brightnessctl set 10%- +bind = ,XF86MonBrightnessUp, exec, brightnessctl set 10%+ diff --git a/hyprland/conf.d/executions.conf b/hyprland/conf.d/executions.conf new file mode 100644 index 0000000..5c8a4c0 --- /dev/null +++ b/hyprland/conf.d/executions.conf @@ -0,0 +1,41 @@ +# start waybar +exec = ~/.dotfiles/waybar/startup.sh + +# set monitor workspaces +exec = ~/.dotfiles/hyprland/monitor.sh + +# start tailscale +exec-once = tailscale up + +# clear and start clipse +exec-once = clipse -clear +exec-once = clipse -listen + +# start blueman +exec = blueman-tray + +# theming +exec = ~/.dotfiles/wallpaper/startup.sh + +# set volume +exec-once = wpctl set-volume @DEFAULT_AUDIO_SINK@ 80% + +# solaar +exec-once = ~/.dotfiles/hyprland/startup/solaar.sh + +# nextcloud desktop +exec-once = ~/.dotfiles/hyprland/startup/nextcloud_desktop.sh + +# center apps +exec = ~/.dotfiles/hyprland/centre_app.sh --class "solaar" --title "solaar" +exec = ~/.dotfiles/hyprland/centre_app.sh --class "nostt" --title "Alacritty" +exec = ~/.dotfiles/hyprland/centre_app.sh --class "nmtui" --title "Alacritty" +exec = ~/.dotfiles/hyprland/centre_app.sh --class "Rofi" --title "rofi -  Apps" +exec = ~/.dotfiles/hyprland/centre_app.sh --class "scratchbox" --title "Alacritty" +exec = ~/.dotfiles/hyprland/centre_app.sh --class "blueman-manager" --title "Bluetooth Devices" +exec = ~/.dotfiles/hyprland/centre_app.sh --class "com.gabm.satty" --title "satty" + +# start default apps +exec-once = [workspace 1 silent] bitwarden +exec-once = [workspace 2 silent] firefox +exec-once = [workspace 3 silent] alacritty diff --git a/hyprland/conf.d/general.conf b/hyprland/conf.d/general.conf new file mode 100644 index 0000000..99d0c9d --- /dev/null +++ b/hyprland/conf.d/general.conf @@ -0,0 +1,23 @@ +# dwindle secion +dwindle { + pseudotile = yes + preserve_split = yes +} + +# general section +general { + border_size = 3 + + col.active_border = rgba(528bffaa) + col.inactive_border = rgba(595959aa) + + gaps_in = 5 + gaps_out = 20 + + layout = dwindle +} + +misc { + disable_hyprland_logo = true + disable_splash_rendering = true +} diff --git a/hyprland/conf.d/graphics.conf b/hyprland/conf.d/graphics.conf new file mode 100644 index 0000000..b756523 --- /dev/null +++ b/hyprland/conf.d/graphics.conf @@ -0,0 +1,51 @@ +# monitors +monitor = eDP-1, preferred, 760x1440, 1 # laptop (native: 2560x1600@60, preffered 1920x1200) +monitor = , preferred, 0x0, 1 # default resolution on any other screen + +# unscale xwayland +xwayland { + force_zero_scaling = true +} + +# animation section +animations { + enabled = yes + + bezier = fade, 0.05, 1, 0.1, 1 + bezier = smoothOut, 0.36, 0, 0.66, 1 + bezier = smoothIn, 0.25, 1, 0.5, 1 + + animation = windows, 1, 3, smoothIn, + animation = windowsOut, 1, 3, smoothOut, + animation = windowsMove, 1, 3, default + animation = border, 1, 10, default + animation = fade, 1, 5, smoothIn + animation = fadeDim, 1, 5, smoothIn + animation = workspaces, 1, 8, fade +} + +# decoration section +decoration { + + # blur + blur { + enabled = true + size = 2 + passes = 2 + } + + # windows + rounding = 16 + + # shadows + drop_shadow = true + shadow_offset = 2 2 + shadow_range = 8 + shadow_render_power = 2 + shadow_ignore_window = true + col.shadow = 0x66000000 + + # opacity + active_opacity = 1.0 + inactive_opacity = 1.0 +} diff --git a/hyprland/conf.d/input.conf b/hyprland/conf.d/input.conf new file mode 100644 index 0000000..47ad6b6 --- /dev/null +++ b/hyprland/conf.d/input.conf @@ -0,0 +1,19 @@ +# gesture secion +gestures { + workspace_swipe = true + workspace_swipe_min_speed_to_force = 80 + workspace_swipe_cancel_ratio = 0.2 +} + +# input section +input { + kb_layout = us + follow_mouse = 1 + sensitivity = 0 + + touchpad { + disable_while_typing = true + natural_scroll = yes + } + +} diff --git a/hyprland/conf.d/variables.conf b/hyprland/conf.d/variables.conf new file mode 100644 index 0000000..a7d0f52 --- /dev/null +++ b/hyprland/conf.d/variables.conf @@ -0,0 +1,8 @@ +# variables + +# screenshot +$screenshot = grimblast --notify save area - | \ + satty \ + --filename - \ + --fullscreen \ + --output-filename ~/Pictures/Screenshots/satty-$(date '+%Y%m%d-%H:%M:%S').png diff --git a/hyprland/conf.d/window_rules.conf b/hyprland/conf.d/window_rules.conf new file mode 100644 index 0000000..64b03bd --- /dev/null +++ b/hyprland/conf.d/window_rules.conf @@ -0,0 +1,69 @@ +# master section +master { + new_is_master = true +} + +# window rules +windowrule = float, confirm|confirmreset +windowrule = float, dialog|download +windowrule = float, error|eog +windowrule = float, file-roller|file_progress +windowrule = float, Lxappearance|notification +windowrule = float, splash +windowrule = float, title:branchdialog +windowrule = float, title:Nextcloud + +# alacritty +windowrulev2 = float, class:(scratchbox) +windowrulev2 = size 1200 800, class:(scratchbox) +windowrulev2 = move center, class:(scratchbox) + +# blueman +windowrulev2 = float, class:(blueman-manager), title:(Bluetooth Devices) +windowrulev2 = size 1000 800, class:(blueman-manager), title:(Bluetooth Devices) +windowrulev2 = move center, class:(blueman-manager), title:(Bluetooth Devices) + +# clipse +windowrulev2 = float, class:(clipse) +windowrulev2 = size 1000 800, class:(clipse) +windowrulev2 = move center, class:(clipse) + +# save as +windowrulev2 = float, title:(Save As) +windowrulev2 = size 1000 800, title:(Save As) +windowrulev2 = move center, title:(Save As) + +# open file +windowrulev2 = float, title:(Open File) +windowrulev2 = size 1000 800, title:(Open File) +windowrulev2 = move center, title:(Open File) + +# add folder to workspace +windowrulev2 = float, title:(Add Folder to Workspace) +windowrulev2 = size 1000 800, title:(Add Folder to Workspace) +windowrulev2 = move center, title:(Add Folder to Workspace) + +# network manager tui +windowrulev2 = float, class:(nmtui), title:(Alacritty) +windowrulev2 = size 1180 792, class:(nmtui), title:(Alacritty) +windowrulev2 = move center, class:(nmtui), title:(Alacritty) + +# nos teletekst +windowrulev2 = float, class:(nostt), title:(Alacritty) +windowrulev2 = size 455 660, class:(nostt), title:(Alacritty) +windowrulev2 = move center, class:(nostt), title:(Alacritty) + +# satty +windowrulev2 = float, class:(com.gabm.satty), title:(satty) +windowrulev2 = size 85% 80%, class:(com.gabm.satty), title:(satty) +windowrulev2 = move center, class:(com.gabm.satty), title:(satty) + +# solaar +windowrulev2 = float, class:(solaar), title:(solaar) +windowrulev2 = size 1000 800, class:(solaar), title:(solaar) +windowrulev2 = move center, class:(solaar), title:(solaar) + +# volume control +windowrulev2 = float, title:(Volume Control) +windowrulev2 = size 1000 800, title:(Volume Control) +windowrulev2 = move center, title:(Volume Control) diff --git a/hyprland/hyprland.conf b/hyprland/hyprland.conf new file mode 100644 index 0000000..2c9e29e --- /dev/null +++ b/hyprland/hyprland.conf @@ -0,0 +1,7 @@ +source = ~/.dotfiles/hyprland/conf.d/variables.conf # set variables +source = ~/.dotfiles/hyprland/conf.d/executions.conf # app executions +source = ~/.dotfiles/hyprland/conf.d/general.conf # general hyprland +source = ~/.dotfiles/hyprland/conf.d/graphics.conf # graphics section +source = ~/.dotfiles/hyprland/conf.d/input.conf # input and gestures +source = ~/.dotfiles/hyprland/conf.d/window_rules.conf # window rules +source = ~/.dotfiles/hyprland/conf.d/bindings.conf # key bindings diff --git a/hyprland/monitor.sh b/hyprland/monitor.sh new file mode 100755 index 0000000..31bd2d9 --- /dev/null +++ b/hyprland/monitor.sh @@ -0,0 +1,41 @@ +#!/usr/bin/env zsh + +# sleep +sleep 2s + +# gather monitor count +monitor_count=$(hyprctl monitors -j | jq '. | length') + +# single monitor +if [[ "$monitor_count" == 1 ]]; then + + # set primary monitor + primary_monitor=$(hyprctl monitors -j | jq -r '.[0].name') + + # move all workspaces to primary monitor + for ((ws = 1; ws <= 10; ws++)); do + hyprctl keyword wsbind $ws,$primary_monitor > /dev/null + hyprctl dispatch moveworkspacetomonitor $ws $primary_monitor > /dev/null + done + + +# dual monitor +elif [[ "$monitor_count" == 2 ]]; then + + # set both monitors + primary_monitor=$(hyprctl monitors -j | jq -r '.[0].name') + external_monitor=$(hyprctl monitors -j | jq -r '.[1].name') + + # move workspace 1 to primary monitor + hyprctl keyword wsbind 1,$primary_monitor > /dev/null + hyprctl dispatch moveworkspacetomonitor 1 $primary_monitor > /dev/null + + # move workspace 2-8 to + for ((ws = 2; ws <= 8; ws++)); do + hyprctl keyword wsbind $ws,$external_monitor > /dev/null + hyprctl dispatch moveworkspacetomonitor $ws $external_monitor > /dev/null + done + +else # more than 2 monitors... + echo "Not supported" +fi diff --git a/hyprland/nmtui.sh b/hyprland/nmtui.sh new file mode 100755 index 0000000..4c8de6a --- /dev/null +++ b/hyprland/nmtui.sh @@ -0,0 +1,3 @@ +nmcli device wifi rescan +read -t 0.1 +nmtui diff --git a/hyprland/startup/nextcloud_desktop.sh b/hyprland/startup/nextcloud_desktop.sh new file mode 100755 index 0000000..1430cdf --- /dev/null +++ b/hyprland/startup/nextcloud_desktop.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env zsh + +# sleep some time +sleep 2s + +# check if nextcloud is already running +pkill nextcloud + +# start nextcloud +nextcloud diff --git a/hyprland/startup/solaar.sh b/hyprland/startup/solaar.sh new file mode 100755 index 0000000..c927c88 --- /dev/null +++ b/hyprland/startup/solaar.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env zsh + +# sleep some time +sleep 2s + +# check if solaar is already running +pkill solaar + +# start solaar +solaar --window=hide diff --git a/nix/home/alacritty/alacritty.nix b/nix/home/alacritty/alacritty.nix new file mode 100644 index 0000000..00ff1d2 --- /dev/null +++ b/nix/home/alacritty/alacritty.nix @@ -0,0 +1,109 @@ +{ config, pkgs, ... }: +{ + + # alacritty + programs.alacritty = { + enable = true; + package = pkgs.alacritty; + settings = { + + # general + live_config_reload = true; + mouse.hide_when_typing = true; + scrolling.history = 20000; + shell.program = "zsh"; + + # environment + env = { + "TERM" = "xterm-256color"; + }; + + # colors + colors = { + + # bright colors + bright = { + black = "#545454"; + blue = "#729fcf"; + cyan = "#34e2e2"; + green = "#8ae234"; + magenta = "#ad7fa8"; + red = "#ef2929"; + white = "#eeeeec"; + yellow = "#fce94f"; + }; + + # normal colors + normal = { + black = "#000000"; + blue = "#3465a4"; + cyan = "#06989a"; + green = "#4e9a06"; + magenta = "#75507b"; + red = "#cc0000"; + white = "#d3d7cf"; + yellow = "#c4a000"; + }; + + # primary colors + primary = { + background = "#000000"; + foreground = "#ffffff"; + }; + }; + + # cursor + cursor = { + blink_interval = 750; + style = { + blinking = "always"; + shape = "underline"; + }; + }; + + # font + font = { + size = 14.0; + + # normal font + normal = { + family = "JetBrainsMonoNL"; + style = "Light"; + }; + + # bold font + bold = { + family = "JetBrainsMonoNL"; + style = "Light"; + }; + + # italic font + italic = { + family = "JetBrainsMonoNL"; + style = "Light"; + }; + }; + + # keyboard + keyboard.bindings = [{ + action = "SpawnNewInstance"; + key = "Return"; + mods = "Control|Shift"; + } + ]; + + # window + window = { + opacity = 0.75; + class = { + general = "Alacritty"; + instance = "Alacritty"; + }; + padding = { + x = 7; + y = 5; + }; + }; + }; + }; +} diff --git a/nix/home/alacritty/default.nix b/nix/home/alacritty/default.nix new file mode 100644 index 0000000..adecb4e --- /dev/null +++ b/nix/home/alacritty/default.nix @@ -0,0 +1 @@ +{ ... }: { imports = [ ./alacritty.nix ]; } diff --git a/nix/home/default.nix b/nix/home/default.nix new file mode 100644 index 0000000..151a966 --- /dev/null +++ b/nix/home/default.nix @@ -0,0 +1,25 @@ +{ config, pkgs, ... }: +{ + + # imports + imports = [ + ./alacritty + ./git + ./mpv + ./ssh + ./theme + ./xdg + ./zsh + ]; + + # user + home.username = "simon"; + home.homeDirectory = "/home/simon"; + + # fonts + fonts.fontconfig.enable = true; + + # home-manager + home.stateVersion = "23.05"; + programs.home-manager.enable = true; +} diff --git a/nix/home/git/default.nix b/nix/home/git/default.nix new file mode 100644 index 0000000..7a87887 --- /dev/null +++ b/nix/home/git/default.nix @@ -0,0 +1 @@ +{ ... }: { imports = [ ./git.nix ]; } diff --git a/nix/home/git/git.nix b/nix/home/git/git.nix new file mode 100644 index 0000000..6acde8e --- /dev/null +++ b/nix/home/git/git.nix @@ -0,0 +1,39 @@ +{ config, pkgs, ... }: +{ + + # git + programs.git = { + enable = true; + userName = "Simon Cornet"; + userEmail = "simon@simoncor.net"; + aliases = { + + # commit + message + cam = "commit -am"; + + }; + extraConfig = { + + # generic + advice.addIgnoredFile = false; + init.defaultBranch = "master"; + push.default = "matching"; + web.browser = "firefox"; + + # core config + core = { + editor = "vim"; + filemode = true; + + packedGitLimit = "512m"; + packedGitWindowSize = "512m"; + compression = 0; + }; + + # credential cache + credential = { + helper = "cache --timeout 172800"; + }; + }; + }; +} diff --git a/nix/home/mpv/default.nix b/nix/home/mpv/default.nix new file mode 100644 index 0000000..f9b1c00 --- /dev/null +++ b/nix/home/mpv/default.nix @@ -0,0 +1 @@ +{ ... }: { imports = [ ./mpv.nix ]; } diff --git a/nix/home/mpv/mpv.nix b/nix/home/mpv/mpv.nix new file mode 100644 index 0000000..45666a7 --- /dev/null +++ b/nix/home/mpv/mpv.nix @@ -0,0 +1,13 @@ +{ config, ... }: +{ + + # enable mpv + programs.mpv = { + enable = true; + config = { + hwdec = "auto"; + profile = "gpu-hq"; + vo = "gpu"; + }; + }; +} diff --git a/nix/home/ssh/default.nix b/nix/home/ssh/default.nix new file mode 100644 index 0000000..67a3906 --- /dev/null +++ b/nix/home/ssh/default.nix @@ -0,0 +1 @@ +{ ... }: { imports = [ ./ssh.nix ]; } diff --git a/nix/home/ssh/ssh.nix b/nix/home/ssh/ssh.nix new file mode 100644 index 0000000..c82fc77 --- /dev/null +++ b/nix/home/ssh/ssh.nix @@ -0,0 +1,9 @@ +{ config, pkgs, ... }: +{ + + # ssh + programs.ssh = { + enable = true; + includes = [ "${config.home.homeDirectory}/.dotfiles/ssh/config" ]; + }; +} diff --git a/nix/home/theme/default.nix b/nix/home/theme/default.nix new file mode 100644 index 0000000..ab3a809 --- /dev/null +++ b/nix/home/theme/default.nix @@ -0,0 +1,6 @@ +{...}: { + imports = [ + ./gtk.nix + ./qt.nix + ]; +} diff --git a/nix/home/theme/gtk.nix b/nix/home/theme/gtk.nix new file mode 100644 index 0000000..6669abc --- /dev/null +++ b/nix/home/theme/gtk.nix @@ -0,0 +1,48 @@ +{ config, pkgs, ... }: +{ + # default cursor + home.pointerCursor = { + name = "Bibata-Modern-Ice"; + size = 24; + package = pkgs.bibata-cursors; + }; + + # dconf settings + dconf.settings = { + "org/gnome/desktop/interface" = { + color-scheme = "prefer-dark"; + gtk-theme = "Catppuccin-Macchiato-Standard-Sky-Dark"; + cursor-theme = config.home.pointerCursor.name; + cursor-size = config.home.pointerCursor.size; + }; + }; + + # gtk + gtk = { + enable = true; + + # theme + theme = { + name = "Catppuccin-Macchiato-Standard-Sky-Dark"; + package = pkgs.catppuccin-gtk.override { + accents = [ "sky" ]; + size = "standard"; + variant = "macchiato"; + }; + }; + + # cursor + cursorTheme = { + name = config.home.pointerCursor.name; + size = config.home.pointerCursor.size; + package = config.home.pointerCursor.package; + }; + }; + + # xdg settings + xdg.configFile = { + "gtk-4.0/assets".source = "${config.gtk.theme.package}/share/themes/${config.gtk.theme.name}/gtk-4.0/assets"; + "gtk-4.0/gtk.css".source = "${config.gtk.theme.package}/share/themes/${config.gtk.theme.name}/gtk-4.0/gtk.css"; + "gtk-4.0/gtk-dark.css".source = "${config.gtk.theme.package}/share/themes/${config.gtk.theme.name}/gtk-4.0/gtk-dark.css"; + }; +} diff --git a/nix/home/theme/qt.nix b/nix/home/theme/qt.nix new file mode 100644 index 0000000..f102548 --- /dev/null +++ b/nix/home/theme/qt.nix @@ -0,0 +1,9 @@ +{ ... }: { + + # qt + qt = { + enable = true; + style.name = "adwaita-dark"; + platformTheme = "gnome"; + }; +} diff --git a/nix/home/xdg/default.nix b/nix/home/xdg/default.nix new file mode 100644 index 0000000..16ef253 --- /dev/null +++ b/nix/home/xdg/default.nix @@ -0,0 +1 @@ +{ ... }: { imports = [ ./xdg.nix ]; } diff --git a/nix/home/xdg/xdg.nix b/nix/home/xdg/xdg.nix new file mode 100644 index 0000000..c54cbce --- /dev/null +++ b/nix/home/xdg/xdg.nix @@ -0,0 +1,83 @@ +{ config, ... }: +{ + + # xdg + xdg.configFile."mimeapps.list".force = true; + + # set defaults + xdg.mimeApps = { + enable = true; + defaultApplications = { + + # images + "image/bmp" = [ "org.gnome.Loupe.desktop" ]; + "image/gif" = [ "org.gnome.Loupe.desktop" ]; + "image/heic" = [ "org.gnome.Loupe.desktop" ]; + "image/jpeg" = [ "org.gnome.Loupe.desktop" ]; + "image/svg+xml" = [ "org.gnome.Loupe.desktop" ]; + "image/webp" = [ "org.gnome.Loupe.desktop" ]; + "image/x-icon" = [ "org.gnome.Loupe.desktop" ]; + "image/x-panasonic-raw" = [ "org.gnome.Loupe.desktop" ]; + + # video + "application/mxf" = [ "mpv.desktop" ]; + "application/sdp" = [ "mpv.desktop" ]; + "application/smil" = [ "mpv.desktop" ]; + "application/streamingmedia" = [ "mpv.desktop" ]; + "application/vnd.apple.mpegurl" = [ "mpv.desktop" ]; + "application/vnd.ms-asf" = [ "mpv.desktop" ]; + "application/vnd.rn-realmedia" = [ "mpv.desktop" ]; + "application/vnd.rn-realmedia-vbr" = [ "mpv.desktop" ]; + "application/x-cue" = [ "mpv.desktop" ]; + "application/x-extension-m4a" = [ "mpv.desktop" ]; + "application/x-extension-mp4" = [ "mpv.desktop" ]; + "application/x-matroska" = [ "mpv.desktop" ]; + "application/x-mpegurl" = [ "mpv.desktop" ]; + "application/x-ogm" = [ "mpv.desktop" ]; + "application/x-ogm-video" = [ "mpv.desktop" ]; + "application/x-shorten" = [ "mpv.desktop" ]; + "application/x-smil" = [ "mpv.desktop" ]; + "application/x-streamingmedia" = [ "mpv.desktop" ]; + + "video/3gp" = [ "mpv.desktop" ]; + "video/3gpp" = [ "mpv.desktop" ]; + "video/3gpp2" = [ "mpv.desktop" ]; + "video/avi" = [ "mpv.desktop" ]; + "video/divx" = [ "mpv.desktop" ]; + "video/dv" = [ "mpv.desktop" ]; + "video/fli" = [ "mpv.desktop" ]; + "video/flv" = [ "mpv.desktop" ]; + "video/mkv" = [ "mpv.desktop" ]; + "video/mp2t" = [ "mpv.desktop" ]; + "video/mp4" = [ "mpv.desktop" ]; + "video/mp4v-es" = [ "mpv.desktop" ]; + "video/mpeg" = [ "mpv.desktop" ]; + "video/msvideo" = [ "mpv.desktop" ]; + "video/ogg" = [ "mpv.desktop" ]; + "video/quicktime" = [ "mpv.desktop" ]; + "video/vnd.divx" = [ "mpv.desktop" ]; + "video/vnd.mpegurl" = [ "mpv.desktop" ]; + "video/vnd.rn-realvideo" = [ "mpv.desktop" ]; + "video/webm" = [ "mpv.desktop" ]; + + "video/x-avi" = [ "mpv.desktop" ]; + "video/x-flc" = [ "mpv.desktop" ]; + "video/x-flic" = [ "mpv.desktop" ]; + "video/x-flv" = [ "mpv.desktop" ]; + "video/x-m4v" = [ "mpv.desktop" ]; + "video/x-matroska" = [ "mpv.desktop" ]; + "video/x-mpeg2" = [ "mpv.desktop" ]; + "video/x-mpeg3" = [ "mpv.desktop" ]; + "video/x-ms-afs" = [ "mpv.desktop" ]; + "video/x-ms-asf" = [ "mpv.desktop" ]; + "video/x-ms-wmv" = [ "mpv.desktop" ]; + "video/x-ms-wmx" = [ "mpv.desktop" ]; + "video/x-ms-wvxvideo" = [ "mpv.desktop" ]; + "video/x-msvideo" = [ "mpv.desktop" ]; + "video/x-ogm" = [ "mpv.desktop" ]; + "video/x-ogm+ogg" = [ "mpv.desktop" ]; + "video/x-theora" = [ "mpv.desktop" ]; + "video/x-theora+ogg" = [ "mpv.desktop" ]; + }; + }; +} diff --git a/nix/home/zsh/default.nix b/nix/home/zsh/default.nix new file mode 100644 index 0000000..54d4b09 --- /dev/null +++ b/nix/home/zsh/default.nix @@ -0,0 +1 @@ +{ ... }: { imports = [ ./zsh.nix ]; } diff --git a/nix/home/zsh/zsh.nix b/nix/home/zsh/zsh.nix new file mode 100644 index 0000000..406b9ac --- /dev/null +++ b/nix/home/zsh/zsh.nix @@ -0,0 +1,53 @@ +{ config, pkgs, ... }: +{ + + # zsh + programs.zsh = { + + # general + enable = true; + + # settings + enableCompletion = true; + enableAutosuggestions = true; + syntaxHighlighting.enable = true; + + # oh-my-zsh + oh-my-zsh = { + enable = true; + plugins = [ "git" ]; + theme = "bira"; + }; + + # aliasses + shellAliases = { + + # logout from hyprland + tata = "hyprctl dispatch exit"; + + # git + gfo = "git fetch origin"; + gmo = "git merge origin"; + gpo = "git push origin"; + gfu = "git fetch upstream"; + gmu = "git merge upstream"; + + # k9s + k9s = "ssh k9s.siempie.internal -t /home/simon/.local/bin/k9s"; + + # nixos-rebuild + system-rebuild = "sudo nixos-rebuild switch --flake ~/.dotfiles#`hostname -s`"; + system-update = "sudo nixos-rebuild switch --upgrade --flake ~/.dotfiles#`hostname -s` && sudo fwupdmgr upgrade"; + system-clean = "sudo nix-store --gc"; + system-purge = "sudo nix-collect-garbage -d"; + + # sshfs + sj-mount-media = "sshfs nas.siempie.local:/tank/media/ /home/simon/remotedir/media"; + sj-mount-siempie = "sshfs nas.siempie.local:/tank/siempie/ /home/simon/remotedir/siempie"; + + umount-media = "sudo umount /home/simon/remotedir/media"; + umount-siempie = "sudo umount /home/simon/remotedir/siempie"; + + }; + }; +} diff --git a/nix/systems/bootloader.nix b/nix/systems/bootloader.nix new file mode 100644 index 0000000..d024e27 --- /dev/null +++ b/nix/systems/bootloader.nix @@ -0,0 +1,30 @@ +{ config, pkgs, ... }: { + + # bootloader + boot.loader.efi.canTouchEfiVariables = true; + boot.loader.systemd-boot.enable = true; + boot.loader.systemd-boot.configurationLimit = 5; + boot.loader.systemd-boot.consoleMode = "max"; + + # kernel stuff + boot.kernelModules = [ "tcp_bbr" ]; + boot.kernelPackages = pkgs.linuxPackages_latest; + + # network go brr + boot.kernel.sysctl = { + "net.ipv4.tcp_congestion_control" = "bbr"; + }; + + # make boot pretty + boot.plymouth.enable = true; + boot.kernelParams = [ "quiet" ]; + boot.initrd.systemd.enable = true; + + # make console pretty + console = { + earlySetup = true; + font = "${pkgs.terminus_font}/share/consolefonts/ter-132n.psf.gz"; + keyMap = "us"; + packages = with pkgs; [ terminus_font ]; + }; +} diff --git a/nix/systems/default.nix b/nix/systems/default.nix new file mode 100644 index 0000000..4fdf5c8 --- /dev/null +++ b/nix/systems/default.nix @@ -0,0 +1,19 @@ +{ config, lib, pkgs, ... }: { + + # imports + imports = [ + ./bootloader.nix + ./desktop.nix + ./hardware.nix + ./locality.nix + ./networking.nix + ./nix.nix + ./packages.nix + ./security.nix + ./simon.nix + ./sound.nix + ]; + + # system state version + system.stateVersion = "23.11"; +} diff --git a/nix/systems/desktop.nix b/nix/systems/desktop.nix new file mode 100644 index 0000000..2e58215 --- /dev/null +++ b/nix/systems/desktop.nix @@ -0,0 +1,36 @@ +{ config, pkgs, ... }: { + + # x11 + services.xserver.enable = true; + services.xserver = { + layout = "us"; + xkbVariant = ""; + }; + + # xdg portals + xdg.portal.enable = true; + xdg.portal.extraPortals = with pkgs; [ + xdg-desktop-portal-wlr + ]; + + # xdg mime + xdg.mime.enable = true; + xdg.mime.defaultApplications = { + "text/html" = "firefox.desktop"; + "x-scheme-handler/http" = "firefox.desktop"; + "x-scheme-handler/https" = "firefox.desktop"; + "x-scheme-handler/about" = "firefox.desktop"; + "x-scheme-handler/unknown" = "firefox.desktop"; + }; + + # gnome + services.xserver.displayManager.gdm.enable = true; + services.xserver.desktopManager.gnome.enable = true; + + # hyprland + programs.hyprland = { + enable = true; + package = pkgs.unstable.hyprland; + xwayland.enable = true; + }; +} diff --git a/nix/systems/hardware.nix b/nix/systems/hardware.nix new file mode 100644 index 0000000..a5688d6 --- /dev/null +++ b/nix/systems/hardware.nix @@ -0,0 +1,17 @@ +{ config, lib, pkgs, ... }: { + + # hardware + hardware.opengl.enable = true; + hardware.enableRedistributableFirmware = true; + + # hardware logitech + hardware.logitech.wireless.enable = true; + hardware.logitech.wireless.enableGraphical = true; + + # enable bluetooth + hardware.bluetooth.enable = true; + hardware.bluetooth.powerOnBoot = true; + + # power management + powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; +} diff --git a/nix/systems/itclt75/configuration.nix b/nix/systems/itclt75/configuration.nix new file mode 100644 index 0000000..cb1d156 --- /dev/null +++ b/nix/systems/itclt75/configuration.nix @@ -0,0 +1,21 @@ +{ config, pkgs, ... }: { + + # imports + imports = [ + ../default.nix + ./hardware-configuration.nix + ]; + + # opengl + hardware.opengl = { + extraPackages = with pkgs; [ + intel-media-driver + intel-vaapi-driver + vaapiVdpau + libvdpau-va-gl + ]; + }; + + # networking + networking.hostName = "itclt75"; +} diff --git a/nix/systems/itclt75/hardware-configuration.nix b/nix/systems/itclt75/hardware-configuration.nix new file mode 100644 index 0000000..6924242 --- /dev/null +++ b/nix/systems/itclt75/hardware-configuration.nix @@ -0,0 +1,48 @@ +{ config, lib, pkgs, modulesPath, ... }: +{ + + # imports + imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; + + # bootloader + boot.extraModulePackages = [ ]; + boot.initrd.kernelModules = [ "kvm-intel" ]; + boot.initrd.availableKernelModules = [ "xhci_pci" "thunderbolt" "nvme" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ]; + boot.initrd.luks = { + devices = { + + # encrypted root + "luks-057d6954-2fbe-4566-a0b9-cc7b8a9f9fd8" = { + device = "/dev/disk/by-uuid/057d6954-2fbe-4566-a0b9-cc7b8a9f9fd8"; + }; + + # encrypted swap + "luks-4dcf40dc-d12c-43e4-8727-687451750f90" = { + device = "/dev/disk/by-uuid/4dcf40dc-d12c-43e4-8727-687451750f90"; + }; + }; + }; + + # filesystems - boot + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/5180-0B5A"; + fsType = "vfat"; + }; + + # filesystems - root + fileSystems."/" = { + device = "/dev/disk/by-uuid/ad8f83d1-3c00-49cc-90eb-8679d6600ddc"; + fsType = "ext4"; + }; + + # swap device + swapDevices = [{ + device = "/dev/disk/by-uuid/e4772fc5-e676-48e4-9c35-3934e9a178b1"; + }]; + + # networking + networking.useDHCP = lib.mkDefault true; + + # hardware + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/nix/systems/locality.nix b/nix/systems/locality.nix new file mode 100644 index 0000000..de8b7d0 --- /dev/null +++ b/nix/systems/locality.nix @@ -0,0 +1,20 @@ +{ config, pkgs, ... }: { + + # timezone + time.timeZone = "Europe/Amsterdam"; + + # internationalisation + i18n.defaultLocale = "en_US.UTF-8"; + i18n.extraLocaleSettings = { + LC_ADDRESS = "nl_NL.UTF-8"; + LC_IDENTIFICATION = "en_US.UTF-8"; + LC_MEASUREMENT = "nl_NL.UTF-8"; + LC_MONETARY = "nl_NL.UTF-8"; + LC_NAME = "en_US.UTF-8"; + LC_NUMERIC = "nl_NL.UTF-8"; + LC_PAPER = "nl_NL.UTF-8"; + LC_TELEPHONE = "nl_NL.UTF-8"; + LC_TIME = "nl_NL.UTF-8"; + }; + +} diff --git a/nix/systems/networking.nix b/nix/systems/networking.nix new file mode 100644 index 0000000..93870c2 --- /dev/null +++ b/nix/systems/networking.nix @@ -0,0 +1,7 @@ +{ config, pkgs, ... }: { + + # networking + networking.networkmanager.enable = true; + networking.firewall.enable = false; + +} diff --git a/nix/systems/nix.nix b/nix/systems/nix.nix new file mode 100644 index 0000000..95dd81a --- /dev/null +++ b/nix/systems/nix.nix @@ -0,0 +1,31 @@ +{ config, lib, pkgs, ... }: { + + # nix + nix = { + + # garbage collection + gc = { + automatic = true; + dates = "weekly"; + options = "--delete-older-than 7d"; + }; + + # nix package with flakes + package = pkgs.nixFlakes; + + # nix settings + settings = { + auto-optimise-store = true; + }; + + # extra options + extraOptions = '' + experimental-features = nix-command flakes + keep-outputs = true + keep-derivations = true + ''; + }; + + # nix pkgs + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; +} diff --git a/nix/systems/packages.nix b/nix/systems/packages.nix new file mode 100644 index 0000000..813cdca --- /dev/null +++ b/nix/systems/packages.nix @@ -0,0 +1,73 @@ +{ config, pkgs, ... }: { + + # packages + nixpkgs.config.allowUnfree = true; + environment.systemPackages = with pkgs; [ + + # fonts + font-awesome + jetbrains-mono + ubuntu_font_family + + # hyprland + adwaita-qt + brightnessctl + unstable.grimblast + grim + imagemagick + jq + lxappearance-gtk2 + unstable.satty + slurp + socat + swaybg + swaylock + waybar + wofi + xfce.xfce4-settings + + # system + fastfetch + fwupd + intel-gpu-tools + killall + radeontop + pciutils + powertop + solaar + spice-vdagent + sshfs + wl-clipboard + + # usability + bat + btop + unstable.bitwarden + unstable.clipse + firefox + git + gimp + unstable.google-chrome + htop + kitty + meld + mpv + unstable.microsoft-edge + nextcloud-client + screen + unstable.spotify + unstable.vscode + vim + wget + ]; + + # services + services.blueman.enable = true; + services.fwupd.enable = true; + services.openssh.enable = true; + services.printing.enable = true; + services.tailscale = { + enable = true; + package = pkgs.unstable.tailscale; + }; +} diff --git a/nix/systems/phaedra/configuration.nix b/nix/systems/phaedra/configuration.nix new file mode 100644 index 0000000..0582abc --- /dev/null +++ b/nix/systems/phaedra/configuration.nix @@ -0,0 +1,21 @@ +{ config, pkgs, ... }: { + + # imports + imports = [ + ../default.nix + ./hardware-configuration.nix + ]; + + # opengl + hardware.opengl = { + extraPackages = with pkgs; [ + intel-media-driver + intel-vaapi-driver + vaapiVdpau + libvdpau-va-gl + ]; + }; + + # networking + networking.hostName = "phaedra"; +} diff --git a/nix/systems/phaedra/hardware-configuration.nix b/nix/systems/phaedra/hardware-configuration.nix new file mode 100644 index 0000000..1e9a0ab --- /dev/null +++ b/nix/systems/phaedra/hardware-configuration.nix @@ -0,0 +1,30 @@ +{ config, lib, pkgs, modulesPath, ... }: +{ + + # imports + imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; + + # bootloader + boot.extraModulePackages = [ ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" "amdgpu" ]; + boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ]; + + # filesystems - boot + fileSystems."/boot" = { + device = "/dev/disk/by-label/boot"; + fsType = "vfat"; + }; + + # filesystems - root + fileSystems."/" = { + device = "/dev/disk/by-label/root"; + fsType = "ext4"; + }; + + # networking + networking.useDHCP = lib.mkDefault true; + + # hardware + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/nix/systems/security.nix b/nix/systems/security.nix new file mode 100644 index 0000000..bb135ac --- /dev/null +++ b/nix/systems/security.nix @@ -0,0 +1,13 @@ +{ config, pkgs, ... }: { + + # pam + security.pam.services.swaylock = { + text = ''auth include login''; + }; + + # sudo + security.sudo.wheelNeedsPassword = false; + + # enable realtimekit + security.rtkit.enable = true; +} diff --git a/nix/systems/simon.nix b/nix/systems/simon.nix new file mode 100644 index 0000000..45d46d5 --- /dev/null +++ b/nix/systems/simon.nix @@ -0,0 +1,14 @@ +{ config, pkgs, ... }: { + + # enable zsh + programs.zsh.enable = true; + + # user simon + users.users.simon = { + isNormalUser = true; + description = "Simon Cornet"; + extraGroups = [ "networkmanager" "wheel" ]; + initialPassword = "changeme"; + shell = pkgs.zsh; + }; +} diff --git a/nix/systems/sound.nix b/nix/systems/sound.nix new file mode 100644 index 0000000..173d12d --- /dev/null +++ b/nix/systems/sound.nix @@ -0,0 +1,24 @@ +{ config, pkgs, ... }: { + + # enable sound + sound = { + enable = true; + }; + + # disable pulseaudio + hardware = { + pulseaudio = { + enable = false; + }; + }; + + # enable pipewire + services.pipewire = { + alsa = { + enable = true; + support32Bit = true; + }; + enable = true; + pulse.enable = true; + }; +} diff --git a/nix/systems/talathiel/configuration.nix b/nix/systems/talathiel/configuration.nix new file mode 100644 index 0000000..6b61dc0 --- /dev/null +++ b/nix/systems/talathiel/configuration.nix @@ -0,0 +1,21 @@ +{ config, pkgs, ... }: { + + # imports + imports = [ + ../default.nix + ./hardware-configuration.nix + ]; + + # opengl + hardware.opengl = { + extraPackages = with pkgs; [ + intel-media-driver + intel-vaapi-driver + vaapiVdpau + libvdpau-va-gl + ]; + }; + + # networking + networking.hostName = "talathiel"; +} diff --git a/nix/systems/talathiel/hardware-configuration.nix b/nix/systems/talathiel/hardware-configuration.nix new file mode 100644 index 0000000..eddce15 --- /dev/null +++ b/nix/systems/talathiel/hardware-configuration.nix @@ -0,0 +1,30 @@ +{ config, lib, pkgs, modulesPath, ... }: +{ + + # imports + imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; + + # bootloader + boot.extraModulePackages = [ ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ]; + + # filesystems - boot + fileSystems."/boot" = { + device = "/dev/disk/by-label/boot"; + fsType = "vfat"; + }; + + # filesystems - root + fileSystems."/" = { + device = "/dev/disk/by-label/root"; + fsType = "ext4"; + }; + + # networking + networking.useDHCP = lib.mkDefault true; + + # hardware + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..d76f194 --- /dev/null +++ b/readme.md @@ -0,0 +1,99 @@ +# NixOS configuration for siempie +base: NixOS 23.11 + +## Phase 1: Installation (minimal ISO) +``` +nix-shell -p git +``` + +Create partitions +``` +g (gpt disk label) +n +1 (partition number [1/128]) +2048 first sector ++500M last sector (boot sector size) +t +1 (EFI System) +n +2 +default (fill up partition) +default (fill up partition) +w (write) +``` + +Labels and filesystems +``` +sudo mkfs.fat -F 32 /dev/sda1 +sudo mkfs.ext4 /dev/sda2 -L root +sudo fatlabel /dev/sda1 boot +sudo mount /dev/disk/by-label/root /mnt +sudo mkdir -p /mnt/boot +sudo mount /dev/disk/by-label/boot /mnt/boot +``` + +Clone dotfiles repo +``` +git clone https://git.simoncor.net/siempie/dotfiles-nix.git +``` + +Nix installation +``` +cd dotfiles +sudo nixos-install --flake .# +``` + +Reboot +``` +sudo reboot +``` + + +## Phase 2: Finalize +Clone dotfiles +``` +git clone https://git.simoncor.net/siempie/dotfiles-nix.git ~/.dotfiles +``` + +Link Hyprland +``` +rm -rf ~/.config/hypr/hyprland +ln -s ~/.dotfiles/hyprland/hyprland.conf ~/.config/hypr/hyprland.conf +``` + +Login to apps +``` +bitwarden +firefox + bitwarden plugin +google-chrome + bitwarden -plugin +nextcloud +vscode +spotify +``` + +Set avatar for GDM +``` +! dont forget ! +``` + +Tailscale +``` +sudo tailscale up --login-server=https://vpn.mirahsimon.us:443 --accept-routes --operator=$USER +``` + +SSH keys +``` +! dont forget ! +``` + + +## Phase 3: Maintenance +Rebuild after changes +``` +sudo nixos-rebuild switch --upgrade --flake ~/.dotfiles# +``` + +Regularly update firmware +``` +sudo fwupdmgr update +``` diff --git a/ssh/config b/ssh/config new file mode 100644 index 0000000..cba17f3 --- /dev/null +++ b/ssh/config @@ -0,0 +1,24 @@ +# generic +host * + user simon + identityfile ~/.ssh/talathiel + ServerAliveInterval 60 + + +# siempie lab +host *.siempie.local + stricthostkeychecking no + proxyjump siempie.com + +host *.siempie.internal + stricthostkeychecking no + proxyjump siempie.com + +host *.hackerboys.internal + stricthostkeychecking no + proxyjump siempie.com + + +# siempie do +host *.do.local + proxyjump do.siempie.com diff --git a/swaylock/lock.sh b/swaylock/lock.sh new file mode 100755 index 0000000..b7b2a14 --- /dev/null +++ b/swaylock/lock.sh @@ -0,0 +1,54 @@ +#!/usr/bin/env zsh + +# get active monitors +active_monitors=($(hyprctl monitors | grep -i monitor | awk '{print $2}')) +home_dir=$(xdg-user-dir) + + +# create blurred images per active screen +for monitor in ${active_monitors} +do + + # variables + image=/tmp/swaylock_$monitor.png + image_blur=/tmp/swaylock_blur_$monitor.png + lockargs=($lockargs --image $monitor:$image_blur) + + # create image + grim -o $monitor $image + + # create blurred image + convert $image -blur 0x5 $image_blur + +done + + +# lock the screen using the newly created image +swaylock \ + --scaling center \ + --hide-keyboard-layout \ + --indicator-radius 100 \ + --indicator-thickness 5 \ + --ring-color 285577ff \ + --ring-ver-color 89b4fa \ + --ring-wrong-color f38ba8 \ + --ring-clear-color a6e3a1 \ + --key-hl-color 1e1e2e \ + --bs-hl-color eba0ac \ + --text-color 11111b \ + --text-caps-lock-color 11111b \ + --line-color 00000000 \ + --line-ver-color 00000000 \ + --line-wrong-color 00000000 \ + --line-clear-color 00000000 \ + --separator-color 00000000 \ + --inside-color 285577ff \ + --inside-ver-color 89b4fa\ + --inside-wrong-color f38ba8 \ + --inside-clear-color a6e3a1 \ + --color 1e1e2e80 \ + $lockargs + + +# cleanup +rm -f /tmp/swaylock*.png diff --git a/wallpaper/startup.sh b/wallpaper/startup.sh new file mode 100755 index 0000000..8361a3d --- /dev/null +++ b/wallpaper/startup.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env zsh + +# check if swaybg is already running +pkill swaybg + +# config +wallpaper=(~/Pictures/wallpaper.jpg) +wallpaper_url='https://wallscloud.net/img/resize/3840/2160/MM/2022-03-30-blurred.jpg' + +# download the wallpaper +if [ ! -f ${wallpaper} ]; then + wget -q -O ${wallpaper} ${wallpaper_url} +fi + +# start swaybg +swaybg -m fill -i ${wallpaper} & diff --git a/waybar/spotify.py b/waybar/spotify.py new file mode 100644 index 0000000..7d80301 --- /dev/null +++ b/waybar/spotify.py @@ -0,0 +1,178 @@ +#!/usr/bin/env python3 +import gi +gi.require_version("Playerctl", "2.0") +from gi.repository import Playerctl, GLib +from gi.repository.Playerctl import Player +import argparse +import logging +import sys +import signal +import gi +import json +import os +from typing import List + +logger = logging.getLogger(__name__) + +def signal_handler(sig, frame): + logger.info("Received signal to stop, exiting") + sys.stdout.write("\n") + sys.stdout.flush() + # loop.quit() + sys.exit(0) + + +class PlayerManager: + def __init__(self, selected_player=None): + self.manager = Playerctl.PlayerManager() + self.loop = GLib.MainLoop() + self.manager.connect( + "name-appeared", lambda *args: self.on_player_appeared(*args)) + self.manager.connect( + "player-vanished", lambda *args: self.on_player_vanished(*args)) + + signal.signal(signal.SIGINT, signal_handler) + signal.signal(signal.SIGTERM, signal_handler) + signal.signal(signal.SIGPIPE, signal.SIG_DFL) + self.selected_player = selected_player + + self.init_players() + + def init_players(self): + for player in self.manager.props.player_names: + if self.selected_player is not None and self.selected_player != player.name: + logger.debug(f"{player.name} is not the filtered player, skipping it") + continue + self.init_player(player) + + def run(self): + logger.info("Starting main loop") + self.loop.run() + + def init_player(self, player): + logger.info(f"Initialize new player: {player.name}") + player = Playerctl.Player.new_from_name(player) + player.connect("playback-status", + self.on_playback_status_changed, None) + player.connect("metadata", self.on_metadata_changed, None) + self.manager.manage_player(player) + self.on_metadata_changed(player, player.props.metadata) + + def get_players(self) -> List[Player]: + return self.manager.props.players + + def write_output(self, text, player): + logger.debug(f"Writing output: {text}") + + output = {"text": text, + "class": "custom-" + player.props.player_name, + "alt": player.props.player_name} + + sys.stdout.write(json.dumps(output) + "\n") + sys.stdout.flush() + + def clear_output(self): + sys.stdout.write("\n") + sys.stdout.flush() + + def on_playback_status_changed(self, player, status, _=None): + logger.debug(f"Playback status changed for player {player.props.player_name}: {status}") + self.on_metadata_changed(player, player.props.metadata) + + def get_first_playing_player(self): + players = self.get_players() + logger.debug(f"Getting first playing player from {len(players)} players") + if len(players) > 0: + # if any are playing, show the first one that is playing + # reverse order, so that the most recently added ones are preferred + for player in players[::-1]: + if player.props.status == "Playing": + return player + # if none are playing, show the first one + return players[0] + else: + logger.debug("No players found") + return None + + def show_most_important_player(self): + logger.debug("Showing most important player") + # show the currently playing player + # or else show the first paused player + # or else show nothing + current_player = self.get_first_playing_player() + if current_player is not None: + self.on_metadata_changed(current_player, current_player.props.metadata) + else: + self.clear_output() + + def on_metadata_changed(self, player, metadata, _=None): + logger.debug(f"Metadata changed for player {player.props.player_name}") + player_name = player.props.player_name + + track_info = "" + if player_name == "spotify" and "mpris:trackid" in metadata.keys() and ":ad:" in player.props.metadata["mpris:trackid"]: + track_info = "Advertisement" + else: + track_info = " " + + if track_info: + if player.props.status == "Playing": + track_info = "▶️" + else: + track_info = "⏸️" + # only print output if no other player is playing + current_playing = self.get_first_playing_player() + if current_playing is None or current_playing.props.player_name == player.props.player_name: + self.write_output(track_info, player) + else: + logger.debug(f"Other player {current_playing.props.player_name} is playing, skipping") + + def on_player_appeared(self, _, player): + logger.info(f"Player has appeared: {player.name}") + if player is not None and (self.selected_player is None or player.name == self.selected_player): + self.init_player(player) + else: + logger.debug( + "New player appeared, but it's not the selected player, skipping") + + def on_player_vanished(self, _, player): + logger.info(f"Player {player.props.player_name} has vanished") + self.show_most_important_player() + +def parse_arguments(): + parser = argparse.ArgumentParser() + + # Increase verbosity with every occurrence of -v + parser.add_argument("-v", "--verbose", action="count", default=0) + + # Define for which player we"re listening + parser.add_argument("--player") + + parser.add_argument("--enable-logging", action="store_true") + + return parser.parse_args() + + +def main(): + arguments = parse_arguments() + + # Initialize logging + if arguments.enable_logging: + logfile = os.path.join(os.path.dirname( + os.path.realpath(__file__)), "media-player.log") + logging.basicConfig(filename=logfile, level=logging.DEBUG, + format="%(asctime)s %(name)s %(levelname)s:%(lineno)d %(message)s") + + # Logging is set by default to WARN and higher. + # With every occurrence of -v it's lowered by one + logger.setLevel(max((3 - arguments.verbose) * 10, 0)) + + logger.info("Creating player manager") + if arguments.player: + logger.info(f"Filtering for player: {arguments.player}") + player = PlayerManager(arguments.player) + player.run() + + +if __name__ == "__main__": + main() diff --git a/waybar/startup.sh b/waybar/startup.sh new file mode 100755 index 0000000..3c4ed19 --- /dev/null +++ b/waybar/startup.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env zsh + +# check if waybar is already running +pkill waybar + +# start waybar +waybar \ + -c ~/.dotfiles/waybar/waybar.conf \ + -s ~/.dotfiles/waybar/style.css \ + & diff --git a/waybar/style.css b/waybar/style.css new file mode 100644 index 0000000..b0c3f81 --- /dev/null +++ b/waybar/style.css @@ -0,0 +1,89 @@ +* { + border: 3px; + border-radius: 10px; + font-family: Ubuntu, Light; + font-weight: normal; + font-size: 17px; + min-height: 0; +} + +window#waybar { + background: rgba(21, 18, 27, 0); + color: #cdd6f4; +} + +tooltip { + background: rgba(12, 12, 12, 0.9); + border-radius: 10px; + border-width: 2px; + border-style: solid; + border-color: #4771c9; +} + +#battery, +#backlight, +#clock, +#cpu, +#memory, +#network, +#pulseaudio, +#workspaces, +#custom-wireguard, +#tray, +#window { + background: rgba(12, 12, 12, 0.4); + padding: 0px 10px; + margin: 5px 5px; + margin-top: 10px; + margin-bottom: 0px; + border: 2px solid #595959; +} + +#backlight { + color: #89b4fa; +} + +#battery { + color: #a6e3a1; +} + +#clock { + color: #fab387; + border: 2px solid #4771c9; +} + +#cpu { + color: #a6e3a1; +} + +#custom-wireguard { + color: #89b4fa; +} + +#custom-spotify { + padding: 5px 5px; + margin-top: 10px; +} + +#memory { + color: #a6e3a1; +} + +#network { + color: #89b4fa; +} + +#pulseaudio { + color: #89b4fa; + margin-right: 10px; +} + +#workspaces{ + color: #89b4fa; + margin-left: 10px; + padding: 0px 0px; +} + +#workspaces button.active { + color: #89b4fa; +} diff --git a/waybar/waybar.conf b/waybar/waybar.conf new file mode 100644 index 0000000..c350ad4 --- /dev/null +++ b/waybar/waybar.conf @@ -0,0 +1,156 @@ +{ + + // generic + "exclusive": true, + "gtk-layer-shell": true, + "height": 0, + "layer": "top", + "mod": "dock", + "passthrough": false, + "position": "top", + + // modules location + "modules-left": [ + "hyprland/workspaces", + "hyprland/window", + ], + + "modules-center": [ + "clock" + ], + + "modules-right": [ + "custom/spotify", + "tray", + "cpu", + "memory", + "network", + "custom/wireguard", + "battery", + "backlight", + "pulseaudio", + ], + + // modules + "backlight": { + "device": "intel_backlight", + "format": "{icon} {percent}%", + "format-icons": [ + "🔅", + "🔆", + "☀️" + ], + "max-length": 7, + "min-length": 7, + "on-scroll-up": "brightnessctl set 5%+", + "on-scroll-down": "brightnessctl set 5%-" + }, + + "battery": { + "states": { + "good": 75, + "warning": 50, + "critical": 15 + }, + "format": "{icon} {capacity}%", + "format-icons": [ + "🪫", + "🪫", + "🪫", + "🔋", + "🔋" + ], + "max-length": 7, + "min-length": 7 + }, + + "clock": { + "format": "{:🕒 %R 🗓️ %d-%m}", + "timezones": ["Europe/Amsterdam", "Asia/Kolkata"], + "actions": { "on-click": "tz_down" }, + "tooltip-format": "{calendar}" + }, + + "cpu": { + "interval": 5, + "max-length": 6, + "min-length": 6, + "format": "🧠 {usage:2}%" + }, + + "custom/wireguard": { + "interval": 2, + "format": "{}", + "exec": "$HOME/.dotfiles/wireguard/wireguard.sh status", + "on-click": "$HOME/.dotfiles/wireguard/wireguard.sh switch" + }, + + "custom/spotify": { + "exec": "/usr/bin/python3 $HOME/.dotfiles/waybar/spotify.py --player spotify", + "format": "{}", + "return-type": "json", + "max-length": 3, + "min-length": 3, + "on-click": "playerctl play-pause" + }, + + "hyprland/window": { + "format": "{}" + }, + + "hyprland/workspaces": { + "all-outputs": true, + "sort-by-number": true, + "format": "{icon}", + "format-icons": { + "1": "1", + "2": "2", + "3": "3", + "4": "4", + "5": "5", + "6": "6", + "7": "7", + "8": "8", + "9": "9", + "10": "10" + } + }, + + "memory": { + "interval": 5, + "format": "🐏 {}%", + "max-length": 6, + "min-length": 6, + "tooltip-format": "{used:0.1f}GB / {total:0.1f}GB", + }, + + "network": { + "tooltip": true, + "format-wifi": "📡 {ipaddr}/{cidr}", + "format-ethernet": "🌐 {ipaddr}/{cidr}", + "tooltip-format-wifi": "SSID: {essid}\nSignal Strength: {signalStrength}%\nIP: {ipaddr}\nNetmask: {netmask} (/{cidr})\nGateway: {gwaddr}", + "tooltip-format-ethernet": "IP: {ipaddr}\nNetmask: {netmask} (/{cidr})\nGateway: {gwaddr}", + "on-click": "alacritty --class nmtui --command ~/.dotfiles/hyprland/nmtui.sh" + }, + + "pulseaudio": { + "format": "{icon} {volume:2}%", + "format-muted": "🔇", + "format-icons": { + "headphones": "🎧", + "default": [ + "🔉", + "🔊" + ] + }, + "scroll-step": 5, + "max-length": 8, + "min-length": 8, + "on-click": "pavucontrol" + }, + + "tray": { + "icon-size": 13, + "spacing": 10 + } +} diff --git a/wireguard/wireguard.sh b/wireguard/wireguard.sh new file mode 100755 index 0000000..baa2524 --- /dev/null +++ b/wireguard/wireguard.sh @@ -0,0 +1,50 @@ +#!/usr/bin/env zsh + +# variables +hostname_short=$(/usr/bin/hostname --short) +tailscale_bin="tailscale" +tailscale_status=$("$tailscale_bin" status) + +# status vpn +status_vpn () { + vpn_status="" + + # check for tailscale status + if echo "$tailscale_status" | grep "$hostname_short" &> /dev/null; then + vpn_status+='🔒 ' + else + vpn_status+='🛡️ ' + fi + + # check for direct connectivity + if "$tailscale_bin" status | grep allegro | grep direct &> /dev/null; then + vpn_status+='✅' + else + vpn_status+='❌' + fi + + echo "$vpn_status" +} + +# switch vpn +switch_vpn () { + if echo "$tailscale_status" | grep "$hostname_short" &> /dev/null; then + "$tailscale_bin" down + else + "$tailscale_bin" up + fi +} + +# main function +case $1 in + switch) + switch_vpn &> /dev/null + ;; + status) + status_vpn + ;; + *) + echo "Usage: $0 {switch|status}" + exit 1 + ;; +esac diff --git a/wofi/style.css b/wofi/style.css new file mode 100644 index 0000000..560ae36 --- /dev/null +++ b/wofi/style.css @@ -0,0 +1,51 @@ +@define-color base #222222 ; +@define-color blue_border #528bff ; +@define-color selected_color #444444 ; +@define-color font_color #b6c0cd ; + +*{ + font-family: "Ubuntu, Light"; + font-size: 16px; +} + +window { + border: 0px solid @blue_border; + border-radius: 16px; +} + +#input { + border: none; + border-radius: 5px; + color: @font_color; + margin-bottom: 15px; + padding:3px; +} + +#inner-box { + background-color: @base; + box-shadow: -4px -3px 45px 21px rgba(0,0,0,0.35); +} + +#outer-box { + background-color: @base; + border-radius: 15px; + margin: 5px; + padding: 10px; +} + +#text { + color: @font_color; + padding: 5px; +} + +#entry { + padding: 10px; +} + +#entry:nth-child(even) { + background-color: @base; +} + +#entry:selected { + background-color: @selected_color; +} diff --git a/wofi/wofi.sh b/wofi/wofi.sh new file mode 100755 index 0000000..346dd49 --- /dev/null +++ b/wofi/wofi.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env zsh + +# check if wofi is already running +pkill wofi + +# start wofi +wofi \ + --show drun \ + --no-action \ + --width=600 \ + --height=600 \ + --normal-window \ + --allow-images \ + --prompt="Applications ..." \ + --style=/home/simon/.dotfiles/wofi/style.css diff --git a/zsh/.zshrc b/zsh/.zshrc new file mode 100644 index 0000000..46e4643 --- /dev/null +++ b/zsh/.zshrc @@ -0,0 +1,84 @@ +# zsh +export ZSH=/home/simon/.oh-my-zsh +ZSH_THEME="bira" +plugins=(git) +source $ZSH/oh-my-zsh.sh + +# autocomplete +[[ $commands[kubectl] ]] && source <(kubectl completion zsh) + +# generic +alias cat="bat" +alias ccat="/usr/bin/cat" + +# hyperland +alias tata="hyprctl dispatch exit" + +# git +alias gfo="git fetch origin" +alias gmo="git merge origin/master" +alias gpo="git push origin" +alias gfu="git fetch upstream" +alias gmu="git merge upstream/master" + +# teleport +alias tlogin="tsh login --proxy=tele.simoncor.net --user=siempie" +alias tssh="tsh ssh" + +# fedora update +alias fupdate="sudo dnf update -y && sudo flatpak update -y && sudo fwupdmgr refresh --force && sudo fwupdmgr update" + +# wireguard +alias wg-start="nmcli connection up wg0" +alias wg-stop="nmcli connection down wg0" +alias wg-status="nmcli --overview connection show wg0" + +# manage sshfs mounts +# media +alias sj-mount-media="sshfs nas.siempie.local:/tank/media/ /home/simon/remotedir/media" +alias umount-media="sudo umount /home/simon/remotedir/media" + +# siempie +alias sj-mount-siempie="sshfs nas.siempie.local:/tank/siempie/ /home/simon/remotedir/siempie" +alias umount-siempie="sudo umount /home/simon/remotedir/siempie" + + +# manage screen tunnels +# siempie +alias start-siempie-tunnel="screen -S siempie-tunnel -d -m ssh -N -D 9001 siempie.com" +alias stop-siempie-tunnel="screen -S siempie-tunnel -p 0 -X quit" + +# it creation +alias start-itc-jump="screen -S jumphost-itc -d -m ssh -N -D 9002 jumphost-itc" +alias stop-itc-jump="screen -S jumphost-itc -p 0 -X quit" + +# multipost +alias start-mp-tunnel="screen -S multipost-tunnel -d -m ssh -N -D 9003 mp-centurion" +alias stop-mp-tunnel="screen -S multipost-tunnel -p 0 -X quit" + +# duijvelaar-pompen +alias start-dp-tunnel="screen -S dp-tunnel -d -m ssh -N -D 9004 dp-fw-01" +alias stop-dp-tunnel="screen -S dp-tunnel -p 0 -X quit" + +# pharmeon +alias start-pharmeon-tunnel="screen -S pharmeon-tunnel -d -m ssh -N -D 9005 jumphost-ph" +alias stop-pharmeon-tunnel="screen -S pharmeon-tunnel -p 0 -X quit" + + +# force language +export LC_ALL="en_US.UTF-8" + + +# weather +function weather() { + if [ "$1" != "" ] + then + curl https://wttr.in/$1 + else + curl https://wttr.in/Krimpen_Aan_Den_IJssel + fi +} + +# k9s +alias k9s="ssh k9s.siempie.internal -t /home/simon/.local/bin/k9s" +[ -s "$HOME/.config/envman/load.sh" ] && source "$HOME/.config/envman/load.sh"