diff --git a/configuration/laptop/configuration.nix b/configuration/laptop/configuration.nix index 9e7e388..870aa43 100644 --- a/configuration/laptop/configuration.nix +++ b/configuration/laptop/configuration.nix @@ -15,6 +15,8 @@ nixpkgs.config.allowUnfree = true; services.avahi.enable = true; + services.upower.enable = true; + services.power-profiles-daemon.enable = true; networking = { proxy.noProxy = "127.0.0.1,localhost,internal.domain"; diff --git a/configuration/modules/desktop.nix b/configuration/modules/desktop.nix index d755785..61fbf3c 100644 --- a/configuration/modules/desktop.nix +++ b/configuration/modules/desktop.nix @@ -1,6 +1,7 @@ { pkgs, inputs, + device-name, ... }: { environment.systemPackages = with pkgs; [ @@ -39,7 +40,7 @@ }; displayManager.sddm = { enable = true; - theme = "${import ./sddm-theme.nix {inherit pkgs;}}"; + theme = "${import ../${device-name}/sddm-theme.nix {inherit pkgs;}}"; autoNumlock = true; }; }; diff --git a/configuration/modules/system.nix b/configuration/modules/system.nix index 5f28fbb..9cd6870 100644 --- a/configuration/modules/system.nix +++ b/configuration/modules/system.nix @@ -1,5 +1,5 @@ -{name, ...}: { - networking.hostName = "max-${name}"; +{device-name, ...}: { + networking.hostName = "max-${device-name}"; system = { stateVersion = "25.11"; activationScripts.cleanBackups = '' diff --git a/flake.nix b/flake.nix index 6b4a755..4988c91 100644 --- a/flake.nix +++ b/flake.nix @@ -22,24 +22,24 @@ }; outputs = {nixpkgs, ...} @ inputs: let - mkSystem = name: + mkSystem = device-name: nixpkgs.lib.nixosSystem { system = "x86_64-linux"; specialArgs = { - inherit inputs name; + inherit inputs device-name; }; modules = [ - ./configuration/${name}/configuration.nix - ./configuration/${name}/hardware-configuration.nix + ./configuration/${device-name}/configuration.nix + ./configuration/${device-name}/hardware-configuration.nix inputs.home-manager.nixosModules.default inputs.stylix.nixosModules.stylix { home-manager = { useUserPackages = true; useGlobalPkgs = true; - extraSpecialArgs = {inherit inputs name;}; + extraSpecialArgs = {inherit inputs device-name;}; backupFileExtension = "backup_nix"; - users.maxag = ./home/${name}/home.nix; + users.maxag = ./home/${device-name}/home.nix; sharedModules = [ inputs.stylix.homeModules.stylix ]; diff --git a/home/laptop/hyprland.nix b/home/laptop/hyprland.nix index 4bcfca6..df6a787 100644 --- a/home/laptop/hyprland.nix +++ b/home/laptop/hyprland.nix @@ -1,207 +1,15 @@ {pkgs, ...}: { + imports = [ + ../modules/hyprland.nix + ]; + wayland.windowManager.hyprland = { - enable = true; - systemd.enable = true; - systemd.variables = ["--all"]; - - xwayland.enable = true; - settings = { - exec-once = [ - "wl-clip-persist --clipboard both" - "wl-paste --watch cliphist store" - "hyprpanel" - ]; - - env = [ - "NIXOS_OZONE_WL, 1" - "XDG_SESSION_TYPE, wayland" - "XDG_SESSION_DESKTOP, Hyprland" - ]; - - input = { - kb_layout = "cz"; - kb_options = "caps:escape"; - numlock_by_default = true; - - sensitivity = 0; - touchpad = { - natural_scroll = false; - }; - }; - - misc = { - disable_hyprland_logo = true; - layers_hog_keyboard_focus = true; - animate_manual_resizes = true; - enable_swallow = true; - focus_on_activate = true; - middle_click_paste = false; - }; - - dwindle = { - force_split = 0; - special_scale_factor = 1.0; - split_width_multiplier = 1.0; - use_active_for_splits = true; - pseudotile = "yes"; - preserve_split = "yes"; - }; - - general = { - "$mainMod" = "SUPER"; - layout = "dwindle"; - gaps_in = 4; - gaps_out = 3; - border_size = 2; - no_border_on_floating = false; - }; - - decoration = { - rounding = 7; - active_opacity = 1.0; - inactive_opacity = 1.0; - fullscreen_opacity = 1.0; - - blur.enabled = false; - shadow.enabled = false; - }; - - 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" - ]; - }; - - binds = { - movefocus_cycles_fullscreen = true; - }; - bind = [ - # keybindings - "$mainMod, Return, exec, foot" - "$mainMod, B, exec, firefox" - "$mainMod, Q, killactive," - "$mainMod, F, fullscreen, 0" - "$mainMod SHIFT, F, fullscreen, 1" - "$mainMod, W, togglefloating" - "$mainMod, A, exec, fuzzel" - "$mainMod, P, pseudo," - "$mainMod, E, exec, thunar" - "$mainMod, C, exec, hyprpicker -a" - "$mainMod, code:23, swapsplit" - "$mainMod, code:66, togglesplit" - "Alt, F4, exec, hyprctl kill" - - # switch focus - "$mainMod, left, movefocus, l" - "$mainMod, right, movefocus, r" - "$mainMod, up, movefocus, u" - "$mainMod, down, movefocus, d" - "$mainMod, h, movefocus, l" - "$mainMod, j, movefocus, d" - "$mainMod, k, movefocus, u" - "$mainMod, l, movefocus, r" - - "$mainMod, left, alterzorder, top" - "$mainMod, right, alterzorder, top" - "$mainMod, up, alterzorder, top" - "$mainMod, down, alterzorder, top" - "$mainMod, h, alterzorder, top" - "$mainMod, j, alterzorder, top" - "$mainMod, k, alterzorder, top" - "$mainMod, l, alterzorder, top" - - # switch workspace - "$mainMod, code:10, workspace, 1" - "$mainMod, code:11, workspace, 2" - "$mainMod, code:12, workspace, 3" - "$mainMod, code:13, workspace, 4" - "$mainMod, code:14, workspace, 5" - "$mainMod, code:15, workspace, 6" - "$mainMod, code:16, workspace, 7" - "$mainMod, code:17, workspace, 8" - "$mainMod, code:18, workspace, 9" - "$mainMod, code:19, workspace, 10" - - # same as above, but switch to the workspace - "$mainMod SHIFT, code:10, movetoworkspace, 1" - "$mainMod SHIFT, code:11, movetoworkspace, 2" - "$mainMod SHIFT, code:12, movetoworkspace, 3" - "$mainMod SHIFT, code:13, movetoworkspace, 4" - "$mainMod SHIFT, code:14, movetoworkspace, 5" - "$mainMod SHIFT, code:15, movetoworkspace, 6" - "$mainMod SHIFT, code:16, movetoworkspace, 7" - "$mainMod SHIFT, code:17, movetoworkspace, 8" - "$mainMod SHIFT, code:18, movetoworkspace, 9" - "$mainMod SHIFT, code:19, movetoworkspace, 10" - - "$mainMod ALT, code:10, movetoworkspacesilent, 1" - "$mainMod ALT, code:11, movetoworkspacesilent, 2" - "$mainMod ALT, code:12, movetoworkspacesilent, 3" - "$mainMod ALT, code:13, movetoworkspacesilent, 4" - "$mainMod ALT, code:14, movetoworkspacesilent, 5" - "$mainMod ALT, code:15, movetoworkspacesilent, 6" - "$mainMod ALT, code:16, movetoworkspacesilent, 7" - "$mainMod ALT, code:17, movetoworkspacesilent, 8" - "$mainMod ALT, code:18, movetoworkspacesilent, 9" - "$mainMod ALT, code:19, movetoworkspacesilent, 10" - - # window control - "$mainMod SHIFT, left, movewindow, l" - "$mainMod SHIFT, right, movewindow, r" - "$mainMod SHIFT, up, movewindow, u" - "$mainMod SHIFT, down, movewindow, d" - "$mainMod SHIFT, h, movewindow, l" - "$mainMod SHIFT, j, movewindow, d" - "$mainMod SHIFT, k, movewindow, u" - "$mainMod SHIFT, l, movewindow, r" - - "$mainMod CTRL, left, resizeactive, -80 0" - "$mainMod CTRL, right, resizeactive, 80 0" - "$mainMod CTRL, up, resizeactive, 0 -80" - "$mainMod CTRL, down, resizeactive, 0 80" - "$mainMod CTRL, h, resizeactive, -80 0" - "$mainMod CTRL, j, resizeactive, 0 80" - "$mainMod CTRL, k, resizeactive, 0 -80" - "$mainMod CTRL, l, resizeactive, 80 0" - - "$mainMod ALT, left, moveactive, -80 0" - "$mainMod ALT, right, moveactive, 80 0" - "$mainMod ALT, up, moveactive, 0 -80" - "$mainMod ALT, down, moveactive, 0 80" - "$mainMod ALT, h, moveactive, -80 0" - "$mainMod ALT, j, moveactive, 0 80" - "$mainMod ALT, k, moveactive, 0 -80" - "$mainMod ALT, l, moveactive, 80 0" - - # media and volume controls - # ",XF86AudioMute,exec, pamixer -t" - ",XF86AudioPlay,exec, playerctl play-pause" - ",XF86AudioNext,exec, playerctl next" - ",XF86AudioPrev,exec, playerctl previous" - ",XF86AudioStop,exec, playerctl stop" - ]; - - # mouse binding - bindm = [ - "$mainMod, mouse:272, movewindow" - "$mainMod, mouse:273, resizewindow" - ]; - - windowrule = [ - # "float,class:^(mpv)$" + "$mainMod ALT, left, exec, hyprctl keyword monitor eDP-1,preferred,auto,1,transform,3 && hyprctl keyword input:touchdevice:transform 3 && hyprctl keyword input:tablet:transform 3" + "$mainMod ALT, right, exec, hyprctl keyword monitor eDP-1,preferred,auto,1,transform,1 && hyprctl keyword input:touchdevice:transform 1 && hyprctl keyword input:tablet:transform 1" + "$mainMod ALT, up, exec, hyprctl keyword monitor eDP-1,preferred,auto,1,transform,2 && hyprctl keyword input:touchdevice:transform 2 && hyprctl keyword input:tablet:transform 2" + "$mainMod ALT, down, exec, hyprctl keyword monitor eDP-1,preferred,auto,1,transform,0 && hyprctl keyword input:touchdevice:transform 0 && hyprctl keyword input:tablet:transform 0" ]; workspace = [ @@ -219,16 +27,8 @@ }; programs.hyprpanel = { - enable = true; - systemd.enable = true; settings = { bar = { - launcher.autoDetectIcon = true; - - clock.format = "%d %b %H:%M"; - - workspaces.show_numbered = true; - layouts = { "*" = { left = [ @@ -240,71 +40,12 @@ "volume" "clock" "systray" + "battery" "notifications" ]; }; }; }; - - menus.clock = { - time = { - military = true; - hideSeconds = false; - }; - weather.enabled = false; - }; - - menus.dashboard.directories.enabled = false; - menus.dashboard.shortcuts.enabled = true; - menus.dashboard.stats.enabled = false; - menus.dashboard.controls.enabled = false; - - theme.bar.transparent = true; - theme.bar.buttons.dashboard.icon = "#88B1F7"; - - theme.bar.buttons.workspaces = { - hover = "#FFFFFF"; - active = "#FFFFFF"; - occupied = "#88B1F7"; - available = "#88B1F7"; - numbered_active_underline_color = "#FFFFFF"; - }; - - theme.bar.buttons.clock.text = "#88B1F7"; - theme.bar.buttons.clock.icon = "#88B1F7"; - theme.bar.menus.menu.clock.time.time = "#88B1F7"; - theme.bar.menus.menu.clock.calendar.weekdays = "#88B1F7"; - theme.bar.menus.menu.clock.calendar.paginator = "#88B1F7"; - theme.bar.menus.menu.clock.calendar.currentday = "#88B1F7"; - theme.bar.buttons.notifications.icon = "#88B1F7"; - - theme.bar.menus.menu.volume = { - label.color = "#88B1F7"; - listitems.active = "#88B1F7"; - iconbutton.active = "#88B1F7"; - audio_slider.primary = "#88B1F7"; - input_slider.primary = "#88B1F7"; - }; - - theme.bar.buttons.volume = { - text = "#88b1f7"; - icon = "#88b1f7"; - }; - - theme.font = { - size = "12px"; - }; }; }; - - home.packages = with pkgs; [ - hyprpanel - hyprpicker - wl-clip-persist - cliphist - wf-recorder - slurp - grim - wl-clipboard - ]; } diff --git a/home/main/home.nix b/home/main/home.nix index acf5986..094eb3b 100644 --- a/home/main/home.nix +++ b/home/main/home.nix @@ -8,7 +8,7 @@ programs.home-manager.enable = true; imports = [ - ../modules/hyprland.nix + ./hyprland.nix ../modules/nvf.nix ../modules/stylix.nix ../modules/games.nix diff --git a/home/main/hyprland.nix b/home/main/hyprland.nix new file mode 100644 index 0000000..f1d6500 --- /dev/null +++ b/home/main/hyprland.nix @@ -0,0 +1,45 @@ +{pkgs, ...}: { + imports = [ + ../modules/hyprland.nix + ]; + + wayland.windowManager.hyprland = { + settings = { + workspace = [ + "1, monitor:DP-1" + "2, monitor:DP-2" + ]; + }; + + extraConfig = " + monitor=DP-1,2560x1440@120,0x0,1 + monitor=DP-2,1920x1080@60,-1920x300,1 + + xwayland { + force_zero_scaling = true + } + "; + }; + + programs.hyprpanel = { + settings = { + bar = { + layouts = { + "*" = { + left = [ + "dashboard" + "workspaces" + ]; + middle = []; + right = [ + "volume" + "clock" + "systray" + "notifications" + ]; + }; + }; + }; + }; + }; +} diff --git a/home/modules/hyprland.nix b/home/modules/hyprland.nix index edd4eca..1b71aa9 100644 --- a/home/modules/hyprland.nix +++ b/home/modules/hyprland.nix @@ -26,7 +26,7 @@ sensitivity = 0; touchpad = { - natural_scroll = true; + natural_scroll = false; }; }; @@ -177,15 +177,6 @@ "$mainMod CTRL, k, resizeactive, 0 -80" "$mainMod CTRL, l, resizeactive, 80 0" - "$mainMod ALT, left, moveactive, -80 0" - "$mainMod ALT, right, moveactive, 80 0" - "$mainMod ALT, up, moveactive, 0 -80" - "$mainMod ALT, down, moveactive, 0 80" - "$mainMod ALT, h, moveactive, -80 0" - "$mainMod ALT, j, moveactive, 0 80" - "$mainMod ALT, k, moveactive, 0 -80" - "$mainMod ALT, l, moveactive, 80 0" - # media and volume controls # ",XF86AudioMute,exec, pamixer -t" ",XF86AudioPlay,exec, playerctl play-pause" @@ -203,21 +194,7 @@ windowrule = [ # "float,class:^(mpv)$" ]; - - workspace = [ - "1, monitor:DP-1" - "2, monitor:DP-2" - ]; }; - - extraConfig = " - monitor=DP-1,2560x1440@120,0x0,1 - monitor=DP-2,1920x1080@60,-1920x300,1 - - xwayland { - force_zero_scaling = true - } - "; }; programs.hyprpanel = { @@ -230,22 +207,6 @@ clock.format = "%d %b %H:%M"; workspaces.show_numbered = true; - - layouts = { - "*" = { - left = [ - "dashboard" - "workspaces" - ]; - middle = []; - right = [ - "volume" - "clock" - "systray" - "notifications" - ]; - }; - }; }; menus.clock = { @@ -279,6 +240,14 @@ theme.bar.menus.menu.clock.calendar.paginator = "#88B1F7"; theme.bar.menus.menu.clock.calendar.currentday = "#88B1F7"; theme.bar.buttons.notifications.icon = "#88B1F7"; + theme.bar.battery.icon = "#88B1F7"; + + theme.bar.buttons.battery.text = "#88B1F7"; + theme.bar.buttons.battery.icon = "#88B1F7"; + theme.bar.menus.menu.battery.label.color = "#88B1F7"; + theme.bar.menus.menu.battery.slider.primary = "#88B1F7"; + theme.bar.menus.menu.battery.listitems.active = "#88B1F7"; + theme.bar.menus.menu.battery.icons.active = "#88B1F7"; theme.bar.menus.menu.volume = { label.color = "#88B1F7"; @@ -308,5 +277,6 @@ slurp grim wl-clipboard + playerctl ]; } diff --git a/home/modules/nvf.nix b/home/modules/nvf.nix index e782753..13ba142 100644 --- a/home/modules/nvf.nix +++ b/home/modules/nvf.nix @@ -18,7 +18,9 @@ name = "catppuccin"; style = "mocha"; }; + lsp = { + null-ls.enable = false; enable = true; inlayHints.enable = true; @@ -60,15 +62,19 @@ nix.enable = true; markdown.enable = true; + nu.enable = true; + bash.enable = true; + css.enable = true; html.enable = true; + sql.enable = true; ts.enable = true; zig.enable = true; csharp.enable = true; rust = { enable = true; - crates.enable = true; + crates.enable = false; #null-ls was making me angry }; }; diff --git a/home/modules/shells.nix b/home/modules/shells.nix index d52f3eb..d1f9a46 100644 --- a/home/modules/shells.nix +++ b/home/modules/shells.nix @@ -1,6 +1,6 @@ { pkgs, - name, + device-name, ... }: { home.packages = with pkgs; [ @@ -17,59 +17,72 @@ nushell = { enable = true; - extraConfig = '' - if "ZELLIJ" in $env == false { - zellij - exit - } else { - if "IN_NIX_SHELL" in $env == false { + extraConfig = + /* + nu + */ + '' + if "ZELLIJ" in $env == false { + zellij + exit + } else { + if "IN_NIX_SHELL" in $env == false { + fastfetch + } + } + + def garbage [] { + sudo nix-collect-garbage --delete-old + sudo nixos-rebuild switch --flake /home/maxag/.nix-config + } + + def c [] { + clear fastfetch } - } - def garbage [] { - sudo nix-collect-garbage --delete-old - sudo nixos-rebuild switch --flake /home/maxag/.nix-config - } - - def c [] { - clear - fastfetch - } - - def flake [ - shell?: string - --edit (-e) - --command (-c): string - ] { - if $edit { - nvim ~/.nix-config/flakes/flake.nix - } else { - match $command { - null => {nix develop $"/home/maxag/.nix-config/flakes/#($shell)"} - _ => {nix develop $"/home/maxag/.nix-config/flakes/#($shell)" --command bash -c $"($command)"} + def flake [ + shell?: string + --edit (-e) + --command (-c): string + ] { + if $edit { + nvim ~/.nix-config/flakes/flake.nix + } else { + match $command { + null => {nix develop $"/home/maxag/.nix-config/flakes/#($shell)"} + _ => {nix develop $"/home/maxag/.nix-config/flakes/#($shell)" --command bash -c $"($command)"} + } } } - } - def edit [file: path] { - match ($file | path parse | get extension) { - "rs" => { - flake rust -c $"nvim ($file)" + def edit [file: path] { + match ($file | path parse | get extension) { + "rs" => { + flake rust -c $"nvim ($file)" + } + "zig" => { + flake zig -c $"nvim ($file)" + } + "c" | "cpp" => { + flake c -c $"nvim ($file)" + } + "cs" => { + flake c-sharp -c $"nvim ($file)" + } + _ => {nvim $file} } - "zig" => { - flake zig -c $"nvim ($file)" - } - "c" | "cpp" => { - flake c -c $"nvim ($file)" - } - "cs" => { - flake c-sharp -c $"nvim ($file)" - } - _ => {nvim $file} } - } - ''; + + def rebuild [message?: string] { + cd /home/maxag/.nix-config + let commit_message = if $message != null {$message} else {"non important commit"} + git add . + git commit -m $commit_message + + sudo nixos-rebuild switch --flake . + } + ''; settings = { show_banner = false; @@ -77,10 +90,9 @@ shellAliases = { zel = "zellij"; - rebuild = "sudo nixos-rebuild switch --flake /home/maxag/.nix-config"; system = "nvim /home/maxag/.nix-config/flake.nix"; - home = "nvim /home/maxag/.nix-config/home/${name}/home.nix"; - config = "nvim /home/maxag/.nix-config/configuration/${name}/configuration.nix"; + home = "nvim /home/maxag/.nix-config/home/${device-name}/home.nix"; + config = "nvim /home/maxag/.nix-config/configuration/${device-name}/configuration.nix"; cat = "bat -p -P"; nvim = "edit"; nix-shell = "nix-shell --run nu";