diff --git a/README.md b/README.md index f168a5b..9bc7eda 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ [//]: # (Title: Nixy) [//]: # (Description: Nixy is a Hyprland NixOS configuration with home-manager, secrets and custom theming all in one place. It's a simple way to manage your system configuration and dotfiles.) [//]: # (Author: Hadi) -[//]: # (Date: 08/18/24) -[//]: # (Version: v2.0.1) +[//]: # (Date: 08/19/24) +[//]: # (Version: v2.1.0)
@@ -15,7 +15,7 @@
- + @@ -54,7 +54,7 @@ It's a simple way to manage your system configuration and dotfiles. - šŸ  `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 + - 'system' is some "desktop environment" configuration - 'wallpapers' are... wallpapers - šŸ’» `hosts` are the system configuration files - 'laptop' is my configuration for my laptop with Nvidia that you can copy diff --git a/docs/KEYBINDINGS.md b/docs/KEYBINDINGS.md index f303520..32a3ba4 100644 --- a/docs/KEYBINDINGS.md +++ b/docs/KEYBINDINGS.md @@ -2,37 +2,37 @@ The list of the keybindings working on Hyprland: -| Description | Keybinding | Command | -| --------------------------- | ---------------------- | ------------------------------------------------------------------ | -| Switch Workspace | SUPER + {Number} | workspace {Number} | -| Move app to Workspace | SUPER SHIFT + {Number} | movetoworkspace {Number} | -| Kitty | SUPER + RETURN | exec \${pkgs.kitty}/bin/kitty | -| Thunar | SUPER + E | exec \${pkgs.xfce.thunar}/bin/thunar | -| Qutebrowser | SUPER + B | exec \${pkgs.qutebrowser}/bin/qutebrowser | -| Bitwarden | SUPER + K | exec \${pkgs.bitwarden}/bin/bitwarden | -| Peaclock | SUPER + C | exec \${pkgs.kitty}/bin/kitty --class peaclock peaclock | -| Lock | SUPER + L | exec \${pkgs.hyprlock}/bin/hyprlock | -| Powermenu | SUPER + X | exec powermenu | -| Launcher | SUPER + SPACE | exec menu | -| Close window | SUPER + Q | killactive | -| Toggle Floating | SUPER + T | togglefloating | -| Toggle Fullscreen | SUPER + F | fullscreen | -| Move focus left | SUPER + left | movefocus l | -| Move focus Right | SUPER + right | movefocus r | -| Move focus Up | SUPER + up | movefocus u | -| Move focus Down | SUPER + down | movefocus d | -| Screenshot window | SUPER + PRINT | exec screenshot window | -| Screenshot monitor | PRINT | exec screenshot monitor | -| Screenshot region | SUPER SHIFT + PRINT | exec screenshot region | -| Screenshot region then edit | ALT PRINT | exec screenshot region swappy | -| Turn off night shift | SUPER + F2 | exec night-shift-off | -| Turn on night shift | SUPER + F3 | exec night-shift-on | -| Choose sound output | SUPER + F5 | exec \${pkgs.kitty}/bin/kitty --class floating zsh -c sound-output | -| Move Window (mouse) | SUPER + mouse:272 | movewindow | -| Resize Window (mouse) | SUPER + R | resizewindow | -| Toggle Mute | XF86AudioMute | exec sound-toggle | -| Lock when closing Lid | switch:Lid Switch | exec \${pkgs.hyprlock}/bin/hyprlock | -| Sound Up | XF86AudioRaiseVolume | exec sound-up | -| Sound Down | XF86AudioLowerVolume | exec sound-down | -| Brightness Up | XF86MonBrightnessUp | exec brightness-up | -| Brightness Down | XF86MonBrightnessDown | exec brightness-down | +| Description | Keybinding | +|-----------------------------|--------------------------| +| Switch Workspace | SUPER + {Number} | +| Move app to Workspace | SHIFT + SUPER + {Number} | +| Kitty | SUPER + RETURN | +| Thunar | SUPER + E | +| Qutebrowser | SUPER + B | +| Bitwarden | SUPER + K | +| Peaclock | SUPER + C | +| Lock | SUPER + L | +| Powermenu | SUPER + X | +| Launcher | SUPER + SPACE | +| Close window | SUPER + Q | +| Toggle Floating | SUPER + T | +| Toggle Fullscreen | SUPER + F | +| Move focus left | SUPER + left | +| Move focus Right | SUPER + right | +| Move focus Up | SUPER + up | +| Move focus Down | SUPER + down | +| Screenshot window | SUPER + PRINT | +| Screenshot monitor | PRINT | +| Screenshot region | SHIFT + SUPER + PRINT | +| Screenshot region then edit | ALT PRINT | +| Turn off night shift | SUPER + F2 | +| Turn on night shift | SUPER + F3 | +| Choose sound output | SUPER + F5 | +| Move Window (mouse) | SUPER + mouse:272 | +| Resize Window (mouse) | SUPER + R | +| Toggle Mute | XF86AudioMute | +| Lock when closing Lid | switch:Lid Switch | +| Sound Up | XF86AudioRaiseVolume | +| Sound Down | XF86AudioLowerVolume | +| Brightness Up | XF86MonBrightnessUp | +| Brightness Down | XF86MonBrightnessDown | diff --git a/docs/TODO.md b/docs/TODO.md index 9a006de..76db7e8 100644 --- a/docs/TODO.md +++ b/docs/TODO.md @@ -10,21 +10,25 @@ feel free to contribute <3 ([CONTRIBUTING.md](CONTRIBUTING.md)) - [ ] Hyprland - [ ] Implement Hyprcursor - - [ ] Animations based on app name - - [ ] Wofi: popin - - [ ] Wlogout: fade in - - [ ] Fix screenshots (screenshot region's border shows up in the screenshot) + echo "Compresing png files..." + - [ ] wofi: popin + - [ ] wlogout: fade in + - [ ] Fix screenshots (screenshot region's border shows up in the screenshot, hyprshot jq error?) - [ ] Hyprlock themes + - [ ] Hypridle fix: suspend not working? - [ ] Nixvim - [ ] Keymaps: - Trouble - - Tagbar + - Tagbar (actually not working) - [ ] Disable background color for headlines.nvim for titles ## Server +- [ ] Server configuration is actually broken, need to update with the new modules - [ ] Jackflix V2 - Backup Radarr, Prowlarr, Sonarr config -- [ ] Bitcoin-git + - Take a look into buildarr +- [ ] Bitcoin-git: to test - [ ] Ntfy auth file +- [ ] Secrets mode 0444: not secure diff --git a/docs/scripts/new_tag.sh b/docs/scripts/new_tag.sh index 1cde971..d490c0f 100644 --- a/docs/scripts/new_tag.sh +++ b/docs/scripts/new_tag.sh @@ -7,8 +7,12 @@ echo "Current tag: $TAG" read -rp "Enter the new tag name: " NEW_TAG -echo "Compresing png files..." -bash ./docs/scripts/compress_png.sh +read -rp "Do you want to compress the png files? [y/N]: " COMPRESS_PNG +if [[ "$COMPRESS_PNG" == "y" || "$COMPRESS_PNG" == "Y" ]]; then + echo "Compresing png files..." + bash ./docs/scripts/compress_png.sh +fi + echo "Creating wallpapers preview..." bash ./docs/scripts/create_preview_wallpapers.sh echo "Creating README.md..." diff --git a/flake.lock b/flake.lock index 110aa62..d2a153c 100644 --- a/flake.lock +++ b/flake.lock @@ -549,21 +549,6 @@ "type": "github" } }, - "nurpkgs": { - "locked": { - "lastModified": 1724012881, - "narHash": "sha256-lqn4UX+tvtwOmBZ2Dxh6euXKNcXGEYqPolEdjtONDVY=", - "owner": "nix-community", - "repo": "NUR", - "rev": "8c7136cb22fd96cde881225863b450df75876ebc", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "NUR", - "type": "github" - } - }, "nuschtosSearch": { "inputs": { "flake-utils": "flake-utils_2", @@ -606,7 +591,6 @@ "nixos-hardware": "nixos-hardware", "nixpkgs": "nixpkgs_3", "nixvim": "nixvim", - "nurpkgs": "nurpkgs", "sops-nix": "sops-nix", "spicetify-nix": "spicetify-nix" } diff --git a/flake.nix b/flake.nix index 5404990..c985e8a 100644 --- a/flake.nix +++ b/flake.nix @@ -25,7 +25,6 @@ inputs.nixpkgs.follows = "nixpkgs"; }; hyprland.url = "git+https://github.com/hyprwm/Hyprland?submodules=1"; - nurpkgs.url = "github:nix-community/NUR"; # TODO: test to remove nixos-hardware.url = "github:NixOS/nixos-hardware/master"; }; @@ -35,19 +34,10 @@ nixy = nixpkgs.lib.nixosSystem { # CHANGEME system = "x86_64-linux"; modules = [ - ./hosts/laptop/configuration.nix # CHANGEME + { _module.args = { inherit inputs; }; } inputs.nixos-hardware.nixosModules.omen-16-n0280nd # CHANGEME inputs.home-manager.nixosModules.home-manager - { - nixpkgs.overlays = [ inputs.nurpkgs.overlay ]; - _module.args = { inherit inputs; }; - home-manager = { - useGlobalPkgs = true; - useUserPackages = true; - users."hadi" = import ./hosts/laptop/home.nix; # CHANGEME - extraSpecialArgs = { inherit inputs; }; - }; - } + ./hosts/laptop/configuration.nix # CHANGEME ]; }; diff --git a/home/scripts/screenshot/default.nix b/home/scripts/screenshot/default.nix index 86ddaf4..ebd9dbe 100644 --- a/home/scripts/screenshot/default.nix +++ b/home/scripts/screenshot/default.nix @@ -1,7 +1,6 @@ { pkgs, ... }: let - # TODO: Broken - hypshot not working (jq error) screenshot = pkgs.writeShellScriptBin "screenshot" '' if [[ $2 == "swappy" ]];then folder="/tmp" diff --git a/home/system/hyprland/hypridle.nix b/home/system/hyprland/hypridle.nix index e7326fa..8668231 100644 --- a/home/system/hyprland/hypridle.nix +++ b/home/system/hyprland/hypridle.nix @@ -8,7 +8,7 @@ timeout = 600; on-timeout = pkgs.hyprlock + "/bin/hyprlock"; } - # FIXME + # { # timeout = 660; # on-timeout = "systemctl suspend"; diff --git a/hosts/laptop/configuration.nix b/hosts/laptop/configuration.nix index 6d05f27..03c9140 100644 --- a/hosts/laptop/configuration.nix +++ b/hosts/laptop/configuration.nix @@ -1,110 +1,28 @@ -{ pkgs, config, ... }: { +{ config, ... }: { imports = [ - ./hardware-configuration.nix ../modules/fonts.nix ../modules/nvidia.nix # ../modules/prime.nix + ../modules/zsh.nix ../modules/tuigreet.nix + ../modules/auto-upgrade.nix ../modules/timezone.nix ../modules/usb.nix ../modules/systemd-boot.nix ../modules/users.nix ../modules/audio.nix ../modules/bluetooth.nix + ../modules/tailscale.nix + ../modules/nix.nix + ../modules/network-manager.nix + ../modules/home-manager.nix + ../modules/utils.nix + + ./hardware-configuration.nix ./variables.nix ]; - networking.networkmanager.enable = true; - networking.hostName = config.var.hostname; - systemd.services.NetworkManager-wait-online.enable = false; - - services = { - tailscale.enable = config.var.tailscale; - xserver = { - enable = true; - xkb.layout = config.var.keyboardLayout; - xkb.variant = ""; - }; - blueman.enable = true; - gnome.gnome-keyring.enable = true; - }; - console.keyMap = config.var.keyboardLayout; - - programs.zsh = { - enable = true; - loginShellInit = '' - dbus-update-activation-environment --systemd DISPLAY - ''; - }; - users.defaultUserShell = pkgs.zsh; - - environment.variables = { - XDG_DATA_HOME = "$HOME/.local/share"; - PASSWORD_STORE_DIR = "$HOME/.local/share/password-store"; - EDITOR = "nvim"; - }; - - nix = { - extraOptions = '' - warn-dirty = false - ''; - settings = { - auto-optimise-store = true; - experimental-features = [ "nix-command" "flakes" ]; - substituters = [ "https://hyprland.cachix.org" ]; - trusted-public-keys = [ - "hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc=" - ]; - }; - gc = { - automatic = config.var.autoGarbageCollector; - persistent = true; - dates = "weekly"; - options = "--delete-older-than 7d"; - }; - }; - - nixpkgs.config.allowUnfree = true; - - environment.systemPackages = with pkgs; [ - networkmanagerapplet - fd - bc - gcc - git-ignore - xdg-utils - wget - curl - ]; - - # nixpkgs.config.permittedInsecurePackages = - # [ "electron-25.9.0" ]; # TODO: test to remove - - system.autoUpgrade = { - enable = config.var.autoUpgrade; - dates = "04:00"; - flake = "${config.var.configDirectory}"; - flags = [ "--update-input" "nixpkgs" "--commit-lock-file" ]; - allowReboot = false; - }; - - # xdg.portal = { # TODO: test to remove - # enable = true; - # configPackages = with pkgs; [ xdg-desktop-portal-gtk ]; - # }; - - services.libinput.enable = true; - programs.dconf.enable = true; - - # Faster rebuilding - documentation = { - enable = true; - doc.enable = false; - man.enable = true; - dev.enable = false; - }; - - services.dbus.enable = true; + home-manager.users."${config.var.username}" = import ./home.nix; # Don't touch this system.stateVersion = "24.05"; diff --git a/hosts/modules/auto-upgrade.nix b/hosts/modules/auto-upgrade.nix new file mode 100644 index 0000000..2044cb2 --- /dev/null +++ b/hosts/modules/auto-upgrade.nix @@ -0,0 +1,9 @@ +{ config, ... }: { + system.autoUpgrade = { + enable = config.var.autoUpgrade; + dates = "04:00"; + flake = "${config.var.configDirectory}"; + flags = [ "--update-input" "nixpkgs" "--commit-lock-file" ]; + allowReboot = false; + }; +} diff --git a/hosts/modules/bluetooth.nix b/hosts/modules/bluetooth.nix index 5f1866f..30d05ef 100644 --- a/hosts/modules/bluetooth.nix +++ b/hosts/modules/bluetooth.nix @@ -4,4 +4,6 @@ enable = true; powerOnBoot = true; }; + + services.blueman.enable = true; } diff --git a/hosts/modules/home-manager.nix b/hosts/modules/home-manager.nix new file mode 100644 index 0000000..31ac611 --- /dev/null +++ b/hosts/modules/home-manager.nix @@ -0,0 +1,7 @@ +{ inputs, ... }: { + home-manager = { + useGlobalPkgs = true; + useUserPackages = true; + extraSpecialArgs = { inherit inputs; }; + }; +} diff --git a/hosts/modules/network-manager.nix b/hosts/modules/network-manager.nix new file mode 100644 index 0000000..e0ba69b --- /dev/null +++ b/hosts/modules/network-manager.nix @@ -0,0 +1,6 @@ +{ pkgs, ... }: { + networking.networkmanager.enable = true; + systemd.services.NetworkManager-wait-online.enable = false; + + environment.systemPackages = with pkgs; [ networkmanagerapplet ]; +} diff --git a/hosts/modules/nix.nix b/hosts/modules/nix.nix new file mode 100644 index 0000000..84df342 --- /dev/null +++ b/hosts/modules/nix.nix @@ -0,0 +1,22 @@ +{ config, ... }: { + nixpkgs.config.allowUnfree = true; + nix = { + extraOptions = '' + warn-dirty = false + ''; + settings = { + auto-optimise-store = true; + experimental-features = [ "nix-command" "flakes" ]; + substituters = [ "https://hyprland.cachix.org" ]; + trusted-public-keys = [ + "hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc=" + ]; + }; + gc = { + automatic = config.var.autoGarbageCollector; + persistent = true; + dates = "weekly"; + options = "--delete-older-than 7d"; + }; + }; +} diff --git a/hosts/modules/tailscale.nix b/hosts/modules/tailscale.nix new file mode 100644 index 0000000..4c5d214 --- /dev/null +++ b/hosts/modules/tailscale.nix @@ -0,0 +1 @@ +{ config, ... }: { services.tailscale.enable = config.var.tailscale; } diff --git a/hosts/modules/users.nix b/hosts/modules/users.nix index a1d78a8..63a11c1 100644 --- a/hosts/modules/users.nix +++ b/hosts/modules/users.nix @@ -1,7 +1,10 @@ -{ config, ... }: { - users.users.${config.var.username} = { - isNormalUser = true; - description = "${config.var.username} account"; - extraGroups = [ "networkmanager" "wheel" ]; +{ config, pkgs, ... }: { + users = { + defaultUserShell = pkgs.zsh; + users.${config.var.username} = { + isNormalUser = true; + description = "${config.var.username} account"; + extraGroups = [ "networkmanager" "wheel" ]; + }; }; } diff --git a/hosts/modules/utils.nix b/hosts/modules/utils.nix new file mode 100644 index 0000000..c5ca739 --- /dev/null +++ b/hosts/modules/utils.nix @@ -0,0 +1,42 @@ +{ pkgs, config, ... }: { + + networking.hostName = config.var.hostname; + + services = { + xserver = { + enable = true; + xkb.layout = config.var.keyboardLayout; + xkb.variant = ""; + }; + gnome.gnome-keyring.enable = true; + }; + console.keyMap = config.var.keyboardLayout; + + environment.variables = { + XDG_DATA_HOME = "$HOME/.local/share"; + PASSWORD_STORE_DIR = "$HOME/.local/share/password-store"; + EDITOR = "nvim"; + }; + + services.libinput.enable = true; + programs.dconf.enable = true; + services.dbus.enable = true; + + # Faster rebuilding + documentation = { + enable = true; + doc.enable = false; + man.enable = true; + dev.enable = false; + }; + + environment.systemPackages = with pkgs; [ + fd + bc + gcc + git-ignore + xdg-utils + wget + curl + ]; +} diff --git a/hosts/modules/zsh.nix b/hosts/modules/zsh.nix new file mode 100644 index 0000000..3907b36 --- /dev/null +++ b/hosts/modules/zsh.nix @@ -0,0 +1,8 @@ +{ + programs.zsh = { + enable = true; + loginShellInit = '' + dbus-update-activation-environment --systemd DISPLAY + ''; + }; +} diff --git a/hosts/server/modules/exposed/bitcoin-git.nix b/hosts/server/modules/exposed/bitcoin-git.nix index b2ac5b2..d80bf5b 100644 --- a/hosts/server/modules/exposed/bitcoin-git.nix +++ b/hosts/server/modules/exposed/bitcoin-git.nix @@ -1,4 +1,19 @@ -{ pkgs, ... }: { +{ pkgs, ... }: +let + bitcoin-price = pkgs.writeShellScriptBin "bitcoin-price" '' + [ ! -d "/home/hadi/btcprice" ] && ${pkgs.git}/bin/git clone git@github.com:anotherhadi/btcprice /home/hadi/btcprice + cd "/home/hadi/btcprice" + price=$(${pkgs.curl}/bin/curl eur.rate.sx/1BTC) + echo "# Bitcoin Price in EURO" >README.md + echo "" >>README.md + echo "1 Bitcoin = $price€" >>README.md + echo "" >>README.md + echo "Date: $(date)" >>README.md + ${pkgs.git}/bin/git add . + ${pkgs.git}/bin/git commit -m "Update price (hadi)" + ${pkgs.git}/bin/git push -u origin main + ''; +in { systemd.timers."bitcoin-git" = { wantedBy = [ "timers.target" ]; timerConfig = { @@ -10,17 +25,7 @@ systemd.services."bitcoin-git" = { script = '' - [ ! -d "/home/hadi/btcprice" ] && ${pkgs.git}/bin/git clone git@github.com:anotherhadi/btcprice /home/hadi/btcprice - cd "/home/hadi/btcprice" - price=$(${pkgs.curl}/bin/curl eur.rate.sx/1BTC) - echo "# Bitcoin Price in EURO" >README.md - echo "" >>README.md - echo "1 Bitcoin = $price€" >>README.md - echo "" >>README.md - echo "Date: $(date)" >>README.md - ${pkgs.git}/bin/git add . - ${pkgs.git}/bin/git commit -m "Update price (hadi)" - ${pkgs.git}/bin/git push -u origin main + ${bitcoin-price} exit 0 ''; serviceConfig = { diff --git a/hosts/server/modules/jackflix/transmission.nix b/hosts/server/modules/jackflix/transmission.nix index ae85c8f..f71521e 100644 --- a/hosts/server/modules/jackflix/transmission.nix +++ b/hosts/server/modules/jackflix/transmission.nix @@ -17,7 +17,6 @@ # haugene/transmission-openvpn # ''; # }; - # TODO: launch the container at boot networking.firewall.allowedTCPPorts = [ 9091 ]; } diff --git a/hosts/server/secrets/default.nix b/hosts/server/secrets/default.nix index e75fb5f..b294490 100644 --- a/hosts/server/secrets/default.nix +++ b/hosts/server/secrets/default.nix @@ -2,7 +2,7 @@ sops = { age.keyFile = "/home/hadi/.config/sops/age/keys.txt"; - defaultSopsFile = ./server.yaml; + defaultSopsFile = ./secrets.yaml; defaultSopsFormat = "yaml"; secrets = { sshconfig = { @@ -14,15 +14,15 @@ owner = "hadi"; }; nextcloud-adminpass = { - mode = "0444"; # FIXME + mode = "0444"; path = "/etc/nextcloud/adminpassFile"; }; cloudflare-apitoken = { - mode = "0444"; # FIXME + mode = "0444"; path = "/etc/cloudflare/apiToken"; }; tailscaled-authKey = { - mode = "0444"; # FIXME + mode = "0444"; path = "/etc/tailscale/authKey"; }; transmission-script = { diff --git a/hosts/server/secrets/server.yaml b/hosts/server/secrets/secrets.yaml similarity index 100% rename from hosts/server/secrets/server.yaml rename to hosts/server/secrets/secrets.yaml