From 1ed767509547214c1cefde8c6d4d09a6695be02e Mon Sep 17 00:00:00 2001 From: Hadi <112569860+anotherhadi@users.noreply.github.com> Date: Wed, 26 Jun 2024 14:44:08 +0000 Subject: [PATCH] update --- .sops.yaml | 4 +- README.md | 7 +- docs/TODO.md | 1 + ..._guest_config.sh => copie_guest_config.sh} | 2 +- docs/scripts/create_readme.sh | 2 +- docs/scripts/get_keybindings.sh | 21 ------ docs/scripts/keybindings_to_markdown.sh | 54 ++++++++++++++ docs/src/README_template.md | 7 +- home/programs/{shell => }/fetch/default.nix | 0 .../{shell => }/fetch/neofetch/default.nix | 0 .../{shell => }/fetch/nerdfetch/default.nix | 0 home/programs/{shell => }/lf/config/colors | 0 home/programs/{shell => }/lf/config/icons | 0 home/programs/{shell => }/lf/default.nix | 0 home/programs/shell/default.nix | 2 - home/system/hyprland/default.nix | 71 ++++++++++--------- hosts/guest/home.nix | 4 +- hosts/laptop/home.nix | 4 +- .../laptop/{sops.nix => secrets/default.nix} | 2 +- {secrets => hosts/laptop/secrets}/laptop.yaml | 0 hosts/server/configuration.nix | 3 +- .../internal/sops.nix => secrets/default.nix} | 2 +- {secrets => hosts/server/secrets}/server.yaml | 0 23 files changed, 115 insertions(+), 71 deletions(-) rename docs/scripts/{create_guest_config.sh => copie_guest_config.sh} (95%) delete mode 100644 docs/scripts/get_keybindings.sh create mode 100644 docs/scripts/keybindings_to_markdown.sh rename home/programs/{shell => }/fetch/default.nix (100%) rename home/programs/{shell => }/fetch/neofetch/default.nix (100%) rename home/programs/{shell => }/fetch/nerdfetch/default.nix (100%) rename home/programs/{shell => }/lf/config/colors (100%) rename home/programs/{shell => }/lf/config/icons (100%) rename home/programs/{shell => }/lf/default.nix (100%) rename hosts/laptop/{sops.nix => secrets/default.nix} (91%) rename {secrets => hosts/laptop/secrets}/laptop.yaml (100%) rename hosts/server/{modules/internal/sops.nix => secrets/default.nix} (93%) rename {secrets => hosts/server/secrets}/server.yaml (100%) diff --git a/.sops.yaml b/.sops.yaml index d9fb033..2db2699 100644 --- a/.sops.yaml +++ b/.sops.yaml @@ -1,11 +1,11 @@ keys: - &primary age12yvtj49pfh3fqzqflscm0ek4yzrjhr6cqhn7x89gdxnlykq0xudq5c7334 creation_rules: - - path_regex: secrets/laptop.yaml$ + - path_regex: hosts/laptop/secrets/laptop.yaml$ key_groups: - age: - *primary - - path_regex: secrets/server.yaml$ + - path_regex: hosts/server/secrets/server.yaml$ key_groups: - age: - *primary diff --git a/README.md b/README.md index a93c7ab..ae0a03e 100644 --- a/README.md +++ b/README.md @@ -51,14 +51,17 @@ It's a simple way to manage your system configuration and dotfiles. ## Architecture -- 🏠 `home` are the dotfiles and configuration files for the user +- 🏠 `home` are the dotfiles and configuration files for the users + - 'programs' is a collection of apps configured with home-manager + - 'scripts' is a folder full of bash scripts (see [SCRIPTS.md](docs/SCRIPTS.md)) + - 'system' is some desktop environment like configuration + - 'wallpapers' are... wallpapers - 💻 `hosts` are the system configuration files - 'laptop' is my configuration for my laptop with Nvidia - 'server' is for my homeserver (w/nextcloud, nginx, vaultwarden, ... look `hosts/server`) - 'guest' is a *template* that you can copy and modify for *your own system* - 'themes' contains all the *themes* available *(see [THEMES.md](docs/THEMES.md))* - 'modules' are some nix modules that you can import (Nvidia, prime, fonts, ...) -- 🤫 `secrets` are the secrets files encrypted with sops-nix ## Installation diff --git a/docs/TODO.md b/docs/TODO.md index 0ab8e0d..4311fec 100644 --- a/docs/TODO.md +++ b/docs/TODO.md @@ -10,6 +10,7 @@ feel free to contribute <3 ([CONTRIBUTING.md](CONTRIBUTING.md)) - [ ] MacOS theme - [ ] Write a hyprland shortcuts markdown file (Parse the hyprland settings conf) - [ ] Tofi (Wofi but terminal based) + - [ ] add golang bin dir to path - [ ] Waybar - [ ] Caffeine status diff --git a/docs/scripts/create_guest_config.sh b/docs/scripts/copie_guest_config.sh similarity index 95% rename from docs/scripts/create_guest_config.sh rename to docs/scripts/copie_guest_config.sh index 2f6835c..e4eca42 100644 --- a/docs/scripts/create_guest_config.sh +++ b/docs/scripts/copie_guest_config.sh @@ -26,5 +26,5 @@ variables=$(echo "$variables" | sed 's/tailscale = true/tailscale = false/') echo "$variables" >"$GUEST_CONFIG/variables.nix" home=$(cat "$LAPTOP_CONFIG/home.nix") -home=$(echo "$home" | sed 's/\.\/sops.nix/# .\/sops.nix/') +home=$(echo "$home" | sed 's/\.\/secrets/# .\/secrets/') echo "$home" >"$GUEST_CONFIG/home.nix" diff --git a/docs/scripts/create_readme.sh b/docs/scripts/create_readme.sh index b09305e..7704b5f 100644 --- a/docs/scripts/create_readme.sh +++ b/docs/scripts/create_readme.sh @@ -7,7 +7,7 @@ README_FILE="./README.md" header=$(cat "./docs/src/header.md") -table_of_content=$(~/go/bin/md-table-of-contents ./docs/src/README_template.md) +table_of_content=$(md-table-of-contents ./docs/src/README_template.md) version=$(git describe --tags --abbrev=0) readme_content=$(cat "./docs/src/README_template.md") diff --git a/docs/scripts/get_keybindings.sh b/docs/scripts/get_keybindings.sh deleted file mode 100644 index d7db4b9..0000000 --- a/docs/scripts/get_keybindings.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env bash - -[[ -f "./home/system/hyprland/default.nix" ]] || (echo "File ./home/system/hyprland/default.nix not found" && exit 1) - -config=$( cat "./home/system/hyprland/default.nix") - -# get text between -# bind = [ -# and next ] - -# Example: -# "$mod, E, exec, ${pkgs.xfce.thunar}/bin/thunar" # Description -# Steps: -# We should remove the "" -# $mod replace by Super key -# $shiftMod replace by "Super Shift" -# Concat with key -# Remove , exec, -# Remove variables and /bin/ if present - -# Create a markdown table with everything \ No newline at end of file diff --git a/docs/scripts/keybindings_to_markdown.sh b/docs/scripts/keybindings_to_markdown.sh new file mode 100644 index 0000000..c3e3100 --- /dev/null +++ b/docs/scripts/keybindings_to_markdown.sh @@ -0,0 +1,54 @@ +#!/usr/bin/env bash + +function getList(){ + content=$1 + name=$2 + list_start=$(echo "$content" | sed "/$name = \[/!d;=;Q") + list=$(echo "$content" | tail +$list_start) + list_end=$(echo "$list" | sed '/\]/!d;=;Q') + list=$(echo "$list" | head -n$list_end) + + echo "$list" +} + +[[ -f "./home/system/hyprland/default.nix" ]] || (echo "File ./home/system/hyprland/default.nix not found" && exit 1) + +config=$( cat "./home/system/hyprland/default.nix") + +# Bind +bind=$(getList "$config" "bind") +echo "$bind" + +# Bindm (mouse) +bindm=$(getList "$config" "bindm") +echo "$bindm" + +# Bindl (lock) +bindl=$(getList "$config" "bindl") +echo "$bindl" + +# Bindle (lock, repetition) +bindle=$(getList "$config" "bindle") +echo "$bindle" + +# Join the lists: +# ... + +# Remove lines not containing a " +# ... + +# Parse the keybindings: +# Example: "mod, key, dispatcher, params" # Description +# 1. Get the description/remove it +# 2. Remove the quotes +# 3. Get mod /remove it (replace $mod and $shiftmod by SUPER and SUPER_SHIFT) +# 4. Get key /remove it +# 5. Get dispatcher /remove it +# 6. Get params + +# Manually add workspace shortcuts + +# Markdown table: +# | Description | keybinding | params | +# | -- | -- | -- | +# ... diff --git a/docs/src/README_template.md b/docs/src/README_template.md index 64fe85a..835bcd2 100644 --- a/docs/src/README_template.md +++ b/docs/src/README_template.md @@ -14,14 +14,17 @@ It's a simple way to manage your system configuration and dotfiles. ## Architecture -- 🏠 `home` are the dotfiles and configuration files for the user +- 🏠 `home` are the dotfiles and configuration files for the users + - 'programs' is a collection of apps configured with home-manager + - 'scripts' is a folder full of bash scripts (see [SCRIPTS.md](docs/SCRIPTS.md)) + - 'system' is some desktop environment like configuration + - 'wallpapers' are... wallpapers - 💻 `hosts` are the system configuration files - 'laptop' is my configuration for my laptop with Nvidia - 'server' is for my homeserver (w/nextcloud, nginx, vaultwarden, ... look `hosts/server`) - 'guest' is a *template* that you can copy and modify for *your own system* - 'themes' contains all the *themes* available *(see [THEMES.md](docs/THEMES.md))* - 'modules' are some nix modules that you can import (Nvidia, prime, fonts, ...) -- 🤫 `secrets` are the secrets files encrypted with sops-nix ## Installation diff --git a/home/programs/shell/fetch/default.nix b/home/programs/fetch/default.nix similarity index 100% rename from home/programs/shell/fetch/default.nix rename to home/programs/fetch/default.nix diff --git a/home/programs/shell/fetch/neofetch/default.nix b/home/programs/fetch/neofetch/default.nix similarity index 100% rename from home/programs/shell/fetch/neofetch/default.nix rename to home/programs/fetch/neofetch/default.nix diff --git a/home/programs/shell/fetch/nerdfetch/default.nix b/home/programs/fetch/nerdfetch/default.nix similarity index 100% rename from home/programs/shell/fetch/nerdfetch/default.nix rename to home/programs/fetch/nerdfetch/default.nix diff --git a/home/programs/shell/lf/config/colors b/home/programs/lf/config/colors similarity index 100% rename from home/programs/shell/lf/config/colors rename to home/programs/lf/config/colors diff --git a/home/programs/shell/lf/config/icons b/home/programs/lf/config/icons similarity index 100% rename from home/programs/shell/lf/config/icons rename to home/programs/lf/config/icons diff --git a/home/programs/shell/lf/default.nix b/home/programs/lf/default.nix similarity index 100% rename from home/programs/shell/lf/default.nix rename to home/programs/lf/default.nix diff --git a/home/programs/shell/default.nix b/home/programs/shell/default.nix index 1263841..75a4b08 100644 --- a/home/programs/shell/default.nix +++ b/home/programs/shell/default.nix @@ -7,7 +7,5 @@ ./tmux.nix ./lazygit.nix ./eza.nix - ./fetch - ./lf ]; } diff --git a/home/system/hyprland/default.nix b/home/system/hyprland/default.nix index d986b10..6be2951 100644 --- a/home/system/hyprland/default.nix +++ b/home/system/hyprland/default.nix @@ -50,34 +50,32 @@ ]; bind = [ - "$mod, RETURN, exec, ${pkgs.kitty}/bin/kitty" - "$mod, E, exec, ${pkgs.xfce.thunar}/bin/thunar" - "$mod, B, exec, ${pkgs.qutebrowser}/bin/qutebrowser" - "$mod, K, exec, ${pkgs.bitwarden}/bin/bitwarden" - "$mod, C, exec, ${pkgs.kitty}/bin/kitty --class peaclock peaclock" - "$mod, L, exec, ${pkgs.hyprlock}/bin/hyprlock" - "$mod, X, exec, powermenu" - "$mod, SPACE, exec, menu" - # Windows control - "$mod, Q, killactive," - "$mod, T, togglefloating," - "$mod, F, fullscreen" - "$mod, left, movefocus, l" - "$mod, right, movefocus, r" - "$mod, up, movefocus, u" - "$mod, down, movefocus, d" - # Screenshots - "$mod, PRINT, exec, screenshot window" - ", PRINT, exec, screenshot monitor" - "$shiftMod, PRINT, exec, screenshot region" - "ALT, PRINT, exec, screenshot region swappy" - # Night Shift - "$mod, F2, exec, night-shift-off" - "$mod, F3, exec, night-shift-on" - # Sound output - "$mod, F5, exec, ${pkgs.kitty}/bin/kitty --class floating zsh -c sound-output" - "$mod, F6, exec, ${pkgs.kitty}/bin/kitty --class floating zsh -c sound-output" - "$mod, F7, exec, ${pkgs.kitty}/bin/kitty --class floating zsh -c sound-output" + "$mod, RETURN, exec, ${pkgs.kitty}/bin/kitty" # Kitty + "$mod, E, exec, ${pkgs.xfce.thunar}/bin/thunar" # Thunar + "$mod, B, exec, ${pkgs.qutebrowser}/bin/qutebrowser" # Qutebrowser + "$mod, K, exec, ${pkgs.bitwarden}/bin/bitwarden" # Bitwarden + "$mod, C, exec, ${pkgs.kitty}/bin/kitty --class peaclock peaclock" # Peaclock + "$mod, L, exec, ${pkgs.hyprlock}/bin/hyprlock" # Lock + "$mod, X, exec, powermenu" # Powermenu + "$mod, SPACE, exec, menu" # Launcher + + "$mod, Q, killactive," # Close window + "$mod, T, togglefloating," # Toggle Floating + "$mod, F, fullscreen" # Toggle Fullscreen + "$mod, left, movefocus, l" # Move focus left + "$mod, right, movefocus, r" # Move focus Right + "$mod, up, movefocus, u" # Move focus Up + "$mod, down, movefocus, d" # Move focus Down + + "$mod, PRINT, exec, screenshot window" # Screenshot window + ", PRINT, exec, screenshot monitor" # Screenshot monitor + "$shiftMod, PRINT, exec, screenshot region" # Screenshot region + "ALT, PRINT, exec, screenshot region swappy" # Screenshot region then edit + + "$mod, F2, exec, night-shift-off" # Turn off night shift + "$mod, F3, exec, night-shift-on" # Turn on night shift + + "$mod, F5, exec, ${pkgs.kitty}/bin/kitty --class floating zsh -c sound-output" # Choose sound output ] ++ (builtins.concatLists (builtins.genList (i: let ws = i + 1; in [ @@ -85,18 +83,21 @@ "$mod SHIFT, code:1${toString i}, movetoworkspace, ${toString ws}" ]) 9)); - bindm = [ "$mod, mouse:272, movewindow" "$mod, R, resizewindow" ]; + bindm = [ + "$mod, mouse:272, movewindow" # Move Window (mouse) + "$mod, R, resizewindow" # Resize Window (mouse) + ]; bindl = [ - ",XF86AudioMute, exec, sound-toggle" - ",switch:Lid Switch, exec, ${pkgs.hyprlock}/bin/hyprlock" + ",XF86AudioMute, exec, sound-toggle" # Toggle Mute + ",switch:Lid Switch, exec, ${pkgs.hyprlock}/bin/hyprlock" # Lock when closing Lid ]; bindle = [ - ", XF86AudioRaiseVolume, exec, sound-up" - ", XF86AudioLowerVolume, exec, sound-down" - ", XF86MonBrightnessUp, exec, brightness-up" - ", XF86MonBrightnessDown, exec, brightness-down" + ", XF86AudioRaiseVolume, exec, sound-up" # Sound Up + ", XF86AudioLowerVolume, exec, sound-down" # Sound Down + ", XF86MonBrightnessUp, exec, brightness-up" # Brightness Up + ", XF86MonBrightnessDown, exec, brightness-down" # Brightness Down ]; env = [ diff --git a/hosts/guest/home.nix b/hosts/guest/home.nix index c96eb64..1bc4658 100644 --- a/hosts/guest/home.nix +++ b/hosts/guest/home.nix @@ -13,6 +13,8 @@ ../../home/programs/spicetify ../../home/programs/zathura ../../home/programs/shell + ../../home/programs/fetch + ../../home/programs/lf ../../home/programs/git # Scripts @@ -28,7 +30,7 @@ ../../home/system/mime ../../home/system/udiskie - # ./sops.nix # You should probably remove this line + # ./secrets # You should probably remove this line ]; home = { diff --git a/hosts/laptop/home.nix b/hosts/laptop/home.nix index 393b140..9fd8306 100644 --- a/hosts/laptop/home.nix +++ b/hosts/laptop/home.nix @@ -13,6 +13,8 @@ ../../home/programs/spicetify ../../home/programs/zathura ../../home/programs/shell + ../../home/programs/fetch + ../../home/programs/lf ../../home/programs/git # Scripts @@ -28,7 +30,7 @@ ../../home/system/mime ../../home/system/udiskie - ./sops.nix # You should probably remove this line + ./secrets # You should probably remove this line ]; home = { diff --git a/hosts/laptop/sops.nix b/hosts/laptop/secrets/default.nix similarity index 91% rename from hosts/laptop/sops.nix rename to hosts/laptop/secrets/default.nix index caf869d..0a80d8c 100644 --- a/hosts/laptop/sops.nix +++ b/hosts/laptop/secrets/default.nix @@ -5,7 +5,7 @@ sops = { age.keyFile = "/home/hadi/.config/sops/age/keys.txt"; - defaultSopsFile = ../../secrets/laptop.yaml; + defaultSopsFile = ./laptop.yaml; secrets = { sshconfig = { path = "/home/hadi/.ssh/config"; }; github-key = { path = "/home/hadi/.ssh/github"; }; diff --git a/secrets/laptop.yaml b/hosts/laptop/secrets/laptop.yaml similarity index 100% rename from secrets/laptop.yaml rename to hosts/laptop/secrets/laptop.yaml diff --git a/hosts/server/configuration.nix b/hosts/server/configuration.nix index cd148c6..c604f61 100644 --- a/hosts/server/configuration.nix +++ b/hosts/server/configuration.nix @@ -6,7 +6,6 @@ # internal ./modules/internal/security.nix ./modules/internal/openssh.nix - ./modules/internal/sops.nix ./modules/internal/adguard.nix # ./modules/internal/unifi.nix # FIXME: unifi5 is deprecated @@ -23,6 +22,8 @@ # jackflix ./modules/jackflix + + ./secrets ]; # Bootloader. diff --git a/hosts/server/modules/internal/sops.nix b/hosts/server/secrets/default.nix similarity index 93% rename from hosts/server/modules/internal/sops.nix rename to hosts/server/secrets/default.nix index ea0fb90..e75fb5f 100644 --- a/hosts/server/modules/internal/sops.nix +++ b/hosts/server/secrets/default.nix @@ -2,7 +2,7 @@ sops = { age.keyFile = "/home/hadi/.config/sops/age/keys.txt"; - defaultSopsFile = ../../../../secrets/server.yaml; + defaultSopsFile = ./server.yaml; defaultSopsFormat = "yaml"; secrets = { sshconfig = { diff --git a/secrets/server.yaml b/hosts/server/secrets/server.yaml similarity index 100% rename from secrets/server.yaml rename to hosts/server/secrets/server.yaml