commit 16170bdebcaba9a6611aafe3c44974fc0817cc2b Author: nomadics9 Date: Sun Oct 6 19:48:10 2024 +0300 init diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..ec4bd99 --- /dev/null +++ b/flake.lock @@ -0,0 +1,82 @@ +{ + "nodes": { + "dotfiles": { + "flake": false, + "locked": { + "lastModified": 1728232635, + "narHash": "sha256-8c6BzMZYiCLQi4hjSGATAykleEyAbDOm6AVNLNuWXEc=", + "ref": "refs/heads/main", + "rev": "04b816c129a511d5090c3088ee5fdc718c198b7a", + "revCount": 6, + "type": "git", + "url": "https://github.com/nomadics9/dotfiles.git" + }, + "original": { + "type": "git", + "url": "https://github.com/nomadics9/dotfiles.git" + } + }, + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1727817100, + "narHash": "sha256-dlyV9/eiWkm/Y/t2+k4CFZ29tBvCANmJogEYaHeAOTw=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "437ec62009fa8ceb684eb447d455ffba25911cf9", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1727802920, + "narHash": "sha256-HP89HZOT0ReIbI7IJZJQoJgxvB2Tn28V6XS3MNKnfLs=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "27e30d177e57d912d614c88c622dcfdb2e6e6515", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-stable": { + "locked": { + "lastModified": 1720535198, + "narHash": "sha256-zwVvxrdIzralnSbcpghA92tWu2DV2lwv89xZc8MTrbg=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "205fd4226592cc83fd4c0885a3e4c9c400efabb5", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-23.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "dotfiles": "dotfiles", + "home-manager": "home-manager", + "nixpkgs": "nixpkgs", + "nixpkgs-stable": "nixpkgs-stable" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..127dba5 --- /dev/null +++ b/flake.nix @@ -0,0 +1,54 @@ +{ + description = '' + Nomadics Modular Nixos + ''; + + inputs = { + home-manager = { + url = "github:nix-community/home-manager"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-23.11"; + + dotfiles = { + url = "git+https://github.com/nomadics9/dotfiles.git"; + flake = false; + }; + }; + + + + outputs = { self, home-manager, nixpkgs, dotfiles, ... }@inputs: + let + inherit (self) outputs; + systems = [ + "aarch64-linux" + "i686-linux" + "x86_64-linux" + "aarch64-darwin" + "x86_64-darwin" + ]; + forAllSystems = nixpkgs.lib.genAttrs systems; + user = "nomad"; + hostname = "unkown"; + in + { + packages = + forAllSystems (system: import ./pkgs nixpkgs.legacyPackages.${system}); + overlays = import ./overlays { inherit inputs; }; + nixosConfigurations = { + unkown = nixpkgs.lib.nixosSystem { + specialArgs = { inherit inputs outputs user hostname; }; + modules = [ ./hosts/unkown ]; + }; + }; + homeConfigurations = { + "${user}@${hostname}" = home-manager.lib.homeManagerConfiguration { + pkgs = nixpkgs.legacyPackages."x86_64-linux"; + extraSpecialArgs = { inherit inputs outputs user; }; + modules = [ ./home/nomad/unkown.nix ]; + }; + }; + }; +} diff --git a/home/common/default.nix b/home/common/default.nix new file mode 100644 index 0000000..8b31055 --- /dev/null +++ b/home/common/default.nix @@ -0,0 +1,36 @@ +{ config, lib, outputs, pkgs, ... }: { + nixpkgs = { + # You can add overlays here + overlays = [ + # Add overlays your own flake exports (from overlays and pkgs dir): + outputs.overlays.additions + outputs.overlays.modifications + outputs.overlays.stable-packages + + # You can also add overlays exported from other flakes: + # neovim-nightly-overlay.overlays.default + + # Or define it inline, for example: + # (final: prev: { + # hi = final.hello.overrideAttrs (oldAttrs: { + # patches = [ ./change-hello-to-hi.patch ]; + # }); + # }) + ]; + # Configure your nixpkgs instance + config = { + # Disable if you don't want unfree packages + allowUnfree = true; + # Workaround for https://github.com/nix-community/home-manager/issues/2942 + allowUnfreePredicate = _: true; + }; + }; + + nix = { + package = lib.mkDefault pkgs.nix; + settings = { + experimental-features = [ "nix-command" "flakes" "repl-flake" ]; + warn-dirty = false; + }; + }; +} diff --git a/home/features/cli/default.nix b/home/features/cli/default.nix new file mode 100644 index 0000000..888b23c --- /dev/null +++ b/home/features/cli/default.nix @@ -0,0 +1,27 @@ +{ pkgs, ... }: { + imports = [ + ./zsh.nix + ./fzf.nix + ./neofetch.nix + ]; + + # Starship + programs.starship = { + enable = true; + enableZshIntegration = true; + }; + + programs.bat = { enable = true; }; + + home.packages = with pkgs; [ + coreutils + fd + htop + ripgrep + tldr + zip + exiftool + nvtopPackages.full + cava + ]; +} diff --git a/home/features/cli/fzf.nix b/home/features/cli/fzf.nix new file mode 100644 index 0000000..c67585f --- /dev/null +++ b/home/features/cli/fzf.nix @@ -0,0 +1,38 @@ +{ config +, lib +, ... +}: +with lib; let + cfg = config.features.cli.fzf; +in +{ + options.features.cli.fzf.enable = mkEnableOption "enable fuzzy finder"; + + config = mkIf cfg.enable { + programs.fzf = { + enable = true; + enableZshIntegration = true; + + colors = { + "fg" = "#f8f8f2"; + "bg" = "#282a36"; + "hl" = "#bd93f9"; + "fg+" = "#f8f8f2"; + "bg+" = "#44475a"; + "hl+" = "#bd93f9"; + "info" = "#ffb86c"; + "prompt" = "#50fa7b"; + "pointer" = "#ff79c6"; + "marker" = "#ff79c6"; + "spinner" = "#ffb86c"; + "header" = "#6272a4"; + }; + defaultOptions = [ + "--preview='bat --color=always -n {}'" + "--bind 'ctrl-/:toggle-preview'" + ]; + defaultCommand = "fd --type f --exclude .git --follow --hidden"; + changeDirWidgetCommand = "fd --type d --exclude .git --follow --hidden"; + }; + }; +} diff --git a/home/features/cli/neofetch.nix b/home/features/cli/neofetch.nix new file mode 100644 index 0000000..947d206 --- /dev/null +++ b/home/features/cli/neofetch.nix @@ -0,0 +1,15 @@ +{ config +, lib +, pkgs +, ... +}: +with lib; let + cfg = config.features.cli.neofetch; +in +{ + options.features.cli.neofetch.enable = mkEnableOption "enable neofetch"; + + config = mkIf cfg.enable { + home.packages = with pkgs; [ neofetch ]; + }; +} diff --git a/home/features/cli/zsh.nix b/home/features/cli/zsh.nix new file mode 100644 index 0000000..f13f186 --- /dev/null +++ b/home/features/cli/zsh.nix @@ -0,0 +1,51 @@ +{ config +, lib +, ... +}: +with lib; let + cfg = config.features.cli.zsh; +in +{ + options.features.cli.zsh.enable = mkEnableOption "enable extended zsh configuration"; + + config = mkIf cfg.enable { + programs.zsh = { + enable = true; + + # loginExtra = '' + # set -x NIX_PATH nixpkgs=channel:nixos-unstable + # set -x NIX_LOG info + # set -x TERMINAL kitty + # + # if test (tty) = "/dev/tty1" + # exec Hyprland &> /dev/null + # end + # ''; + + shellAliases = { + switchhypr = "sudo nixos-rebuild switch --flake .#hyprland"; + switchuhypr = "sudo nixos-rebuild switch --upgrade --flake .#hyprland"; + switchgnome = "sudo nixos-rebuild switch --flake .#gnome"; + switchugnome = "sudo nixos-rebuild switch --upgrade --flake .#gnome"; + clean = "sudo nix-collect-garbage -d"; + cleanold = "sudo nix-collect-garbage --delete-old"; + cleanboot = "sudo /run/current-system/bin/switch-to-configuration boot"; + nvim = "kitty @ set-spacing padding=0 && /run/current-system/sw/bin/nvim"; + zed = "steam-run zed"; + }; + initExtraFirst = " + unsetopt beep + "; + autosuggestion.enable = true; + syntaxHighlighting.enable = true; + # zplug = { + # enable = true; + # plugins = [ + # { name = "zsh-users/zsh-autosuggestions"; } + # { name = "zsh-users/zsh-syntax-highlighting"; } + # { name = "romkatv/zsh-defer"; } + # ]; + # }; + }; + }; +} diff --git a/home/features/desktop/default.nix b/home/features/desktop/default.nix new file mode 100644 index 0000000..8a32ee5 --- /dev/null +++ b/home/features/desktop/default.nix @@ -0,0 +1,11 @@ +{ pkgs, ... }: { + imports = [ + ./fonts.nix + ./hyprland.nix + ./wayland.nix + ./xdg.nix + ]; + + home.packages = with pkgs; [ + ]; +} diff --git a/home/features/desktop/fonts.nix b/home/features/desktop/fonts.nix new file mode 100644 index 0000000..d6abd8c --- /dev/null +++ b/home/features/desktop/fonts.nix @@ -0,0 +1,26 @@ +{ config +, lib +, pkgs +, ... +}: +with lib; let + cfg = config.features.desktop.fonts; +in +{ + options.features.desktop.fonts.enable = + mkEnableOption "install additional fonts for desktop apps"; + + config = mkIf cfg.enable { + home.packages = with pkgs; [ + fira-code + fira-code-symbols + fira-code-nerdfont + font-manager + font-awesome_5 + font-awesome + noto-fonts-emoji + noto-fonts + jetbrains-mono + ]; + }; +} diff --git a/home/features/desktop/hyprland.nix b/home/features/desktop/hyprland.nix new file mode 100644 index 0000000..e91a9a0 --- /dev/null +++ b/home/features/desktop/hyprland.nix @@ -0,0 +1,258 @@ +{ config +, lib +, pkgs +, ... +}: +with lib; let + cfg = config.features.desktop.hyprland; +in +{ + options.features.desktop.hyprland.enable = mkEnableOption "hyprland config"; + + config = mkIf cfg.enable { + wayland.windowManager.hyprland = { + enable = true; + settings = { + xwayland = { + force_zero_scaling = true; + }; + + exec-once = [ + "waybar" + "hyprpaper" + "hypridle" + "wl-clipboard-history -t" + "wl-paste -p -t text --watch clipman store -P --histpath=\"~/.local/share/clipman-primary.json\"" + "poweralertd" + "syncthing" + "sleep 3; qsyncthingtray" + "kdeconnect-indicator" + "kdeconnectd" + "dbus-update-actvation-environment --systemd --all WAYLAND_DISPLAY XDG_CURRENT_DESKTOP" + "systemctl --user import-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP DBUS_SESSION_BUS_ADDRESS" + ]; + + env = [ + "XCURSOR_SIZE,24" + "GTK_THEME,Nightfox-Dark" + ]; + + input = { + kb_layout = "us,ara"; + kb_options = "grp:alt_shift_toggle"; + kb_variant = "qwerty_digits"; + kb_model = ""; + kb_rules = ""; + follow_mouse = 1; + + touchpad = { + natural_scroll = true; + }; + + sensitivity = 0; + }; + + general = { + gaps_in = 5; + gaps_out = 5; + border_size = 1; + "col.active_border" = "rgba(02BEF5ee) rgba(02BEF5ee) 45deg"; + "col.inactive_border" = "rgba(595959aa)"; + layout = "dwindle"; + }; + + decoration = { + "col.shadow" = "rgba(1E202966)"; + drop_shadow = true; + shadow_range = 60; + shadow_offset = "1 2"; + shadow_render_power = 3; + shadow_scale = 0.97; + rounding = 8; + blur = { + enabled = true; + size = 3; + passes = 3; + }; + active_opacity = 1; + inactive_opacity = 0.95; + }; + + animations = { + enabled = true; + bezier = "myBezier, 0.05, 0.9, 0.1, 1.05"; + animation = [ + "windows, 1, 7, myBezier" + "windowsOut, 1, 7, default, popin 80%" + "border, 1, 10, default" + "borderangle, 1, 8, default" + "fade, 1, 7, default" + "workspaces, 1, 6, default" + ]; + }; + + dwindle = { + pseudotile = true; + preserve_split = true; + }; + + master = { }; + + gestures = { + workspace_swipe = true; + workspace_swipe_min_speed_to_force = 5; + }; + + windowrule = [ + "float, file_progress" + "float, confirm" + "float, dialog" + "float, download" + "float, notification" + "float, error" + "float, splash" + "float, confirmreset" + "float, title:Open File" + "float, title:branchdialog" + "float, Lxappearance" + "float, Wofi" + "float, Calculator" + "rounding 10, Wofi" + "float, dunst" + "animation none,Wofi" + "float,viewnior" + "float,feh" + "float, pavucontrol-qt" + "float, pavucontrol" + "float, file-roller" + "fullscreen, wlogout" + "float, title:wlogout" + "fullscreen, title:wlogout" + "idleinhibit focus, mpv" + "idleinhibit fullscreen, firefox" + "float, title:^(Media viewer)$" + "float, title:^(Volume Control)$" + "float, title:^(Picture-in-Picture)$" + "size 1200 800, title:^(Volume Control)$" + "move 75 44%, title:^(Volume Control)$" + "float, title:^(fly_is_kitty)" + ]; + + "$mainMod" = "SUPER"; + + + + bind = [ + "$mainMod, Escape, exec, wlogout -p layer-shell" + "$mainMod, R, exec, wofi --show drun --allow-images" + "$mainMod, P, exec, wofi-pass" + "$mainMod, mouse_down, workspace, e+1" + "$mainMod, mouse_up, workspace, e-1" + + + "$mainMod, F1, exec, $HOME/.config/hypr/scripts/keybind.sh" + "$mainMod, Q, killactive" + "$mainMod, B, exec, firefox" + "$mainMod, F, fullscreen, 1" + "$mainModSHIFT, F, fullscreen, 0" + "$mainMod, V, togglesplit" # dwindle + + "$mainMod, j, movefocus, d" + "$mainMod, k, movefocus, u" + + "$mainMod, h, movefocus, l" + "$mainMod, l, movefocus, r" + + "$mainMod SHIFT, h, movewindow, l" + "$mainMod SHIFT, l, movewindow, r" + "$mainMod SHIFT, k, movewindow, u" + "$mainMod SHIFT, j, movewindow, d" + + "$mainMod SHIFT, t, exec, kitty --start-as=fullscreen -o 'font_size=18' --title all_is_kitty" + "ALT, RETURN, exec, kitty --title fly_is_kitty" + "$mainMod, RETURN, exec, kitty --title kitty_term" + + "$mainMod, C, killactive" + "$mainMod SHIFT, Q, exit" + "$mainMod, E, exec, nautilus" + #"$mainMod, R, exec, rofi -show drun -show-icons" + #"$mainMod, P, pseudo" + + + "ALTCTRL, DELETE, exec, htop" + "$mainMod, T, togglefloating" + + # Screen shot + "$mainMod, S, exec, hyprctl keyword animation 'fadeOut,0,0,default'; grimshot --notify copy active; hyprctl keyword animation 'fadeOut,1,4,default'" + "$mainMod SHIFT, S, exec, grimshot savecopy area - | swappy -f - -o ~/Photos/screenshot-$(date +'%d-%m-%Y_%H:%M').png" + + # Screen recorder + "$mainMod SHIFT, R, exec, wf-recorder & dunstify -a 'Recordering Started' -i -u -A '^C ,stop' -t 0 -i ~/icons/rec-button.png" + + # Emoji selector + "$mainMod SHIFT, E, exec, wofi-emoji" + + + # Change HZ + "$mainMod, A, exec, ~/.config/hypr/scripts/screenHz.sh" + + "$mainMod SHIFT, RETURN, layoutmsg, swapwithmaster" + + # Workspace bindings + "$mainMod, 1, workspace, 1" + "$mainMod, 2, workspace, 2" + "$mainMod, 3, workspace, 3" + "$mainMod, 4, workspace, 4" + "$mainMod, 5, workspace, 5" + "$mainMod, 6, workspace, 6" + "$mainMod, 7, workspace, 7" + "$mainMod, 8, workspace, 8" + "$mainMod, 9, workspace, 9" + "$mainMod, 0, workspace, 10" + + "$mainModSHIFT, 1, movetoworkspacesilent, 1" + "$mainModSHIFT, 2, movetoworkspacesilent, 2" + "$mainModSHIFT, 3, movetoworkspacesilent, 3" + "$mainModSHIFT, 4, movetoworkspacesilent, 4" + "$mainModSHIFT, 5, movetoworkspacesilent, 5" + "$mainModSHIFT, 6, movetoworkspacesilent, 6" + "$mainModSHIFT, 7, movetoworkspacesilent, 7" + "$mainModSHIFT, 8, movetoworkspacesilent, 8" + "$mainModSHIFT, 9, movetoworkspacesilent, 9" + "$mainModSHIFT, 0, movetoworkspacesilent, 10" + + "ALT, Tab, cyclenext" + ]; + + bindm = [ + "$mainMod, mouse:272, movewindow" + "$mainMod, mouse:273, resizewindow" + ]; + + binde = [ + "$mainMod, left, resizeactive, -40 0" + "$mainMod, right, resizeactive, 40 0" + "$mainMod, up, resizeactive, 0 -40" + "$mainMod, down, resizeactive, 0 40" + #"XF86AudioMute , exec, $HOME/.config/hypr/scripts/volume mute" + # "XF86AudioLowerVolume, exec, \"$HOME/.config/hypr/scripts/volume down\"" + # "XF86AudioRaiseVolume, exec, sh -c \"$HOME/.config/hypr/scripts/volume up\"" + # "XF86AudioMicMute, exec, \"pactl set-source-mute @DEFAULT_SOURCE@ toggle\"" + # + # "XF86MonBrightnessUp, exec, \"$HOME/hypr/scripts/brightness up\"" # increase screen brightness + # "XF86MonBrightnessDown, exec, \"$HOME/.config/hypr/scripts/brightness down\"" # decrease screen brightness + + ]; + + + windowrulev2 = [ + # "workspace 1,class:(Emacs)" + # "workspace 3,opacity 1.0, class:(brave-browser)" + # "workspace 4,class:(com.obsproject.Studio)" + ]; + }; + }; + }; + +} + diff --git a/home/features/desktop/wayland.nix b/home/features/desktop/wayland.nix new file mode 100644 index 0000000..ef93be1 --- /dev/null +++ b/home/features/desktop/wayland.nix @@ -0,0 +1,611 @@ +{ config +, lib +, pkgs +, ... +}: +with lib; let + cfg = config.features.desktop.wayland; +in +{ + options.features.desktop.wayland.enable = mkEnableOption "wayland extra tools and config"; + + config = mkIf cfg.enable { + + programs.waybar = { + enable = true; + settings = { + mainBar = { + height = 20; + layer = "top"; + modules-left = [ "custom/launcher" "cpu" "memory" "custom/weather" "hyprland/workspaces" ]; + modules-center = [ "mpris" ]; + modules-right = [ "network" "pulseaudio" "backlight" "battery" "clock" "tray" "hyprland/language" "custom/wallpaper" "custom/power-menu" ]; + + "hyprland/workspaces" = { + format = "{name}"; + all-outputs = true; + on-click = "activate"; + format-icons = { + active = " 󱎴"; + default = "󰍹"; + }; + persistent-workspaces = { + "1" = [ ]; + "2" = [ ]; + "3" = [ ]; + "4" = [ ]; + "5" = [ ]; + "6" = [ ]; + "7" = [ ]; + "8" = [ ]; + "9" = [ ]; + }; + }; + "hyprland/language" = { + format = "{short}"; + }; + + "hyprland/window" = { + max-length = 200; + separate-outputs = true; + }; + "tray" = { + spacing = 10; + }; + "clock" = { + format = "{:%H:%M}"; + format-alt = "{:%b %d %Y}"; + tooltip-format = "{:%Y %B}\n{calendar}"; + }; + + "cpu" = { + interval = 10; + format = " {}%"; + max-length = 10; + on-click = ""; + }; + "memory" = { + interval = 30; + format = "🧠 {}%"; + format-alt = "🧠 {used:0.1f}GB"; + max-length = 10; + }; + "temperature" = { + interval = 10; + format = " {temperatureC}°C"; + max-length = 10; + }; + "backlight" = { + device = "intel_backlight"; + format = "{icon}"; + tooltip = true; + format-alt = "{percent}%"; + format-icons = [ "󱩎" "󱩏" "󱩐" "󱩑" "󱩒" "󱩓" "󱩔" "󱩕" "󱩖" "󰛨" ]; + on-scroll-up = "brightnessctl set 1%+"; + on-scroll-down = "brightnessctl set 1%-"; + smooth-scrolling-threshold = "2400"; + tooltip-format = "Brightness {percent}%"; + }; + "network" = { + format-wifi = "{bandwidthDownBytes} {icon}"; + min-length = 10; + fixed-width = 10; + format-ethernet = "󰈀"; + format-disconnected = "󰤭"; + tooltip-format = "{essid}"; + interval = 1; + on-click = "~/.config/hypr/scripts/wofi-wifi.sh"; + format-icons = [ "󰤯" "󰤟" "󰤢" "󰤥" "󰤨" ]; + }; + + "bluetooth" = { + format = "{icon}"; + format-alt = "bluetooth: {status}"; + interval = 30; + format-icons = { + enabled = ""; + disabled = "󰂲"; + }; + tooltip-format = "{status}"; + }; + + "pulseaudio" = { + format = "{icon}"; + format-muted = "󰖁"; + format-icons = { + default = [ "" "" "󰕾" ]; + }; + on-click = "pamixer -t"; + on-scroll-up = "pamixer -i 1"; + on-scroll-down = "pamixer -d 1"; + on-click-right = "exec pavucontrol"; + tooltip-format = "Volume {volume}%"; + }; + + "battery" = { + bat = "BAT0"; + adapter = "ADP0"; + interval = 60; + states = { + warning = 20; + critical = 15; + }; + max-length = 20; + format = "{icon}"; + format-warning = "{icon}"; + format-critical = "{icon}"; + format-charging = ""; + format-plugged = "󰚥"; + format-notcharging = "󰚥"; + format-full = "󰂄"; + + format-alt = "{capacity}% "; + format-icons = [ "󱊡" "󱊢" "󱊣" ]; + }; + + "custom/weather" = { + format = "{}°C"; + tooltip = true; + interval = 3600; + exec = "wttrbar --location Kuwait"; + return-type = "json"; + }; + + "mpris" = { + format = "{player_icon} {title}"; + format-paused = " {status_icon} {title}"; + max-length = 80; + player-icons = { + default = "▶"; + mpv = "🎵"; + }; + status-icons = { + paused = "⏸"; + }; + }; + + "custom/spotify" = { + exec = "nix-shell ~/.config/waybar/scripts/mediaplayer.py --player youtube-music"; + format = " {}"; + return-type = "json"; + on-click = "playerctl play-pause"; + on-double-click-right = "playerctl next"; + on-scroll-down = "playerctl previous"; + }; + + "custom/power-menu" = { + format = "{percentage}Hz"; + on-click = "~/.config/hypr/scripts/screenHz.sh"; + return-type = "json"; + exec = "cat ~/.config/hypr/scripts/hz.json"; + interval = 1; + tooltip = false; + }; + + "custom/launcher" = { + format = "󱄅"; + on-click = "rofi -show drun &"; + }; + + "custom/wallpaper" = { + format = "󰸉"; + on-click = "bash ~/.config/waybar/scripts/changewallpaper.sh"; + }; + }; + }; + style = '' + * { + /* `otf-font-awesome` is required to be installed for icons */ + font-family: Material Design Icons, JetBrainsMono Nerd Font, Iosevka Nerd Font ; + font-size: 14px; + border: none; + border-radius: 0; + min-height: 0; + } + + window#waybar { + background-color: rgba(26, 27, 38, 0.5); + color: #ffffff; + transition-property: background-color; + transition-duration: 0.5s; + } + + window#waybar.hidden { + opacity: 0.1; + } + + #window { + color: #64727d; + } + + #clock, + #temperature, + #mpris, + #cpu, + #memory, + #custom-media, + #tray, + #mode, + #custom-lock, + #workspaces, + #idle_inhibitor, + #custom-launcher, + #custom-spotify, + #custom-weather, + #custom-weather.severe, + #custom-weather.sunnyDay, + #custom-weather.clearNight, + #custom-weather.cloudyFoggyDay, + #custom-weather.cloudyFoggyNight, + #custom-weather.rainyDay, + #custom-weather.rainyNight, + #custom-weather.showyIcyDay, + #custom-weather.snowyIcyNight, + #custom-weather.default { + color: #e5e5e5; + border-radius: 6px; + padding: 2px 10px; + background-color: #252733; + border-radius: 8px; + font-size: 14px; + + margin-left: 4px; + margin-right: 4px; + + margin-top: 8.5px; + margin-bottom: 8.5px; + } + #temperature{ + color: #7a95c9; + } + #cpu { + color: #fb958b; + } + + #memory { + color: #a1c999; + } + + #workspaces button { + color: #7a95c9; + box-shadow: inset 0 -3px transparent; + + padding-right: 3px; + padding-left: 4px; + + margin-left: 0.1em; + margin-right: 0em; + transition: all 0.5s cubic-bezier(0.55, -0.68, 0.48, 1.68); + } + + #workspaces button.active { + color: #ecd3a0; + padding-left: 1px; + padding-right: 5px; + font-family: Iosevka Nerd Font; + font-weight: bold; + font-size: 12px; + margin-left: 0em; + margin-right: 0em; + transition: all 0.5s cubic-bezier(0.55, -0.68, 0.48, 1.68); + } + + /* If workspaces is the leftmost module, omit left margin */ + .modules-left > widget:first-child > #workspaces { + margin-left: 0; + } + + /* If workspaces is the rightmost module, omit right margin */ + .modules-right > widget:last-child > #workspaces { + margin-right: 0; + } + + #custom-launcher { + margin-left: 12px; + + padding-right: 18px; + padding-left: 14px; + + font-size: 22px; + + color: #7a95c9; + + margin-top: 8.5px; + margin-bottom: 8.5px; + } + #bluetooth, + #backlight, + #battery, + #pulseaudio, + #network { + background-color: #252733; + padding: 0em 2em; + + font-size: 14px; + + padding-left: 7.5px; + padding-right: 7.5px; + + padding-top: 3px; + padding-bottom: 3px; + + margin-top: 7px; + margin-bottom: 7px; + + font-size: 20px; + } + + #pulseaudio { + color: #81A1C1; + padding-left: 9px; + font-size: 22px; + } + + #pulseaudio.muted { + color: #fb958b; + padding-left: 9px; + font-size: 22px; + } + + #backlight { + color: #ecd3a0; + padding-right: 5px; + padding-left: 8px; + font-size: 21.2px; + } + + #network { + padding-left: 0.2em; + color: #5E81AC; + border-radius: 8px 0px 0px 8px; + padding-left: 14px; + padding-right: 14px; + font-size: 20px; + } + + #network.disconnected { + color: #fb958b; + } + + #bluetooth { + padding-left: 0.2em; + color: #5E81AC; + border-radius: 8px 0px 0px 8px; + padding-left: 14px; + padding-right: 14px; + font-size: 20px; + } + + #bluetooth.disconnected { + color: #fb958b; + } + + + #battery { + color: #8fbcbb; + border-radius: 0px 8px 8px 0px; + padding-right: 12px; + padding-left: 12px; + font-size: 22px; + } + + #battery.critical, + #battery.warning, + #battery.full, + #battery.plugged { + color: #8fbcbb; + padding-left: 12px; + padding-right: 12px; + font-size: 22px; + } + + #battery.charging { + font-size: 18px; + padding-right: 12px; + padding-left: 12px; + } + + #battery.full, + #battery.plugged { + font-size: 22.5px; + padding-right: 12px; + } + + @keyframes blink { + to { + background-color: rgba(30, 34, 42, 0.5); + color: #abb2bf; + } + } + + #battery.warning { + color: #ecd3a0; + } + + #battery.critical:not(.charging) { + color: #fb958b; + } + + #custom-lock { + color: #ecd3a0; + padding: 0 15px 0 15px; + margin-left: 7px; + margin-top: 7px; + margin-bottom: 7px; + } + #clock { + color: #8a909e; + font-family: Iosevka Nerd Font; + font-weight: bold; + margin-top: 7px; + margin-bottom: 7px; + } + #language { + color: #8a909e; + font-family: Iosevka Nerd Font; + font-weight: bold; + border-radius : 8px 0 0 8px; + margin-top: 7px; + margin-bottom: 7px; + } + + #custom-power-menu { + color: #8a909e; + margin-right: 12px; + border-radius: 8px; + padding: 0 6px 0 6.8px; + border-radius: 0 8px 8px 0; + margin-top: 7px; + margin-bottom: 7px; + } + #custom-wallpaper { + color: #8a909e; + padding-right: 7; + padding-left: 7; + } + #custom-wallpaper, + #language, + #custom-power-menu { + background-color: #252733; + padding: 0em 2em; + + font-size: 17px; + + padding-left: 7.5px; + padding-right: 7.5px; + + padding-top: 3px; + padding-bottom: 3px; + + margin-top: 7px; + margin-bottom: 7px; + } + + tooltip { + font-family: Iosevka Nerd Font; + border-radius: 15px; + padding: 15px; + background-color: #1f232b; + } + + tooltip label { + font-family: Iosevka Nerd Font; + padding: 5px; + } + + label:focus { + background-color: #1f232b; + } + + #tray { + margin-right: 8px; + margin-top: 7px; + margin-bottom: 7px; + font-size: 30px; + + } + + #tray > .passive { + -gtk-icon-effect: dim; + } + + #tray > .needs-attention { + -gtk-icon-effect: highlight; + background-color: #eb4d4b; + } + + #idle_inhibitor { + background-color: #242933; + } + + #idle_inhibitor.activated { + background-color: #ecf0f1; + color: #2d3436; + } + #mpris, + #custom-spotify { + color: #abb2bf; + } + + #custom-weather { + font-family: Iosevka Nerd Font; + font-size: 14px; + color: #8a909e; + } + + #custom-weather.severe { + color: #eb937d; + } + + #custom-weather.sunnyDay { + color: #c2ca76; + } + + #custom-weather.clearNight { + color: #cad3f5; + } + + #custom-weather.cloudyFoggyDay, + #custom-weather.cloudyFoggyNight { + color: #c2ddda; + } + + #custom-weather.rainyDay, + #custom-weather.rainyNight { + color: #5aaca5; + } + + #custom-weather.showyIcyDay, + #custom-weather.snowyIcyNight { + color: #d6e7e5; + } + + #custom-weather.default { + color: #dbd9d8; + } + ''; + }; + + home.packages = with pkgs; [ + wofi + wofi-emoji + dbus + sway-contrib.grimshot + hyprlock + hypridle + hyprpaper + hyprpicker + qt6.qtwayland + kdePackages.qt6ct + slurp + swappy + waypipe + wf-recorder + wl-mirror + wl-clipboard + wlogout + wtype + wttrbar + ydotool + xdg-utils + xwaylandvideobridge + playerctl + brightnessctl + pamixer + pavucontrol # Volume control + dunst # Notifications + jellyfin-ffmpeg # Multimedia libs + viewnior # Image viewr + libcanberra-gtk3 # Notification sound + + # Gnome Stuff + gtk-engine-murrine + gnome-text-editor + file-roller + gnome-calculator + nautilus # Gnome file manager + gnome-system-monitor + + ]; + }; +} diff --git a/home/features/desktop/xdg.nix b/home/features/desktop/xdg.nix new file mode 100644 index 0000000..a938c02 --- /dev/null +++ b/home/features/desktop/xdg.nix @@ -0,0 +1,24 @@ +{ config +, lib +, pkgs +, ... +}: +with lib; let + cfg = config.features.desktop.xdg; +in +{ + options.features.desktop.xdg.enable = mkEnableOption "XDG Dirs"; + + config = mkIf cfg.enable { + + home.file.".config/user-dirs.dirs".text = '' + XDG_DESKTOP_DIR="$HOME/Desktop" + XDG_DOWNLOAD_DIR="$HOME/Downloads" + XDG_PUBLICSHARE_DIR="$HOME/Public" + XDG_DOCUMENTS_DIR="$HOME/Documents" + XDG_MUSIC_DIR="$HOME/Music" + XDG_PICTURES_DIR="$HOME/Photos" + XDG_VIDEOS_DIR="$HOME/Video" + ''; + }; +} diff --git a/home/features/themes/default.nix b/home/features/themes/default.nix new file mode 100644 index 0000000..e72c899 --- /dev/null +++ b/home/features/themes/default.nix @@ -0,0 +1,9 @@ +{ pkgs, ... }: { + imports = [ + ./gtk.nix + ./qt.nix + ]; + + home.packages = with pkgs; [ + ]; +} diff --git a/home/features/themes/gtk.nix b/home/features/themes/gtk.nix new file mode 100644 index 0000000..010bac0 --- /dev/null +++ b/home/features/themes/gtk.nix @@ -0,0 +1,69 @@ +{ config +, lib +, pkgs +, ... +}: +with lib; let + cfg = config.features.themes.gtk; +in +{ + options.features.themes.gtk.enable = mkEnableOption "gtk theme"; + + config = mkIf cfg.enable { + + home.pointerCursor = { + gtk.enable = true; + x11.enable = true; + package = pkgs.bibata-cursors; + name = "Bibata-Modern-Classic"; + size = 24; + }; + + + dconf = { + enable = true; + settings = { + "org/gnome/desktop/interface" = { + color-scheme = "prefer-dark"; + theme = "Nightfox-Dark"; + }; + "org/gnome/shell/extensions/user-theme" = { + theme = "Nightfox-Dark"; + }; + }; + }; + + gtk = { + enable = true; + font.name = "JetBrainsMono Nerd Font"; + font.size = 10; + theme = { + name = "Nightfox-Dark"; + package = pkgs.nightfox-gtk-theme; + }; + + iconTheme = { + name = "Papirus-Dark"; + package = pkgs.papirus-icon-theme; + }; + + cursorTheme = { + name = "Bibata-Modern-Classic"; + package = pkgs.bibata-cursors; + }; + + + + gtk3.extraConfig = { + gtk-application-prefer-dark-theme = ''1''; + }; + gtk4.extraConfig = { + gtk-theme-name = ''Nightfox:Dark''; + }; + + }; + }; +} + + + diff --git a/home/features/themes/qt.nix b/home/features/themes/qt.nix new file mode 100644 index 0000000..a6766b4 --- /dev/null +++ b/home/features/themes/qt.nix @@ -0,0 +1,24 @@ +{ config +, lib +, pkgs +, ... +}: +with lib; let + cfg = config.features.themes.qt; +in +{ + options.features.themes.qt.enable = mkEnableOption "qt theme"; + + config = mkIf cfg.enable { + + qt.enable = true; + qt.platformTheme.name = "adwaita"; + qt.style = { + name = "adwaita-dark"; + }; + + home.packages = with pkgs; [ + adwaita-qt6 + ]; + }; +} diff --git a/home/nomad/dotfiles/bat.nix b/home/nomad/dotfiles/bat.nix new file mode 100644 index 0000000..c2ae65a --- /dev/null +++ b/home/nomad/dotfiles/bat.nix @@ -0,0 +1,8 @@ +{ + home.file.".config/bat/config".text = '' + --theme="Dracula" + + # Show line numbers, Git modifications and file header (but no grid) + --style="numbers,changes,header" + ''; +} diff --git a/home/nomad/dotfiles/default.nix b/home/nomad/dotfiles/default.nix new file mode 100644 index 0000000..212779c --- /dev/null +++ b/home/nomad/dotfiles/default.nix @@ -0,0 +1,16 @@ +{ inputs, ... }: { + imports = [ + ./bat.nix + ./dunst.nix + ]; + + home.file.".config/nvim" = { + source = "${inputs.dotfiles}/nvim"; + recursive = true; + }; + + home.file.".config/hypr/scripts" = { + source = "${inputs.dotfiles}/scripts"; + recursive = true; + }; +} diff --git a/home/nomad/dotfiles/dunst.nix b/home/nomad/dotfiles/dunst.nix new file mode 100644 index 0000000..9b75c76 --- /dev/null +++ b/home/nomad/dotfiles/dunst.nix @@ -0,0 +1,208 @@ +{ + home.file.".config/dunst/dunstrc".text = '' + [global] + + # --- Display --- # + + # The monitor to be displayed to + monitor = 0 + + # Follow monitor with mouse + follow = mouse + + width = 300 + # height = 260 + origin = top-right + offset = 10x1 + + + progress_bar = true + progress_bar_height = 14 + progress_bar_frame_width = 1 + progress_bar_min_width = 150 + progress_bar_max_width = 300 + progress_bar_corner_radius = 5 + + + # Show how many messages are hidden + indicate_hidden = yes + + # Shrink window if it's smaller than the width. + shrink = no + + # The transparency of the window. + transparency = 1 + + # Draw a line between multiple notifications + separator_height = 6 + + separator_color = "#272f57" + + # Set notification padding + padding = 16 + horizontal_padding = 16 + + # Disable frame (border) + frame_width = 0 + + # Sort messages by urgency. + sort = no + + # Disable idle time + idle_threshold = 0 + + + # --- Text --- # + + # Set the font + # font = "Noto Sans 11" + font = "JetBrainsMono 11" + + # Set line height to font height + line_height = 0 + + # Reference for markup and formatting: + # bold + # italic + # strikethrough + # underline + # . + # %a appname + # %s summary + # %b body + # %i iconname (including its path) + # %I iconname (without its path) + # %p progress value if set ([ 0%] to [100%]) or nothing + # %n progress value if set without any extra characters + # %% Literal % + + markup = full + format = "%a\n%b\n%s" + + # Left align the text + alignment = left + + # Vertical alignment of message text and icon. + vertical_alignment = center + + # Show age of message if message is old + show_age_threshold = 120 + + # Wrap text if it doesn't fit in geometry + word_wrap = yes + + # Where to place ellipses if word wrap is disabled + # ellipsize = middle + + # Use newlines '\n' in notifications. + ignore_newline = no + + # Don't stack together notifications + stack_duplicates = true + + # Hide the count of stacked notifications + # hide_duplicate_count = false + + # Display indicators for URLs (U) and actions (A). + show_indicators = yes + + + # ---- Icons ---- # + + # Align icons left/right/off + icon_position = left + + # Scale small icons up to this size, set to 0 to disable. + min_icon_size = 50 + + # Scale larger icons down to this size, set to 0 to disable + max_icon_size = 60 + + # Paths to default icons. + icon_path = /usr/share/icons/kora/apps/scalable:/usr/share/icons/kora/status/scalable:/usr/share/icons/kora/actions/scalable:/usr/share/icons/kora/emblems/scalable:/usr/share/icons/kora/devices/scalable + + # --- History --- # + + # Avoid timing out hidden notifications + sticky_history = yes + + # Maximum amount of notifications kept in history + history_length = 100 + + + # --- Misc/Advanced --- # + + dmenu = /usr/bin/dmenu -p dunst: + + # Browser for opening urls in context menu. + browser = google-chrome-stable -new-tab + + # Always run rule-defined scripts, even if the notification is suppressed + always_run_script = false + + # Define the title of the windows spawned by dunst + title = Dunst + + # Define the class of the windows spawned by dunst + class = Dunst + + # Define the corner radius of the notification window + corner_radius = 20 + + # Don't gnore the dbus closeNotification message. + ignore_dbusclose = false + + + # --- Legacy --- # + + # Use the Xinerama extension instead of RandR for multi-monitor support. + force_xinerama = false + + + # --- Mouse --- # + mouse_left_click = close_current + mouse_middle_click = close_all, close_current + mouse_right_click = do_action + + + [experimental] + per_monitor_dpi = false + + [urgency_low] + background = "#141929fe" + highlight = "#6fa6e7" + frame_color = "#272f57" + foreground = "#dae1f2" + timeout = 8 + + [urgency_normal] + background = "#26292e" + highlight = "#5ca1ff" + + frame_color = "#272f57" + foreground = "#dae1f2" + timeout = 8 + + [urgency_critical] + background = "#5ca1ffff" + highlight = "#fe6c5a" + foreground = "#1c2138" + frame_color = "#52426e" + timeout = 0 + icon = battery-ac-adapter + + [backlight] + appname = "Backlight" + highlight = "#fc7b80" + + [music] + appname = "Music" + + [volume] + summary = "Volume*" + highlight = "#cb8cf4" + + [battery] + appname = "Power Warning" + ''; +} diff --git a/home/nomad/home.nix b/home/nomad/home.nix new file mode 100644 index 0000000..f336a81 --- /dev/null +++ b/home/nomad/home.nix @@ -0,0 +1,148 @@ +# This is a default home.nix generated by the follwing hone-manager command +# +# home-manager init ./ + +{ config, lib, pkgs, user, ... }: + +{ + home.username = lib.mkDefault user; + home.homeDirectory = lib.mkDefault "/home/${config.home.username}"; + # This value determines the Home Manager release that your configuration is + # compatible with. This helps avoid breakage when a new Home Manager release + # introduces backwards incompatible changes. + # + # You should not change this value, even if you update Home Manager. If you do + # want to update the value, then make sure to first check the Home Manager + # release notes. + home.stateVersion = "24.05"; # Please read the comment before changing. + + # The home.packages option allows you to install Nix packages into your + # environment. + home.packages = with pkgs; [ + # Essentials + kitty + firefox + # Apps + vlc + amberol + webcord + cava + ryujinx + mullvad-vpn + transmission_4-gtk + obsidian + tailscale + syncthing + qsyncthingtray + htop + nvtopPackages.full + exiftool + moonlight-qt + kdePackages.kdeconnect-kde + # Dev + go + python3 + nim + bun + pocketbase + edgedb + bruno + ripgrep + zip + #zed-fhs + android-studio + android-tools + jre17_minimal + # Nvim-Lua + lua-language-server + cowsay + + + # # Adds the 'hello' command to your environment. It prints a friendly + # # "Hello, world!" when run. + # pkgs.hello + + # # It is sometimes useful to fine-tune packages, for example, by applying + # # overrides. You can do that directly here, just don't forget the + # # parentheses. Maybe you want to install Nerd Fonts with a limited number of + # # fonts? + # (pkgs.nerdfonts.override { fonts = [ "FantasqueSansMono" ]; }) + + # # You can also create simple shell scripts directly inside your + # # configuration. For example, this adds a command 'my-hello' to your + # # environment: + # (pkgs.writeShellScriptBin "my-hello" '' + # echo "Hello, ${config.home.username}!" + # '') + ]; + + # Home Manager is pretty good at managing dotfiles. The primary way to manage + # plain files is through 'home.file'. + home.file = { + # # Building this configuration will create a copy of 'dotfiles/screenrc' in + # # the Nix store. Activating the configuration will then make '~/.screenrc' a + # # symlink to the Nix store copy. + # ".screenrc".source = dotfiles/screenrc; + + # # You can also set the file content immediately. + # ".gradle/gradle.properties".text = '' + # org.gradle.console=verbose + # org.gradle.daemon.idletimeout=3600000 + # ''; + }; + + # Home Manager can also manage your environment variables through + # 'home.sessionVariables'. If you don't want to manage your shell through Home + # Manager then you have to manually source 'hm-session-vars.sh' located at + # either + # + # ~/.nix-profile/etc/profile.d/hm-session-vars.sh + # + # or + # + # ~/.local/state/nix/profiles/profile/etc/profile.d/hm-session-vars.sh + # + # or + # + # /etc/profiles/per-user/m3tam3re/etc/profile.d/hm-session-vars.sh + # + home.sessionVariables = { + BROWSER = "firefox"; + EDITOR = "nvim"; + TERMINAL = "kitty"; + NIXOS_OZONE_WL = "1"; + #QT_QPA_PLATFORMTHEME = "qt5ct"; + #QT_WAYLAND_DISABLE_WINDOWDECORATION = "1"; + #QT_QPA_PLATFORM = "wayland-egl"; + #QT_STYLE_OVERRIDE = "kvantum"; + #XCURSOR_SIZE = "24"; + #QT_SCALE_FACTOR = "1.25"; + #QT_AUTO_SCREEN_SCALE_FACTOR = "1"; + MOZ_ENABLE_WAYLAND = "1"; + SDL_VIDEODRIVER = "wayland"; + _JAVA_AWT_WM_NONREPARENTING = "1"; + MOZ_DRM_DEVICE = "/dev/dri/card0:/dev/dri/card1"; + WLR_DRM_DEVICES = "/dev/dri/card0:/dev/dri/card1"; + #WLR_NO_HARDWARE_CURSORS = "1"; # if no cursor,uncomment this line + GBM_BACKEND = "nvidia-drm"; + CLUTTER_BACKEND = "wayland"; + LIBVA_DRIVER_NAME = "iHD"; + WLR_RENDERER = "vulkan"; + VK_DRIVER_FILES = "/run/opengl-driver/share/vulkan/icd.d/nvidia_icd.x86_64.json"; + #__GLX_VENDOR_LIBRARY_NAME = "nvidia"; + #__NV_PRIME_RENDER_OFFLOAD="1"; + XDG_CURRENT_DESKTOP = "Hyprland"; + XDG_SESSION_DESKTOP = "Hyprland"; + XDG_SESSION_TYPE = "wayland"; + GTK_USE_PORTAL = "1"; + GTK_THEME = "Nightfox-dark"; + #NIXOS_XDG_OPEN_USE_PORTAL = "1"; + XDG_CACHE_HOME = "${config.home.homeDirectory}/.cache"; + XDG_CONFIG_HOME = "${config.home.homeDirectory}/.config"; + XDG_BIN_HOME = "${config.home.homeDirectory}/.nix-profile/bin"; + XDG_DATA_HOME = "${config.home.homeDirectory}/.local/share"; + }; + + # Let Home Manager install and manage itself. + programs.home-manager.enable = true; +} diff --git a/home/nomad/unkown.nix b/home/nomad/unkown.nix new file mode 100644 index 0000000..a7bf729 --- /dev/null +++ b/home/nomad/unkown.nix @@ -0,0 +1,60 @@ +{ + imports = [ + ../common + ./dotfiles + ../features/cli + ../features/desktop + ../features/themes + ./home.nix + ]; + + features = { + cli = { + zsh.enable = true; + fzf.enable = true; + neofetch.enable = true; + }; + desktop = { + fonts.enable = true; + hyprland.enable = true; + wayland.enable = true; + xdg.enable = true; + }; + themes = { + gtk.enable = true; + qt.enable = true; + }; + }; + + + + wayland.windowManager.hyprland = { + settings = { + device = [ + { + name = "keyboard"; + kb_layout = "us,ara"; + } + { + name = "mouse"; + sensitivity = -0.5; + } + ]; + monitor = [ + "eDP-1,2560x1600@60,0x0,1.25" + "DP-2,1920x1080@60,2560x0,1" + + ]; + workspace = [ + "1, monitor:eDP-1, default:true" + "2, monitor:eDP-1" + "3, monitor:eDP-1" + "4, monitor:eDP-1" + "5, monitor:eDP-1" + "6, monitor:eDP-1" + "7, monitor:eDP-1" + ]; + }; + }; +} + diff --git a/hosts/common/default.nix b/hosts/common/default.nix new file mode 100644 index 0000000..6130141 --- /dev/null +++ b/hosts/common/default.nix @@ -0,0 +1,57 @@ +# Common configuration for all hosts + +{ lib, inputs, outputs, user, ... }: { + imports = [ + ./users + ./services + inputs.home-manager.nixosModules.home-manager + ]; + + + home-manager = { + useUserPackages = true; + extraSpecialArgs = { inherit inputs outputs; }; + }; + nixpkgs = { + # You can add overlays here + overlays = [ + # Add overlays your own flake exports (from overlays and pkgs dir): + outputs.overlays.additions + outputs.overlays.modifications + outputs.overlays.stable-packages + + # You can also add overlays exported from other flakes: + # neovim-nightly-overlay.overlays.default + + # Or define it inline, for example: + # (final: prev: { + # hi = final.hello.overrideAttrs (oldAttrs: { + # patches = [ ./change-hello-to-hi.patch ]; + # }); + # }) + ]; + # Configure your nixpkgs instance + config = { + # Disable if you don't want unfree packages + allowUnfree = true; + }; + }; + + nix = { + settings = { + experimental-features = "nix-command flakes"; + trusted-users = [ + "root" + "${user}" + ]; # Set users that are allowed to use the flake command + }; + gc = { + automatic = true; + options = "--delete-older-than 30d"; + }; + optimise.automatic = true; + registry = (lib.mapAttrs (_: flake: { inherit flake; })) + ((lib.filterAttrs (_: lib.isType "flake")) inputs); + nixPath = [ "/etc/nix/path" ]; + }; +} diff --git a/hosts/common/services/appimage.nix b/hosts/common/services/appimage.nix new file mode 100644 index 0000000..565997a --- /dev/null +++ b/hosts/common/services/appimage.nix @@ -0,0 +1,17 @@ +{ config +, lib +, ... +}: +with lib; let + cfg = config.common.services.appimage; +in +{ + options.common.services.appimage.enable = mkEnableOption "enable appimage"; + + config = mkIf cfg.enable { + programs.appimage = { + enable = true; + binfmt = true; + }; + }; +} diff --git a/hosts/common/services/default.nix b/hosts/common/services/default.nix new file mode 100644 index 0000000..848c8bf --- /dev/null +++ b/hosts/common/services/default.nix @@ -0,0 +1,10 @@ +{ + imports = [ + ./vm.nix + ./steam.nix + ./polkit.nix + ./appimage.nix + ./nautilus.nix + ./xdgportal.nix + ]; +} diff --git a/hosts/common/services/nautilus.nix b/hosts/common/services/nautilus.nix new file mode 100644 index 0000000..c3fd362 --- /dev/null +++ b/hosts/common/services/nautilus.nix @@ -0,0 +1,21 @@ +{ config +, lib +, ... +}: +with lib; let + cfg = config.common.services.nautilus; +in +{ + options.common.services.nautilus.enable = mkEnableOption "Gnome Filemanager"; + + config = mkIf cfg.enable { + + services.gnome.gnome-keyring.enable = true; + programs.nautilus-open-any-terminal = { + enable = true; + terminal = "kitty"; + }; + services.gvfs.enable = true; + services.tumbler.enable = true; + }; +} diff --git a/hosts/common/services/polkit.nix b/hosts/common/services/polkit.nix new file mode 100644 index 0000000..40f119a --- /dev/null +++ b/hosts/common/services/polkit.nix @@ -0,0 +1,31 @@ +{ config +, lib +, pkgs +, ... +}: +with lib; let + cfg = config.common.services.polkit; +in +{ + options.common.services.polkit.enable = mkEnableOption "Polkit Auth Agent"; + + config = mkIf cfg.enable + { + + systemd = { + user.services.polkit-gnome-authentication-agent-1 = { + description = "polkit-gnome-authentication-agent-1"; + wantedBy = [ "graphical-session.target" ]; + wants = [ "graphical-session.target" ]; + after = [ "graphical-session.target" ]; + serviceConfig = { + Type = "simple"; + ExecStart = "${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1"; + Restart = "on-failure"; + RestartSec = 1; + TimeoutStopSec = 10; + }; + }; + }; + }; +} diff --git a/hosts/common/services/steam.nix b/hosts/common/services/steam.nix new file mode 100644 index 0000000..b9766ac --- /dev/null +++ b/hosts/common/services/steam.nix @@ -0,0 +1,18 @@ +{ config +, lib +, ... +}: +with lib; let + cfg = config.common.services.steam; +in +{ + options.common.services.steam.enable = mkEnableOption "enable steam"; + + config = mkIf cfg.enable { + programs.steam = { + enable = true; + remotePlay.openFirewall = true; # Open ports in the firewall for Steam Remote Play + dedicatedServer.openFirewall = true; # Open ports in the firewall for Source Dedicated Server + }; + }; +} diff --git a/hosts/common/services/vm.nix b/hosts/common/services/vm.nix new file mode 100644 index 0000000..6fb2e12 --- /dev/null +++ b/hosts/common/services/vm.nix @@ -0,0 +1,44 @@ +{ config +, lib +, pkgs +, user +, ... +}: +with lib; let + cfg = config.common.services.vm; +in +{ + options.common.services.vm.enable = mkEnableOption "enable virtualization"; + + config = mkIf cfg.enable { + # Add user to libvirtd group + users.users.${user}.extraGroups = [ "libvirtd" ]; + + # Install necessary packages + environment.systemPackages = with pkgs; [ + virt-manager + virt-viewer + spice + spice-gtk + spice-protocol + win-virtio + win-spice + adwaita-icon-theme + #bridge-utils + ]; + + # Manage the virtualisation services + virtualisation = { + libvirtd = { + enable = true; + qemu = { + swtpm.enable = true; + ovmf.enable = true; + ovmf.packages = [ pkgs.OVMFFull.fd ]; + }; + }; + spiceUSBRedirection.enable = true; + }; + services.spice-vdagentd.enable = true; + }; +} diff --git a/hosts/common/services/xdgportal.nix b/hosts/common/services/xdgportal.nix new file mode 100644 index 0000000..1cd0937 --- /dev/null +++ b/hosts/common/services/xdgportal.nix @@ -0,0 +1,25 @@ +{ config +, lib +, pkgs +, ... +}: +with lib; let + cfg = config.common.services.xdgportal; +in +{ + options.common.services.xdgportal.enable = mkEnableOption "XDG Extra portal"; + + config = mkIf cfg.enable { + xdg.portal = { + enable = true; + xdgOpenUsePortal = false; + # gtkUsePortal = true; + extraPortals = with pkgs; [ + xdg-desktop-portal-gtk + # xdg-desktop-portal-hyprland + # xdg-desktop-portal-wlr + ]; + # wlr.enable = true; + }; + }; +} diff --git a/hosts/common/users/default.nix b/hosts/common/users/default.nix new file mode 100644 index 0000000..74bfb03 --- /dev/null +++ b/hosts/common/users/default.nix @@ -0,0 +1,3 @@ +{ + imports = [ ./nomad.nix ]; +} diff --git a/hosts/common/users/nomad.nix b/hosts/common/users/nomad.nix new file mode 100644 index 0000000..2ea5812 --- /dev/null +++ b/hosts/common/users/nomad.nix @@ -0,0 +1,30 @@ +{ config +, pkgs +, inputs +, user +, ... +}: { + users.users.${user} = { + initialPassword = "4321"; + isNormalUser = true; + shell = pkgs.zsh; + description = "${user}"; + extraGroups = [ + "wheel" + "networkmanager" + "libvirtd" + "flatpak" + "audio" + "video" + "plugdev" + "input" + "kvm" + "qemu-libvirtd" + "docker" + ]; + packages = [ inputs.home-manager.packages.${pkgs.system}.default ]; + }; + programs.zsh.enable = true; + home-manager.users.${user} = + import ../../../home/${user}/${config.networking.hostName}.nix; +} diff --git a/hosts/unkown/configuration.nix b/hosts/unkown/configuration.nix new file mode 100644 index 0000000..1c814df --- /dev/null +++ b/hosts/unkown/configuration.nix @@ -0,0 +1,132 @@ +{ pkgs, hostname, ... }: { + + imports = [ + # Include the results of the hardware scan. + ./hardware-configuration.nix + ]; + + # Hardware + # Nvidia + hardware.nvidia.enable = true; + # Battery + hardware.battery.enable = false; + + # Common + # System + common.services.polkit.enable = true; + common.services.xdgportal.enable = true; + # Filemanager + common.services.nautilus.enable = true; + # Virtual Box (Virt-Manager) + common.services.vm.enable = false; + # AppStores + common.services.appimage.enable = true; + common.services.steam.enable = true; + services.flatpak.enable = true; + + + #Bootloader + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + boot.loader.efi.efiSysMountPoint = "/boot/efi"; + #Boot entries limit + boot.loader.systemd-boot.configurationLimit = 3; + # Ntfs support + boot.supportedFilesystems = [ "ntfs" ]; + + + + # Enable GDM Login Manager + services.xserver.enable = true; + services.xserver.displayManager.gdm = { + enable = true; + wayland = true; + banner = "Nomadic Nixos"; + autoSuspend = true; + }; + + #Network + #Define your hostname + networking.hostName = "${hostname}"; + # Enable networking + networking.networkmanager.enable = true; + + # Bluethooth + hardware.bluetooth.enable = true; + # services.blueman.enable = true; + + # Enable sound with pipewire. + # sound.enable = true; + hardware.pulseaudio.enable = false; + security.rtkit.enable = false; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + # If you want to use JACK applications, uncomment this + # jack.enable = true; + }; + + + # Set your time zone. + time.timeZone = "Asia/Kuwait"; + # Select internationalisation properties. + i18n.defaultLocale = "en_US.UTF-8"; + i18n.extraLocaleSettings = { + LC_ADDRESS = "en_GB.UTF-8"; + LC_IDENTIFICATION = "en_GB.UTF-8"; + LC_MEASUREMENT = "en_GB.UTF-8"; + LC_MONETARY = "en_GB.UTF-8"; + LC_NAME = "en_GB.UTF-8"; + LC_NUMERIC = "en_GB.UTF-8"; + LC_PAPER = "en_GB.UTF-8"; + LC_TELEPHONE = "en_GB.UTF-8"; + LC_TIME = "en_GB.UTF-8"; + }; + + # Keyboard + services.xserver = { + exportConfiguration = true; # link /usr/share/X11/ properly + xkb.layout = "us,ara"; + xkb.options = "grp:alt_shift_toggle"; + xkb.variant = "qwerty_digits"; + }; + + # Enable CUPS to print documents. + services.printing.enable = true; + # Enable touchpad support (enabled default in most desktopManager). + services.libinput.enable = true; + services.libinput.touchpad.tapping = true; #tap + + + # Allow unfree packages + nixpkgs.config.allowUnfree = true; + + + environment.systemPackages = with pkgs; [ + # vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default. + # wget + neovim + git + zsh + ]; + + programs.hyprland = { + enable = true; + xwayland.enable = true; + }; + + #Firewall + # Open ports in the firewall. + # networking.firewall.allowedTCPPorts = [ ... ]; + # For Chromecast from chrome + # networking.firewall.allowedUDPPortRanges = [ { from = 32768; to = 60999; } ]; + # Or disable the firewall altogether. + networking.firewall.enable = false; + + + # Before changing this value read the documentation for this option + # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). + system.stateVersion = "24.05"; # Did you read the comment? +} diff --git a/hosts/unkown/default.nix b/hosts/unkown/default.nix new file mode 100644 index 0000000..300d62e --- /dev/null +++ b/hosts/unkown/default.nix @@ -0,0 +1,47 @@ +# A staring point is the basic NIXOS configuration generated by the ISO installer. +# On an existing NIXOS install you can use the following command in your flakes basedir: +# sudo nixos-generate-config --dir ./hosts/your-host +# +# Please make sure to change the first couple of lines in your configuration.nix: + +# { config, inputs, ouputs, lib, pkgs, ... }: + +{ + # imports = [ # Include the results of the hardware scan. + # ./hardware-configuration.nix + # inputs.home-manager.nixosModules.home-manager + # ]; + # + # # ... + # + # Moreover please update the packages option in your user configuration and add the home-manager options: + + # users.users = { + # ${user} = { + # isNormalUser = true; + # initialPassword = "4321"; + # extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user. + # packages = [ inputs.home-manager.packages.${pkgs.system}.default ]; + # }; + # }; + + # home-manager = { + # useUserPackages = true; + # extraSpecialArgs = { inherit inputs outputs; }; + # users.${user} = + # import ../../home/${user}/${config.networking.hostName}.nix; + # }; + + # Please also change your hostname accordingly: + #:w + + # networking.hostName = "unkown"; # Define your hostname. + + + imports = [ + ../common + ./hardware + ./configuration.nix + ]; + +} diff --git a/hosts/unkown/hardware-configuration.nix b/hosts/unkown/hardware-configuration.nix new file mode 100644 index 0000000..6739d23 --- /dev/null +++ b/hosts/unkown/hardware-configuration.nix @@ -0,0 +1,51 @@ +# Do not modify this file! It was generated by ‘nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = + [ + (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ "xhci_pci" "thunderbolt" "nvme" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { + device = "/dev/disk/by-uuid/6280ec59-29de-41f0-8bba-0cf79879d253"; + fsType = "ext4"; + }; + + fileSystems."/home" = + { + device = "/dev/disk/by-uuid/d8cc192f-564a-4cb5-b60d-d8ca3038dc6d"; + fsType = "ext4"; + }; + + fileSystems."/boot/efi" = + { + device = "/dev/disk/by-uuid/58D9-1D76"; + fsType = "vfat"; + options = [ "fmask=0022" "dmask=0022" ]; + }; + + swapDevices = + [{ device = "/dev/disk/by-uuid/3b826644-5864-4198-9c0b-bebe0159ba14"; }]; + + # Enables DHCP on each ethernet and wireless interface. In case of scripted networking + # (the default) this is the recommended approach. When using systemd-networkd it's + # still possible to use this option, but it's recommended to use it in conjunction + # with explicit per-interface declarations with `networking.interfaces..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.br-36e56247cb7d.useDHCP = lib.mkDefault true; + # networking.interfaces.br-60a7df8f4b91.useDHCP = lib.mkDefault true; + # networking.interfaces.docker0.useDHCP = lib.mkDefault true; + # networking.interfaces.wlp0s20f3.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/hosts/unkown/hardware/battery.nix b/hosts/unkown/hardware/battery.nix new file mode 100644 index 0000000..fbf25b6 --- /dev/null +++ b/hosts/unkown/hardware/battery.nix @@ -0,0 +1,43 @@ +{ config +, lib +, pkgs +, ... +}: +with lib; let + cfg = config.hardware.battery; +in +{ + options.hardware.battery.enable = mkEnableOption "enable battery options"; + + config = mkIf cfg.enable + { + # Better scheduling for CPU cycles - thanks System76!!! + services.system76-scheduler.settings.cfsProfiles.enable = true; + + # Enable TLP (better than gnomes internal power manager) + services.tlp = { + enable = true; + settings = { + CPU_BOOST_ON_AC = 1; + CPU_BOOST_ON_BAT = 0; + CPU_SCALING_GOVERNOR_ON_AC = "performance"; + CPU_SCALING_GOVERNOR_ON_BAT = "powersave"; + }; + }; + + # Do nothing if AC on + services.logind.lidSwitchExternalPower = "ignore"; + + # Disable GNOMEs power management + services.power-profiles-daemon.enable = false; + + # Enable powertop + #powerManagement.powertop.enable = true; + + # Enable thermald (only necessary if on Intel CPUs) + services.thermald.enable = true; + + #upower + services.upower.enable = true; + }; +} diff --git a/hosts/unkown/hardware/default.nix b/hosts/unkown/hardware/default.nix new file mode 100644 index 0000000..ae2bdaf --- /dev/null +++ b/hosts/unkown/hardware/default.nix @@ -0,0 +1,7 @@ +{ + imports = [ + ./battery.nix + ./nvidia.nix + ]; +} + diff --git a/hosts/unkown/hardware/nvidia.nix b/hosts/unkown/hardware/nvidia.nix new file mode 100644 index 0000000..9ce5ceb --- /dev/null +++ b/hosts/unkown/hardware/nvidia.nix @@ -0,0 +1,90 @@ +{ config +, lib +, pkgs +, ... +}: +with lib; let + cfg = config.hardware.nvidia; +in +{ + options.hardware.nvidia.enable = mkEnableOption "nvidia driver"; + + config = mkIf cfg.enable { + #Allow unfree packages + nixpkgs.config.allowUnfree = true; + + + services.xserver = { + videoDrivers = [ "nvidia" ]; + }; + + hardware = { + graphics.enable = true; + # opengl.driSupport = true; + graphics.enable32Bit = true; + graphics = { + extraPackages = with pkgs; [ + intel-media-driver # LIBVA_DRIVER_NAME=iHD + # intel-vaapi-driver # LIBVA_DRIVER_NAME=i965 (older but works better for Firefox/Chromium) + # libvdpau-va-gl + # vaapiVdpau + # mesa.drivers + ]; + }; + + + + nvidia.nvidiaSettings = true; + nvidia.powerManagement.enable = true; + nvidia.powerManagement.finegrained = true; + nvidia.open = false; + # nvidia.forceFullCompositionPipeline = true; + + # nvidia-drm.modeset=1 is required for some wayland compositors, e.g. sway + nvidia.modesetting.enable = true; + #nvidia.nvidiaPersistenced = true; + + # Optionally, you may need to select the appropriate driver version for your specific GPU. + nvidia.package = config.boot.kernelPackages.nvidiaPackages.stable; + + #offload , Sync or reverseSync + nvidia.prime = { + # reSync Mode + # reverseSync.enable = true; + + # Sync Mode + # sync.enable = true; + + # Offload Mode + offload = { + enable = true; + enableOffloadCmd = true; + }; + + # Bus ID of the NVIDIA GPU. You can find it using lspci, either under 3D or VGA + nvidiaBusId = "PCI:1:0:0"; + + # Bus ID of the Intel GPU. You can find it using lspci, either under 3D or VGA + intelBusId = "PCI:0:2:0"; + }; + }; + + + # Nvidia in Docker + virtualisation.docker = { + enable = true; + enableOnBoot = true; + #enableNvidia = true; + }; + + hardware.nvidia-container-toolkit.enable = true; + + environment.systemPackages = with pkgs; [ + cudatoolkit + ]; + }; +} + + + + diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..3178e40 --- /dev/null +++ b/install.sh @@ -0,0 +1,95 @@ +#!/usr/bin/env bash +RED="\e[31m" +GREEN="\e[32m" +YELLOW="\e[33m" +BLUE="\e[34m" +ENDCOLOR="\e[0m" +echo -e " $YELLOW + _ _ ___ __ __ _ ____ _ _ _____ _____ ____ ___ _ _ ____ _____ _ _ _ _____ ____ +| \ | |/ _ \| \/ | / \ | _ \ | \ | |_ _\ \/ / _ \/ ___| |_ _| \ | / ___|_ _|/ \ | | | | | ____| _ \ +| \| | | | | |\/| | / _ \ | | | | | \| || | \ / | | \___ \ | || \| \___ \ | | / _ \ | | | | | _| | |_) | +| |\ | |_| | | | |/ ___ \| |_| | | |\ || | / \ |_| |___) | | || |\ |___) || |/ ___ \| |___| |___| |___| _ < +|_| \_|\___/|_| |_/_/ \_\____/ |_| \_|___/_/\_\___/|____/ |___|_| \_|____/ |_/_/ \_\_____|_____|_____|_| \_\ + +$ENDCOLOR + $BLUE https://github.com/nomadics9 $ENDCOLOR + $RED TO MAKE SURE EVERYTHING RUNS CORRECTLY $ENDCOLOR $GREEN RUN AS ROOT '"sudo bash install.sh"' $ENDCOLOR +" +echo +echo + +# Define the flake file path +flake_file="./flake.nix" +config_file="./hosts/unkown/configuration.nix" # Specify the correct path for your host's configuration file +monitor_config_file="./home/nomad/unkown.nix" + +# Prompt for username and hostname +read -p "Enter the new username: " new_user +read -p "Enter the new hostname: " new_hostname + +# Replace the 'user' and 'hostname' values in the flake.nix file +sed -i "s/user = \".*\";/user = \"$new_user\";/" "$flake_file" +sed -i "s/hostname = \".*\";/hostname = \"$new_hostname\";/" "$flake_file" + +# Function to handle yes/no or y/n input +ask_yes_no() { + while true; do + read -p "$1 (yes/no): " response + case $response in + [Yy]* ) echo "true"; break;; + [Nn]* ) echo "false"; break;; + * ) echo "Please answer yes or no.";; + esac + done +} + + +update_monitor_config() { + # If the device is a laptop, keep eDP-1 + if [[ "$laptop_response" == "true" ]]; then + monitor_config="\"eDP-1,1920x1080@60,0x0,1\"" + workspace_config="monitor:eDP-1" + else + # If it's not a laptop, change it to DP-1 + monitor_config="\"DP-1,1920x1080@60,0x0,1\"" + workspace_config="monitor:DP-1" + fi + + # Replace the monitor configuration in the monitor configuration file + sed -i "/monitor = \[/!b;n;c\ $monitor_config" "$monitor_config_file" + # Replace the workspace configuration in the monitor configuration file + sed -i "s/monitor:eDP-1/$workspace_config/g" "$monitor_config_file" +} + + + +# Ask if the device is using Nvidia +nvidia_response=$(ask_yes_no "Is this device using Nvidia") +sed -i "s/hardware.nvidia.enable = .*/hardware.nvidia.enable = $nvidia_response;/" "$config_file" + +# Ask if the device is a laptop +laptop_response=$(ask_yes_no "Is this device a laptop") +sed -i "s/hardware.battery.enable = .*/hardware.battery.enable = $laptop_response;/" "$config_file" +update_monitor_config + +# Ask if the user wants Steam and Flatpak +steam_response=$(ask_yes_no "Do you want Steam to be enabled") +sed -i "s/common.services.steam.enable = .*/common.services.steam.enable = $steam_response;/" "$config_file" + +flatpak_response=$(ask_yes_no "Do you want Flatpak to be enabled") +sed -i "s/services.flatpak.enable = .*/services.flatpak.enable = $flatpak_response;/" "$config_file" + +vm_response=$(ask_yes_no "Do you want vm and virtmanager to be enabled") +sed -i "s/common.services.vm.enable = .*/common.services.vm.enable = $vm_response;/" "$config_file" + + +# Notify the user that the changes are complete +echo -e "$GREEN Configuration has been updated with your preferences $ENDCOLOR" +echo -e "$YELLOW Copying your hardware configurations $ENDCOLOR" + + cp /etc/nixos/hardware-configuration.nix ./hosts/unkown/hardware-configuration.nix + sleep 2 + sudo nixos-rebuild boot --flake . + + echo -e "$GREEN Reboot after completion your initial password is 4321 $ENDCOLOR" + diff --git a/overlays/default.nix b/overlays/default.nix new file mode 100644 index 0000000..ab3fc10 --- /dev/null +++ b/overlays/default.nix @@ -0,0 +1,21 @@ +{ inputs, ... }: { + # This one brings our custom packages from the 'pkgs' directory + additions = final: _prev: import ../pkgs { pkgs = final; }; + + # This one contains whatever you want to overlay + # You can change versions, add patches, set compilation flags, anything really. + # https://nixos.wiki/wiki/Overlays + modifications = final: prev: + { + # example = prev.example.overrideAttrs (oldAttrs: rec { + # ... + # }); + }; + + stable-packages = final: _prev: { + stable = import inputs.nixpkgs-stable { + system = final.system; + config.allowUnfree = true; + }; + }; +} diff --git a/pkgs/default.nix b/pkgs/default.nix new file mode 100644 index 0000000..310dd6e --- /dev/null +++ b/pkgs/default.nix @@ -0,0 +1,5 @@ +{ pkgs, ... }: +{ + # Define your custom packages here + # my-package = pkgs.callPackage ./my-package {}; +} diff --git a/pkgs/my-package/default.nix b/pkgs/my-package/default.nix new file mode 100644 index 0000000..fe6ef0f --- /dev/null +++ b/pkgs/my-package/default.nix @@ -0,0 +1,2 @@ +# Your custom nix-package +# ...