diff --git a/global/xkblayout b/global/xkblayout deleted file mode 100644 index 7df1ac3..0000000 --- a/global/xkblayout +++ /dev/null @@ -1,9 +0,0 @@ - -xkb_keycodes { - = 78; -} - -xkb_symbols { - key.type = "ALPHABETIC"; - key { [ U0108, U0109 ] }; -} diff --git a/hardware/displays.nix b/hardware/displays.nix index 8c11fa9..0007e5e 100644 --- a/hardware/displays.nix +++ b/hardware/displays.nix @@ -1,4 +1,4 @@ -{...}: { +{ displays = { enable = true; displays = { diff --git a/hardware/work.nix b/hardware/work.nix index 836ad61..c531d9b 100644 --- a/hardware/work.nix +++ b/hardware/work.nix @@ -7,7 +7,6 @@ }: { imports = [ (modulesPath + "/installer/scan/not-detected.nix") - ./displays.nix ]; boot.initrd.availableKernelModules = ["xhci_pci" "thunderbolt" "nvme" "usb_storage" "sd_mod" "sdhci_pci"]; diff --git a/hardware/zenix.nix b/hardware/zenix.nix index d8d0fc6..3e033a7 100644 --- a/hardware/zenix.nix +++ b/hardware/zenix.nix @@ -7,7 +7,6 @@ }: { imports = [ (modulesPath + "/installer/scan/not-detected.nix") - ./displays.nix ./ddc.nix (import ./g920.nix {inherit user pkgs;}) ]; diff --git a/global/home/default.nix b/home/default.nix similarity index 93% rename from global/home/default.nix rename to home/default.nix index c434756..2fe148d 100644 --- a/global/home/default.nix +++ b/home/default.nix @@ -25,28 +25,26 @@ let glow = "${pkgs.glow}/bin/glow"; ffmpegthumbnailer = "${pkgs.ffmpegthumbnailer}/bin/ffmpegthumbnailer"; }; - lf-sixel = pkgs.callPackage ../../custom/lf-sixel/. {}; + lf-sixel = pkgs.callPackage ../custom/lf-sixel/. {}; in { imports = [ - ./graphical.nix + ./modules/terminal.nix + ./modules/scripts.nix + ./modules/email.nix + ./modules/editor.nix + ./modules/mpd.nix + ./modules/menu.nix + ./modules/scripts.nix - ../../lib/scripts.nix - - ../../lib/programs/home/neovim/. - ../../lib/programs/home/git.nix - - ../../lib/modules/home/terminal.nix - ../../lib/modules/home/scripts.nix - ../../lib/modules/home/email.nix - ../../lib/modules/home/editor.nix - ../../lib/modules/home/mpd.nix - ../../lib/modules/home/menu.nix + ./programs/graphical.nix + ./programs/scripts.nix + ./programs/neovim/. + ./programs/git.nix ]; programs.home-manager.enable = true; - home.username = "tristan"; - home.homeDirectory = "/home/tristan"; + home.homeDirectory = "/home/${config.home.username}"; xdg.userDirs.enable = true; diff --git a/lib/modules/home/editor.nix b/home/modules/editor.nix similarity index 100% rename from lib/modules/home/editor.nix rename to home/modules/editor.nix diff --git a/lib/modules/home/email.nix b/home/modules/email.nix similarity index 100% rename from lib/modules/home/email.nix rename to home/modules/email.nix diff --git a/lib/modules/home/menu.nix b/home/modules/menu.nix similarity index 100% rename from lib/modules/home/menu.nix rename to home/modules/menu.nix diff --git a/lib/modules/home/mpd.nix b/home/modules/mpd.nix similarity index 100% rename from lib/modules/home/mpd.nix rename to home/modules/mpd.nix diff --git a/lib/modules/home/scripts.nix b/home/modules/scripts.nix similarity index 100% rename from lib/modules/home/scripts.nix rename to home/modules/scripts.nix diff --git a/lib/modules/home/terminal.nix b/home/modules/terminal.nix similarity index 100% rename from lib/modules/home/terminal.nix rename to home/modules/terminal.nix diff --git a/lib/programs/home/git.nix b/home/programs/git.nix similarity index 100% rename from lib/programs/home/git.nix rename to home/programs/git.nix diff --git a/global/home/graphical.nix b/home/programs/graphical.nix similarity index 100% rename from global/home/graphical.nix rename to home/programs/graphical.nix diff --git a/home/programs/hyprland.nix b/home/programs/hyprland.nix new file mode 100644 index 0000000..42a509d --- /dev/null +++ b/home/programs/hyprland.nix @@ -0,0 +1,160 @@ +{ + lib, + pkgs, + ... +}: { + imports = [ + (import ./swaylock.nix) + (import ./swayidle.nix) + ]; + xdg.portal = { + enable = true; + configPackages = [pkgs.hyprland]; + extraPortals = [pkgs.xdg-desktop-portal-hyprland pkgs.xdg-desktop-portal-gtk]; + }; + + wayland.windowManager.hyprland = { + enable = true; + systemd.enable = true; + settings = { + input = { + touchpad = { + natural_scroll = true; + scroll_factor = 0.5; + }; + }; + gestures = { + workspace_swipe = true; + workspace_swipe_numbered = true; + }; + decoration = { + rounding = 5; + drop_shadow = false; + }; + bezier = [ + "overshot, 0.05, 0.9, 0.1, 1.1" + "linear, 0.0, 0.0, 1.0, 1.0" + ]; + animations = { + enabled = true; + animation = [ + "windows, 1, 1, default, popin" + "border, 1, 1, default" + "fade, 1, 1, default" + "workspaces, 1, 3, overshot" + "borderangle,1, 50, linear, loop" + ]; + }; + bind = [ + "SUPER, h, movefocus,l" + "SUPER, l, movefocus,r" + "SUPER, j, layoutmsg,cyclenext" + "SUPER, k, layoutmsg,cycleprev" + "SUPER, space, layoutmsg,swapwithmaster master" + "SUPER, F, fullscreen," + "SUPER, V, togglefloating," + "SUPER, W, layoutmsg, orientationprev" + "SUPER_SHIFT, W, layoutmsg, orientationnext" + "SUPER_SHIFT, V, togglegroup," + "SUPER_SHIFT, h, changegroupactive,b" + "SUPER_SHIFT, h, moveintogroup,l" + "SUPER_SHIFT, l, moveintogroup,r" + "SUPER_SHIFT, l, changegroupactive,f" + "SUPER, Y, togglespecialworkspace" + "SUPER_SHIFT, Y, movetoworkspace, special" + "SUPER_SHIFT, X, killactive" + "SUPER, slash, focuswindow, brave-browser" + "SUPER, n, focuswindow, Logseq" + "SUPER, R, submap, resize" + "SUPER,1,workspace,1" + "SUPER,2,workspace,2" + "SUPER,3,workspace,3" + "SUPER,4,workspace,4" + "SUPER,5,workspace,5" + "SUPER,6,workspace,6" + "SUPER,7,workspace,7" + "SUPER,8,workspace,8" + "SUPER,9,workspace,9" + "SUPER,0,workspace,10" + "SUPER,left,workspace,r-1" + "SUPER,right,workspace,r+1" + "SUPER_SHIFT,1,movetoworkspace,1" + "SUPER_SHIFT,2,movetoworkspace,2" + "SUPER_SHIFT,3,movetoworkspace,3" + "SUPER_SHIFT,4,movetoworkspace,4" + "SUPER_SHIFT,5,movetoworkspace,5" + "SUPER_SHIFT,6,movetoworkspace,6" + "SUPER_SHIFT,7,movetoworkspace,7" + "SUPER_SHIFT,8,movetoworkspace,8" + "SUPER_SHIFT,9,movetoworkspace,9" + "SUPER_SHIFT,0,movetoworkspace,10" + ]; + bindm = [ + "SUPER, mouse:272, movewindow" + "SUPER, mouse:273, resizewindow" + ]; + env = [ + "GDK_BACKEND,wayland,x11" + "QT_QPA_PLATFORM,wayland;xcb" + "SDL_VIDEODRIVER,wayland" + "CLUTTER_BACKEND,wayland" + "XDG_CURRENT_DESKTOP,Hyprland" + "XDG_SESSION_TYPE,wayland" + "XDG_SESSION_DESKTOP,Hyprland" + "QT_AUTO_SCREEN_SCALE_FACTOR,1" + "QT_WAYLAND_DISABLE_WINDOWDECORATION,1" + "NIXOS_OZONE_WL,1" + "WLR_NO_HARDWARE_CURSORS,1" + ]; + windowrule = [ + "float, title:wlogout" + "idleinhibit always, vrmonitor" + "idleinhibit focus, steam_app" + ]; + workspace = [ + "11, default:true" + ]; + general = { + gaps_out = 10; + resize_on_border = true; + layout = "master"; + # "col.active_border" = "rgb(FFFF00) rgb(00FFFF) rgb(FF00FF)"; + border_size = lib.mkDefault 5; + }; + master = { + mfact = 0.7; + new_on_top = true; + }; + misc = { + vrr = 2; + focus_on_activate = true; + }; + }; + # https://wiki.hyprland.org/Configuring/Variables/ + extraConfig = '' + submap = resize + binde = ,right,resizeactive,10 0 + binde = ,left,resizeactive,-10 0 + binde = ,up,resizeactive,0 -10 + binde = ,down,resizeactive,0 10 + binde = ,k,resizeactive,0 -10 + binde = ,j,resizeactive,0 10 + binde = ,l,splitratio,0.05 + binde = ,h,splitratio,-0.05 + binde = SHIFT,l,splitratio,0.3 + binde = SHIFT,h,splitratio,-0.3 + + bind = , escape, submap,reset + bind = , enter, submap,reset + bind = SUPER, R, submap,reset + bind = CONTROL, C, submap,reset + submap = reset + ''; + }; + + services.mako = { + enable = true; + }; + + programs.waybar.settings.mainBar.modules-left = ["hyprland/workspaces" "hyprland/window"]; +} diff --git a/lib/programs/home/neovim/config.lua b/home/programs/neovim/config.lua similarity index 100% rename from lib/programs/home/neovim/config.lua rename to home/programs/neovim/config.lua diff --git a/lib/programs/home/neovim/default.nix b/home/programs/neovim/default.nix similarity index 100% rename from lib/programs/home/neovim/default.nix rename to home/programs/neovim/default.nix diff --git a/lib/programs/home/neovim/lspconfig.lua b/home/programs/neovim/lspconfig.lua similarity index 100% rename from lib/programs/home/neovim/lspconfig.lua rename to home/programs/neovim/lspconfig.lua diff --git a/lib/scripts.nix b/home/programs/scripts.nix similarity index 100% rename from lib/scripts.nix rename to home/programs/scripts.nix diff --git a/lib/programs/home/swayidle.nix b/home/programs/swayidle.nix similarity index 100% rename from lib/programs/home/swayidle.nix rename to home/programs/swayidle.nix diff --git a/lib/programs/home/swaylock.nix b/home/programs/swaylock.nix similarity index 100% rename from lib/programs/home/swaylock.nix rename to home/programs/swaylock.nix diff --git a/lib/programs/home/waybar.nix b/home/programs/waybar.nix similarity index 100% rename from lib/programs/home/waybar.nix rename to home/programs/waybar.nix diff --git a/lib/mkconf.nix b/lib/mkconf.nix index 492212d..81dc28a 100644 --- a/lib/mkconf.nix +++ b/lib/mkconf.nix @@ -25,28 +25,19 @@ nixpkgs.lib.nixosSystem { { home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; + home-manager.users.${user}.imports = [ + ../home/. + { + options.home.userFullname = nixpkgs.lib.mkOption {default = userName;}; + config.home.username = user; + } + ]; } { imports = [ - (import ./modules/gamer.nix {inherit user;}) - - (import ./modules/keyboard.nix {inherit user;}) - (import ./modules/display.nix {inherit user;}) - (import ./modules/work.nix {inherit user;}) - (import ./modules/laptop.nix {inherit user;}) - (import ./modules/personal.nix {inherit user;}) - (import ./programs/hyprland.nix {inherit user;}) (import ../hardware/${name}.nix {inherit user;}) - (import ../global/system.nix user) + (import ../nixos/. user) ]; - - home-manager.users.${user}.imports = [ - ../global/home/. - { - options.home.userFullname = nixpkgs.lib.mkOption { default = userName; }; - } - ]; - roles.work.enable = work; roles.personal.enable = !work; } diff --git a/lib/programs/hyprland.nix b/lib/programs/hyprland.nix deleted file mode 100644 index 10a130c..0000000 --- a/lib/programs/hyprland.nix +++ /dev/null @@ -1,173 +0,0 @@ -{user}: { - lib, - pkgs, - ... -}: { - services.greetd = { - enable = true; - settings = rec { - hypr_session = { - command = "Hyprland"; - user = user; - }; - default_session = hypr_session; - }; - }; - - home-manager.users.${user}.imports = [ - (import ./home/swaylock.nix) - (import ./home/swayidle.nix) - { - xdg.portal = { - enable = true; - configPackages = [pkgs.hyprland]; - extraPortals = [pkgs.xdg-desktop-portal-hyprland pkgs.xdg-desktop-portal-gtk]; - }; - - wayland.windowManager.hyprland = { - enable = true; - systemd.enable = true; - settings = { - input = { - touchpad = { - natural_scroll = true; - scroll_factor = 0.5; - }; - }; - gestures = { - workspace_swipe = true; - workspace_swipe_numbered = true; - }; - decoration = { - rounding = 5; - drop_shadow = false; - }; - bezier = [ - "overshot, 0.05, 0.9, 0.1, 1.1" - "linear, 0.0, 0.0, 1.0, 1.0" - ]; - animations = { - enabled = true; - animation = [ - "windows, 1, 1, default, popin" - "border, 1, 1, default" - "fade, 1, 1, default" - "workspaces, 1, 3, overshot" - "borderangle,1, 50, linear, loop" - ]; - }; - bind = [ - "SUPER, h, movefocus,l" - "SUPER, l, movefocus,r" - "SUPER, j, layoutmsg,cyclenext" - "SUPER, k, layoutmsg,cycleprev" - "SUPER, space, layoutmsg,swapwithmaster master" - "SUPER, F, fullscreen," - "SUPER, V, togglefloating," - "SUPER, W, layoutmsg, orientationprev" - "SUPER_SHIFT, W, layoutmsg, orientationnext" - "SUPER_SHIFT, V, togglegroup," - "SUPER_SHIFT, h, changegroupactive,b" - "SUPER_SHIFT, h, moveintogroup,l" - "SUPER_SHIFT, l, moveintogroup,r" - "SUPER_SHIFT, l, changegroupactive,f" - "SUPER, Y, togglespecialworkspace" - "SUPER_SHIFT, Y, movetoworkspace, special" - "SUPER_SHIFT, X, killactive" - "SUPER, slash, focuswindow, brave-browser" - "SUPER, n, focuswindow, Logseq" - "SUPER, R, submap, resize" - "SUPER,1,workspace,1" - "SUPER,2,workspace,2" - "SUPER,3,workspace,3" - "SUPER,4,workspace,4" - "SUPER,5,workspace,5" - "SUPER,6,workspace,6" - "SUPER,7,workspace,7" - "SUPER,8,workspace,8" - "SUPER,9,workspace,9" - "SUPER,0,workspace,10" - "SUPER,left,workspace,r-1" - "SUPER,right,workspace,r+1" - "SUPER_SHIFT,1,movetoworkspace,1" - "SUPER_SHIFT,2,movetoworkspace,2" - "SUPER_SHIFT,3,movetoworkspace,3" - "SUPER_SHIFT,4,movetoworkspace,4" - "SUPER_SHIFT,5,movetoworkspace,5" - "SUPER_SHIFT,6,movetoworkspace,6" - "SUPER_SHIFT,7,movetoworkspace,7" - "SUPER_SHIFT,8,movetoworkspace,8" - "SUPER_SHIFT,9,movetoworkspace,9" - "SUPER_SHIFT,0,movetoworkspace,10" - ]; - bindm = [ - "SUPER, mouse:272, movewindow" - "SUPER, mouse:273, resizewindow" - ]; - env = [ - "GDK_BACKEND,wayland,x11" - "QT_QPA_PLATFORM,wayland;xcb" - "SDL_VIDEODRIVER,wayland" - "CLUTTER_BACKEND,wayland" - "XDG_CURRENT_DESKTOP,Hyprland" - "XDG_SESSION_TYPE,wayland" - "XDG_SESSION_DESKTOP,Hyprland" - "QT_AUTO_SCREEN_SCALE_FACTOR,1" - "QT_WAYLAND_DISABLE_WINDOWDECORATION,1" - "NIXOS_OZONE_WL,1" - "WLR_NO_HARDWARE_CURSORS,1" - ]; - windowrule = [ - "float, title:wlogout" - "idleinhibit always, vrmonitor" - "idleinhibit focus, steam_app" - ]; - workspace = [ - "11, default:true" - ]; - general = { - gaps_out = 10; - resize_on_border = true; - layout = "master"; - # "col.active_border" = "rgb(FFFF00) rgb(00FFFF) rgb(FF00FF)"; - border_size = lib.mkDefault 5; - }; - master = { - mfact = 0.7; - new_on_top = true; - }; - misc = { - vrr = 2; - focus_on_activate = true; - }; - }; - # https://wiki.hyprland.org/Configuring/Variables/ - extraConfig = '' - submap = resize - binde = ,right,resizeactive,10 0 - binde = ,left,resizeactive,-10 0 - binde = ,up,resizeactive,0 -10 - binde = ,down,resizeactive,0 10 - binde = ,k,resizeactive,0 -10 - binde = ,j,resizeactive,0 10 - binde = ,l,splitratio,0.05 - binde = ,h,splitratio,-0.05 - binde = SHIFT,l,splitratio,0.3 - binde = SHIFT,h,splitratio,-0.3 - - bind = , escape, submap,reset - bind = , enter, submap,reset - bind = SUPER, R, submap,reset - bind = CONTROL, C, submap,reset - submap = reset - ''; - }; - - services.mako = { - enable = true; - }; - - programs.waybar.settings.mainBar.modules-left = ["hyprland/workspaces" "hyprland/window"]; - } - ]; -} diff --git a/global/system.nix b/nixos/default.nix similarity index 90% rename from global/system.nix rename to nixos/default.nix index 9f8854f..89a91af 100644 --- a/global/system.nix +++ b/nixos/default.nix @@ -6,6 +6,17 @@ user: { lib, ... }: { + imports = [ + (import ./modules/gamer.nix {inherit user;}) + (import ./modules/keyboard.nix {inherit user;}) + (import ./modules/display.nix {inherit user;}) + (import ./modules/work.nix {inherit user;}) + (import ./modules/laptop.nix {inherit user;}) + (import ./modules/personal.nix {inherit user;}) + (import ./programs/hyprland.nix {inherit user;}) + ../hardware/displays.nix + ]; + nix = { settings = { experimental-features = ["nix-command" "flakes"]; diff --git a/lib/modules/display.nix b/nixos/modules/display.nix similarity index 100% rename from lib/modules/display.nix rename to nixos/modules/display.nix diff --git a/lib/modules/gamer.nix b/nixos/modules/gamer.nix similarity index 100% rename from lib/modules/gamer.nix rename to nixos/modules/gamer.nix diff --git a/lib/modules/keyboard.nix b/nixos/modules/keyboard.nix similarity index 100% rename from lib/modules/keyboard.nix rename to nixos/modules/keyboard.nix diff --git a/lib/modules/laptop.nix b/nixos/modules/laptop.nix similarity index 100% rename from lib/modules/laptop.nix rename to nixos/modules/laptop.nix diff --git a/lib/modules/personal.nix b/nixos/modules/personal.nix similarity index 100% rename from lib/modules/personal.nix rename to nixos/modules/personal.nix diff --git a/lib/modules/wayland.nix b/nixos/modules/wayland.nix similarity index 100% rename from lib/modules/wayland.nix rename to nixos/modules/wayland.nix diff --git a/lib/modules/work.nix b/nixos/modules/work.nix similarity index 96% rename from lib/modules/work.nix rename to nixos/modules/work.nix index 68eca8d..6d0701e 100644 --- a/lib/modules/work.nix +++ b/nixos/modules/work.nix @@ -30,13 +30,13 @@ with lib; { minikube kubernetes-helm thunderbird - (import ../mkapp.nix "slack" { + (import ../../lib/mkapp.nix "slack" { inherit pkgs; desktopName = "Slack"; app-id = "mpagibdhafmlkgpemeicgogjnhclenoc"; browser = "${brave}/opt/brave.com/brave/brave-browser"; }) - (import ../mkapp.nix "teams" { + (import ../../lib/mkapp.nix "teams" { inherit pkgs; browser = "${brave}/opt/brave.com/brave/brave-browser"; app-id = "cifhbcnohmdccbgoicgdjpfamggdegmo"; diff --git a/nixos/programs/hyprland.nix b/nixos/programs/hyprland.nix new file mode 100644 index 0000000..45e81e8 --- /dev/null +++ b/nixos/programs/hyprland.nix @@ -0,0 +1,18 @@ +{user}: { + lib, + pkgs, + ... +}: { + services.greetd = { + enable = true; + settings = rec { + hypr_session = { + command = "Hyprland"; + user = user; + }; + default_session = hypr_session; + }; + }; + + home-manager.users.${user}.imports = [../../home/programs/hyprland.nix]; +} diff --git a/lib/programs/sway.nix b/nixos/programs/sway.nix similarity index 100% rename from lib/programs/sway.nix rename to nixos/programs/sway.nix