diff --git a/flake.nix b/flake.nix index fd03e38..37dafc1 100644 --- a/flake.nix +++ b/flake.nix @@ -21,17 +21,17 @@ flake = { homeConfigurations = let - userConfig = extraModules: + userConfig = system: extraModules: inputs.home-manager.lib.homeManagerConfiguration { - pkgs = inputs.nixpkgs; - modules = extraModules; + extraSpecialArgs = { inherit inputs; }; + pkgs = inputs.nixpkgs.legacyPackages.${system}; + modules = [ ./hmModules ] ++ extraModules; }; in { - "pan@juri" = userConfig [ ./users/juri ]; - "pan@jibril" = userConfig [ ./users/jibril ]; - "pan@onizuka" = userConfig [ ./users/onizuka ]; + "pan@juri" = userConfig "x86_64-linux" [ ./users/juri ]; + "pan@jibril" = userConfig "x86_64-linux" [ ./users/jibril ]; + "pan@onizuka" = userConfig "x86_64-linux" [ ./users/onizuka ]; }; - homeModules = { my-modules = ./hmModules; }; }; }; diff --git a/hmModules/apps/hypr/app.nix b/hmModules/apps/hypr/app.nix index 85e7b6f..8bdc848 100644 --- a/hmModules/apps/hypr/app.nix +++ b/hmModules/apps/hypr/app.nix @@ -1,5 +1,5 @@ -{ config, inputs, pkgs, lib, ... }: -let rootPath = ./.; in +{ config, lib, ... }: +# let rootPath = ./.; in { options.hypr = { enable = lib.mkEnableOption "Enables hyprland"; @@ -34,220 +34,224 @@ let rootPath = ./.; in polkit.enable = lib.mkEnableOption "Enables polkit agent"; screenshot.enable = lib.mkEnableOption "Enables Screenshotting"; }; + + config.warnings = lib.mkIf config.hypr.enable ['' + hypr.* has been deprecated to allow the removal of hyprland from flake inputs. + '']; - imports = [ inputs.hyprland.homeManagerModules.default ]; + # imports = [ inputs.hyprland.homeManagerModules.default ]; - config = let - lopts = lib.lists.optionals; - in { - nix.settings = { - substituters = ["https://hyprland.cachix.org"]; - trusted-public-keys = ["hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="]; - }; - } // lib.mkIf config.hypr.enable { - wayland.windowManager.hyprland = let - mod = config.hypr.mod_key; - # p-s = let - # chw = config.hypr.workspace; - # findDefaultWs = id: if (builtins.hasAttr id chw.workspaces) - # then (builtins.head (builtins.getAttr id chw.workspaces)) - # else ""; - # in with config.hypr.workspace; lib.mkIf primary-secondary.enable { - # primaryWs = findDefaultWs primary-secondary.primary; - # secondaryWs = findDefaultWs primary-secondary.secondary; - # }; - in { - enable = true; - settings = { - monitor = config.hypr.monitor.details; - workspace = let - wsMonitor = monitor: wrksps: map (ws: - if ws == (builtins.head wrksps) - then "name:"+ws+", monitor:"+monitor+", persistent:true, default:true" - else "name:"+ws+", monitor:"+monitor+", persistent:true" - ) wrksps; - makeRules = wsAttr: builtins.concatLists (builtins.attrValues ( - builtins.mapAttrs wsMonitor wsAttr - )); - in makeRules config.hypr.workspace.workspaces - ++ [ - "w[t1], gapsout:0, gapsin:0" - "w[tg1], gapsout:0, gapsin:0" - "f[1], gapsout:0, gapsin:0" - ] - ++ lopts config.hypr.workspace.scratchpad.enable [ - "special:scratch, on-created-empty: [float; size 50% 50%; center] ${config.defaultApps.terminal}" - ]; - input = { - accel_profile = "flat"; - sensitivity = config.hypr.mouse.sensitivity; - }; - general = { - gaps_in = 3; - gaps_out = 3; - border_size = 2; - "col.active_border" = "rgb(F5C2E7)"; - "col.inactive_border" = "rgb(1E1D2F)"; - layout = "master"; - }; - decoration = { - rounding = 2; - blur = { - enabled = true; - size = 12; - passes = 2; - special = true; - }; - }; - animation = [ - "windows, 1, 4, default, popin 50%" - "windowsOut, 1, 4, default, popin 50%" - "windowsMove, 1, 3, default" - "border, 1, 3, default" - "fade, 1, 3, default" - "workspaces, 1, 3, default" - ]; - master = { - mfact = config.hypr.master.mfact; - }; - misc = { - focus_on_activate = true; - }; - - exec-once = lopts config.hypr.polkit.enable [ - "${pkgs.kdePackages.polkit-kde-agent-1}/bin/libexec/polkit-kde-authentication-agent-1" - ] ++ lopts config.hypr.background.enable [ - "${pkgs.swww}/bin/swww-daemon" - "${pkgs.swww}/bin/swww img ${config.hypr.background.path}" - ] ++ lopts config.ags.enable [ - "ags" - ] ++ lopts config.beeper.enable [ - "[workspace name:chat silent] Beeper" - ]; - - env = with config.hypr; [ - # "HYPR_MON_PRIMARY, ${workspace.primary-secondary.primary}" - # "HYPR_MON_SECONDARY, ${workspace.primary-secondary.secondary}" - "HYPR_WORK_DB, ${config.xdg.cacheHome}/hypr/workspace.db" - ] ++ lopts cursor.enable [ - "HYPRCURSOR_THEME,${cursor.theme}" - "HYPRCURSOR_SIZE,${cursor.size}" - ] ++ lopts config.nvidia.enable [ - "LIBVA_DRIVER_NAME,nvidia" - "XDG_SESSION_TYPE,wayland" - "GBM_BACKEND,nvidia-drm" - "__GLX_VENDOR_LIBRARY_NAME,nvidia" - "WLR_RENDERER_ALLOW_SOFTWARE,1" - "WLR_DRM_DEVICES,/dev/dri/card1" - ]; - - windowrulev2 = let - workspaceDefaults = wsname: applist: map ( - app: "workspace " + wsname + ", " + app - ) applist; - allDefault = wsAttr: builtins.concatLists (builtins.attrValues ( - builtins.mapAttrs workspaceDefaults wsAttr - )); - in allDefault config.hypr.workspace.defaults - ++ [ - "bordersize 0, floating:0, onworkspace:w[t1]" - "rounding 0, floating:0, onworkspace:w[t1]" - "bordersize 0, floating:0, onworkspace:w[tg1]" - "rounding 0, floating:0, onworkspace:w[tg1]" - "bordersize 0, floating:0, onworkspace:f[1]" - "rounding 0, floating:0, onworkspace:f[1]" - ] - ++ lopts config.hypr.xwayland.videobridge.enable [ - "opacity 0.0 override 0.0 override,class:^(xwaylandvideobridge)$" - "noanim,class:^(xwaylandvideobridge)$" - "noinitialfocus,class:^(xwaylandvideobridge)$" - "maxsize 1 1,class:^(xwaylandvideobridge)$" - "noblur,class:^(xwaylandvideobridge)$" - ] ++ map (id: "opacity 1 override, " + id) config.hypr.windows.opaque - ++ [ - "opacity 0.94 fullscreen:0" - "opacity 0.79 override, class:^(${config.defaultApps.terminal})$" - ]; - - # 1, exec, $XDG_CONFIG_HOME/hypr/scripts/changeprimary.xsh home - # 2, exec, $XDG_CONFIG_HOME/hypr/scripts/changeprimary.xsh web - # 3, exec, $XDG_CONFIG_HOME/hypr/scripts/changeprimary.xsh med - # 4, exec, $XDG_CONFIG_HOME/hypr/scripts/changeprimary.xsh game - # 5, exec, $XDG_CONFIG_HOME/hypr/scripts/changeprimary.xsh etc - # _, exec, $XDG_CONFIG_HOME/hypr/scripts/changeprimary.xsh hell - # TAB, exec, $XDG_CONFIG_HOME/hypr/scripts/changesecondary.xsh - # - # SHIFT, 1, movetoworkspacesilent, name:home - # SHIFT, 2, movetoworkspacesilent, name:web - # SHIFT, 3, movetoworkspacesilent, name:med - # SHIFT, 4, movetoworkspacesilent, name:game - # SHIFT, TAB, movetoworkspacesilent, r-1 - - bind = let - modPrefix = kb: if (lib.strings.hasPrefix "&" kb) - then ("${mod}" + kb) - else ("${mod}, " + kb); - in map modPrefix ([ - "Return, exec, ${config.defaultApps.terminal}" - "&SHIFT, Q, exit" - "h, focusmonitor, l" - "l, focusmonitor, r" - "j, cyclenext," - "k, cyclenext, prev" - "&SHIFT, h, movecurrentworkspacetomonitor, -1" - "&SHIFT, l, movecurrentworkspacetomonitor, +1" - "&SHIFT, j, swapnext," - "&SHIFT, k, swapnext, prev" - "c, killactive" - "f, togglefloating" - "&SHIFT, f, fullscreen" - ] ++ (let - workspaces = builtins.concatLists ( - builtins.attrValues config.hypr.workspace.workspaces); - wsBinds = with builtins; wrksps: depth: if depth > (length wrksps) - then [] - else let ws = builtins.elemAt wrksps (depth -1); in [ - "${toString depth}, workspace, name:${ws}" - "&SHIFT, ${toString depth}, movetoworkspacesilent, name:${ws}" - ] ++ wsBinds wrksps (depth + 1); - in wsBinds workspaces 1) ++ lopts config.rofi.enable [ - "&SHIFT, return, exec, ${pkgs.rofi}/bin/rofi -show run" - ] ++ lopts config.hypr.screenshot.enable [ - "P, exec, ${pkgs.grimblast}/bin/grimblast --freeze copy area" - "&SHIFT, P, exec, ${pkgs.grimblast}/bin/grimblast --freeze copysave area" - ] ++ lopts config.hypr.workspace.scratchpad.enable [ - "i, togglespecialworkspace, scratch" - ]); - - bindm = map (kb: "${mod}, " + kb) [ - "mouse:272, movewindow" - "mouse:273, movewindow" - ]; - }; - }; - - home.packages = with pkgs; [ - wlr-randr # Xrandr for wayland - wl-clipboard # Clipboard manager for wayland - ] ++ lopts config.hypr.xwayland.videobridge.enable [ - kdePackages.xwaylandvideobridge - ] ++ lopts config.hypr.cursor.enable [ - hyprcursor - ] ++ lopts config.hypr.screenshot.enable [ - hyprpicker # Colorpicker, needed for screenshot tool - inputs.hyprland-contrib.packages.${pkgs.system}.grimblast - ]; - - xdg.configFile."hypr-scripts" = { - source = rootPath + "/scripts"; - target = "hypr/scripts"; - executable = true; - }; - - xdg.dataFile."hypr-icons" = lib.mkIf config.hypr.cursor.enable { - source = rootPath + "/icons"; - target = "icons/"; - recursive = true; - }; - }; + # config = let + # lopts = lib.lists.optionals; + # in { + # nix.settings = { + # substituters = ["https://hyprland.cachix.org"]; + # trusted-public-keys = ["hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="]; + # }; + # } // lib.mkIf config.hypr.enable { + # wayland.windowManager.hyprland = let + # mod = config.hypr.mod_key; + # # p-s = let + # # chw = config.hypr.workspace; + # # findDefaultWs = id: if (builtins.hasAttr id chw.workspaces) + # # then (builtins.head (builtins.getAttr id chw.workspaces)) + # # else ""; + # # in with config.hypr.workspace; lib.mkIf primary-secondary.enable { + # # primaryWs = findDefaultWs primary-secondary.primary; + # # secondaryWs = findDefaultWs primary-secondary.secondary; + # # }; + # in { + # enable = true; + # settings = { + # monitor = config.hypr.monitor.details; + # workspace = let + # wsMonitor = monitor: wrksps: map (ws: + # if ws == (builtins.head wrksps) + # then "name:"+ws+", monitor:"+monitor+", persistent:true, default:true" + # else "name:"+ws+", monitor:"+monitor+", persistent:true" + # ) wrksps; + # makeRules = wsAttr: builtins.concatLists (builtins.attrValues ( + # builtins.mapAttrs wsMonitor wsAttr + # )); + # in makeRules config.hypr.workspace.workspaces + # ++ [ + # "w[t1], gapsout:0, gapsin:0" + # "w[tg1], gapsout:0, gapsin:0" + # "f[1], gapsout:0, gapsin:0" + # ] + # ++ lopts config.hypr.workspace.scratchpad.enable [ + # "special:scratch, on-created-empty: [float; size 50% 50%; center] ${config.defaultApps.terminal}" + # ]; + # input = { + # accel_profile = "flat"; + # sensitivity = config.hypr.mouse.sensitivity; + # }; + # general = { + # gaps_in = 3; + # gaps_out = 3; + # border_size = 2; + # "col.active_border" = "rgb(F5C2E7)"; + # "col.inactive_border" = "rgb(1E1D2F)"; + # layout = "master"; + # }; + # decoration = { + # rounding = 2; + # blur = { + # enabled = true; + # size = 12; + # passes = 2; + # special = true; + # }; + # }; + # animation = [ + # "windows, 1, 4, default, popin 50%" + # "windowsOut, 1, 4, default, popin 50%" + # "windowsMove, 1, 3, default" + # "border, 1, 3, default" + # "fade, 1, 3, default" + # "workspaces, 1, 3, default" + # ]; + # master = { + # mfact = config.hypr.master.mfact; + # }; + # misc = { + # focus_on_activate = true; + # }; + # + # exec-once = lopts config.hypr.polkit.enable [ + # "${pkgs.kdePackages.polkit-kde-agent-1}/bin/libexec/polkit-kde-authentication-agent-1" + # ] ++ lopts config.hypr.background.enable [ + # "${pkgs.swww}/bin/swww-daemon" + # "${pkgs.swww}/bin/swww img ${config.hypr.background.path}" + # ] ++ lopts config.ags.enable [ + # "ags" + # ] ++ lopts config.beeper.enable [ + # "[workspace name:chat silent] Beeper" + # ]; + # + # env = with config.hypr; [ + # # "HYPR_MON_PRIMARY, ${workspace.primary-secondary.primary}" + # # "HYPR_MON_SECONDARY, ${workspace.primary-secondary.secondary}" + # "HYPR_WORK_DB, ${config.xdg.cacheHome}/hypr/workspace.db" + # ] ++ lopts cursor.enable [ + # "HYPRCURSOR_THEME,${cursor.theme}" + # "HYPRCURSOR_SIZE,${cursor.size}" + # ] ++ lopts config.nvidia.enable [ + # "LIBVA_DRIVER_NAME,nvidia" + # "XDG_SESSION_TYPE,wayland" + # "GBM_BACKEND,nvidia-drm" + # "__GLX_VENDOR_LIBRARY_NAME,nvidia" + # "WLR_RENDERER_ALLOW_SOFTWARE,1" + # "WLR_DRM_DEVICES,/dev/dri/card1" + # ]; + # + # windowrulev2 = let + # workspaceDefaults = wsname: applist: map ( + # app: "workspace " + wsname + ", " + app + # ) applist; + # allDefault = wsAttr: builtins.concatLists (builtins.attrValues ( + # builtins.mapAttrs workspaceDefaults wsAttr + # )); + # in allDefault config.hypr.workspace.defaults + # ++ [ + # "bordersize 0, floating:0, onworkspace:w[t1]" + # "rounding 0, floating:0, onworkspace:w[t1]" + # "bordersize 0, floating:0, onworkspace:w[tg1]" + # "rounding 0, floating:0, onworkspace:w[tg1]" + # "bordersize 0, floating:0, onworkspace:f[1]" + # "rounding 0, floating:0, onworkspace:f[1]" + # ] + # ++ lopts config.hypr.xwayland.videobridge.enable [ + # "opacity 0.0 override 0.0 override,class:^(xwaylandvideobridge)$" + # "noanim,class:^(xwaylandvideobridge)$" + # "noinitialfocus,class:^(xwaylandvideobridge)$" + # "maxsize 1 1,class:^(xwaylandvideobridge)$" + # "noblur,class:^(xwaylandvideobridge)$" + # ] ++ map (id: "opacity 1 override, " + id) config.hypr.windows.opaque + # ++ [ + # "opacity 0.94 fullscreen:0" + # "opacity 0.79 override, class:^(${config.defaultApps.terminal})$" + # ]; + # + # # 1, exec, $XDG_CONFIG_HOME/hypr/scripts/changeprimary.xsh home + # # 2, exec, $XDG_CONFIG_HOME/hypr/scripts/changeprimary.xsh web + # # 3, exec, $XDG_CONFIG_HOME/hypr/scripts/changeprimary.xsh med + # # 4, exec, $XDG_CONFIG_HOME/hypr/scripts/changeprimary.xsh game + # # 5, exec, $XDG_CONFIG_HOME/hypr/scripts/changeprimary.xsh etc + # # _, exec, $XDG_CONFIG_HOME/hypr/scripts/changeprimary.xsh hell + # # TAB, exec, $XDG_CONFIG_HOME/hypr/scripts/changesecondary.xsh + # # + # # SHIFT, 1, movetoworkspacesilent, name:home + # # SHIFT, 2, movetoworkspacesilent, name:web + # # SHIFT, 3, movetoworkspacesilent, name:med + # # SHIFT, 4, movetoworkspacesilent, name:game + # # SHIFT, TAB, movetoworkspacesilent, r-1 + # + # bind = let + # modPrefix = kb: if (lib.strings.hasPrefix "&" kb) + # then ("${mod}" + kb) + # else ("${mod}, " + kb); + # in map modPrefix ([ + # "Return, exec, ${config.defaultApps.terminal}" + # "&SHIFT, Q, exit" + # "h, focusmonitor, l" + # "l, focusmonitor, r" + # "j, cyclenext," + # "k, cyclenext, prev" + # "&SHIFT, h, movecurrentworkspacetomonitor, -1" + # "&SHIFT, l, movecurrentworkspacetomonitor, +1" + # "&SHIFT, j, swapnext," + # "&SHIFT, k, swapnext, prev" + # "c, killactive" + # "f, togglefloating" + # "&SHIFT, f, fullscreen" + # ] ++ (let + # workspaces = builtins.concatLists ( + # builtins.attrValues config.hypr.workspace.workspaces); + # wsBinds = with builtins; wrksps: depth: if depth > (length wrksps) + # then [] + # else let ws = builtins.elemAt wrksps (depth -1); in [ + # "${toString depth}, workspace, name:${ws}" + # "&SHIFT, ${toString depth}, movetoworkspacesilent, name:${ws}" + # ] ++ wsBinds wrksps (depth + 1); + # in wsBinds workspaces 1) ++ lopts config.rofi.enable [ + # "&SHIFT, return, exec, ${pkgs.rofi}/bin/rofi -show run" + # ] ++ lopts config.hypr.screenshot.enable [ + # "P, exec, ${pkgs.grimblast}/bin/grimblast --freeze copy area" + # "&SHIFT, P, exec, ${pkgs.grimblast}/bin/grimblast --freeze copysave area" + # ] ++ lopts config.hypr.workspace.scratchpad.enable [ + # "i, togglespecialworkspace, scratch" + # ]); + # + # bindm = map (kb: "${mod}, " + kb) [ + # "mouse:272, movewindow" + # "mouse:273, movewindow" + # ]; + # }; + # }; + # + # home.packages = with pkgs; [ + # wlr-randr # Xrandr for wayland + # wl-clipboard # Clipboard manager for wayland + # ] ++ lopts config.hypr.xwayland.videobridge.enable [ + # kdePackages.xwaylandvideobridge + # ] ++ lopts config.hypr.cursor.enable [ + # hyprcursor + # ] ++ lopts config.hypr.screenshot.enable [ + # hyprpicker # Colorpicker, needed for screenshot tool + # inputs.hyprland-contrib.packages.${pkgs.system}.grimblast + # ]; + # + # xdg.configFile."hypr-scripts" = { + # source = rootPath + "/scripts"; + # target = "hypr/scripts"; + # executable = true; + # }; + # + # xdg.dataFile."hypr-icons" = lib.mkIf config.hypr.cursor.enable { + # source = rootPath + "/icons"; + # target = "icons/"; + # recursive = true; + # }; + # }; } diff --git a/hmModules/apps/lf/app.nix b/hmModules/apps/lf/app.nix index f4ff3da..ecc428e 100644 --- a/hmModules/apps/lf/app.nix +++ b/hmModules/apps/lf/app.nix @@ -33,7 +33,7 @@ relativenumber = true; }; commands = { - dragon-out = ''%${pkgs.xdragon}/bin/xdragon -a -x "$fx"''; + dragon-out = ''%${pkgs.dragon-drop}/bin/dragon-drop -a -x "$fx"''; trash = lib.mkIf config.trash.enable '' %${pkgs.trash-cli}/bin/trash "$fx" ''; diff --git a/hmModules/automatic/default.nix b/hmModules/automatic/default.nix index f974b21..18c78ef 100644 --- a/hmModules/automatic/default.nix +++ b/hmModules/automatic/default.nix @@ -1,4 +1,4 @@ -{ config, lib, usernameAtHostname, ... }: +{ config, lib, ... }: { options = { @@ -9,17 +9,15 @@ browser = lib.mkOption { default = ""; }; }; }; - config = let - st = lib.strings; - in { + config = { # Let Home Manager install and manage itself. programs.home-manager.enable = true; nixpkgs.config.allowUnfree = true; home.stateVersion = "23.05"; home = { - username = builtins.elemAt (st.splitString "@" usernameAtHostname) 0; - homeDirectory = "/home/" + config.home.username; + username = "pan"; + homeDirectory = "/home/pan"; packages = config.extraPkgs; }; diff --git a/hmModules/services/widgets/ags/default.nix b/hmModules/services/widgets/ags/default.nix index 5d248d1..5403b1e 100644 --- a/hmModules/services/widgets/ags/default.nix +++ b/hmModules/services/widgets/ags/default.nix @@ -1,25 +1,30 @@ -{ config, inputs, pkgs, lib, ... }: +{ config, lib, ... }: { options.ags = { enable = lib.mkEnableOption "Enable ags"; }; + + config.warnings = lib.mkIf config.ags.enable ['' + ags.enable has been deprecated to allow the removal of ags from flake + inputs. + '']; - imports = [ inputs.ags.homeManagerModules.default ]; + # imports = [ inputs.ags.homeManagerModules.default ]; - config = lib.mkIf config.ags.enable { - home.packages = with pkgs; [ - libnotify # Notifications through ags - ]; - programs.ags = { - enable = true; - configDir = ./config; - - extraPackages = with pkgs; [ - gtksourceview - webkitgtk - accountsservice - ]; - }; - }; + # config = lib.mkIf config.ags.enable { + # home.packages = with pkgs; [ + # libnotify # Notifications through ags + # ]; + # programs.ags = { + # enable = true; + # configDir = ./config; + # + # extraPackages = with pkgs; [ + # gtksourceview + # webkitgtk + # accountsservice + # ]; + # }; + # }; }