temporarily return home-manger, working hyprland module
This commit is contained in:
parent
eead8facb0
commit
fbb93a59d4
10 changed files with 406 additions and 200 deletions
23
flake.lock
generated
23
flake.lock
generated
|
@ -279,6 +279,26 @@
|
|||
}
|
||||
},
|
||||
"home-manager": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1730633670,
|
||||
"narHash": "sha256-ZFJqIXpvVKvzOVFKWNRDyIyAo+GYdmEPaYi1bZB6uf0=",
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"rev": "8f6ca7855d409aeebe2a582c6fd6b6a8d0bf5661",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"home-manager_2": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"schizofox",
|
||||
|
@ -729,6 +749,7 @@
|
|||
"root": {
|
||||
"inputs": {
|
||||
"helix": "helix",
|
||||
"home-manager": "home-manager",
|
||||
"hyprland": "hyprland",
|
||||
"hyprland-plugins": "hyprland-plugins",
|
||||
"hyprsplit": "hyprsplit",
|
||||
|
@ -766,7 +787,7 @@
|
|||
"inputs": {
|
||||
"flake-compat": "flake-compat_2",
|
||||
"flake-parts": "flake-parts",
|
||||
"home-manager": "home-manager",
|
||||
"home-manager": "home-manager_2",
|
||||
"nixpak": "nixpak",
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
|
|
|
@ -30,6 +30,10 @@
|
|||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
home-manager = {
|
||||
url = "github:nix-community/home-manager";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
# Hyprland, my main compositor
|
||||
hyprland.url = "github:hyprwm/Hyprland";
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
_: {
|
||||
imports = [
|
||||
# ./home-manager.nix
|
||||
./home-manager.nix
|
||||
./system.nix
|
||||
./xdg.nix
|
||||
./git.nix
|
||||
|
|
|
@ -4,10 +4,9 @@
|
|||
...
|
||||
}: let
|
||||
cfg = config.modules.usrEnv.desktops.hyprland;
|
||||
inherit (config.modules.other.system) username;
|
||||
inherit (builtins) map genList toString;
|
||||
in {
|
||||
home-manager.users.${username}.wayland.windowManager.hyprland.settings = {
|
||||
programs.hyprland.settings = {
|
||||
# Keybinds
|
||||
bind =
|
||||
# workspaces
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
{config, ...}: let
|
||||
inherit (config.modules.other.system) username;
|
||||
in {
|
||||
home-manager.users.${username} = {
|
||||
wayland.windowManager.hyprland.settings = {
|
||||
programs.hyprland.settings = {
|
||||
#Decoration settings
|
||||
decoration = {
|
||||
rounding = 0;
|
||||
|
@ -66,5 +65,4 @@ in {
|
|||
"float, class:^(org.keepassxc.KeePassXC)$"
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -3,12 +3,10 @@
|
|||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit (config.modules.other.system) username;
|
||||
inherit (config.modules.style) cursor;
|
||||
inherit (builtins) toString;
|
||||
in {
|
||||
home-manager.users.${username} = {
|
||||
wayland.windowManager.hyprland.settings = {
|
||||
programs.hyprland.settings = {
|
||||
# Hyprland settings
|
||||
# Programs which get executed at Hyprland start.
|
||||
exec-once = [
|
||||
|
@ -30,5 +28,4 @@ in {
|
|||
"hyprctl dispatch split:workspace 1"
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
...
|
||||
}: let
|
||||
cfg = config.modules.usrEnv.desktops.hyprland;
|
||||
inherit (config.meta.mainUser) username;
|
||||
# inherit (inputs.hyprsplit.packages.${pkgs.system}) hyprsplit;
|
||||
inherit (lib) mkIf mkDefault;
|
||||
in {
|
||||
|
@ -15,6 +14,7 @@ in {
|
|||
./exec.nix
|
||||
./settings.nix
|
||||
./workspaces.nix
|
||||
./nixos-module.nix
|
||||
];
|
||||
# we disable the default hyprland module
|
||||
disabledModules = ["programs/hyprland.nix"];
|
||||
|
@ -22,8 +22,13 @@ in {
|
|||
config = mkIf cfg.enable {
|
||||
programs.hyprland = {
|
||||
enable = true;
|
||||
xwayland.enable = true;
|
||||
package = pkgs.hyprland;
|
||||
portalPackage = pkgs.xdg-desktop-portal-hyprland;
|
||||
plugins = [
|
||||
pkgs.hyprlandPlugins.hyprsplit
|
||||
# pkgs.hyprlandPlugins.hypr-dynamic-cursors
|
||||
];
|
||||
};
|
||||
# xdg Portal
|
||||
xdg.portal = {
|
||||
|
@ -39,26 +44,5 @@ in {
|
|||
common.default = ["gtk" "hyprland"];
|
||||
};
|
||||
};
|
||||
|
||||
home-manager.users.${username} = {
|
||||
wayland.windowManager.hyprland = {
|
||||
enable = true;
|
||||
package = pkgs.hyprland;
|
||||
|
||||
# Split-monitor-workspaces provides awesome-like workspace behaviour
|
||||
plugins = [
|
||||
pkgs.hyprlandPlugins.hyprsplit
|
||||
pkgs.hyprlandPlugins.hypr-dynamic-cursors
|
||||
];
|
||||
|
||||
# Xwayland for X applications
|
||||
xwayland.enable = true;
|
||||
# No idea why I set this
|
||||
systemd = {
|
||||
enable = true;
|
||||
variables = ["--all"];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
204
modules/wms/wayland/hyprland/nixos-module.nix
Normal file
204
modules/wms/wayland/hyprland/nixos-module.nix
Normal file
|
@ -0,0 +1,204 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
cfg = config.programs.hyprland;
|
||||
|
||||
toHyprconf = {
|
||||
attrs,
|
||||
indentLevel ? 0,
|
||||
importantPrefixes ? ["$"],
|
||||
}: let
|
||||
inherit
|
||||
(lib)
|
||||
all
|
||||
concatMapStringsSep
|
||||
concatStrings
|
||||
concatStringsSep
|
||||
filterAttrs
|
||||
foldl
|
||||
generators
|
||||
hasPrefix
|
||||
isAttrs
|
||||
isList
|
||||
mapAttrsToList
|
||||
replicate
|
||||
;
|
||||
|
||||
initialIndent = concatStrings (replicate indentLevel " ");
|
||||
|
||||
toHyprconf' = indent: attrs: let
|
||||
sections =
|
||||
filterAttrs (n: v: isAttrs v || (isList v && all isAttrs v)) attrs;
|
||||
|
||||
mkSection = n: attrs:
|
||||
if lib.isList attrs
|
||||
then (concatMapStringsSep "\n" (a: mkSection n a) attrs)
|
||||
else ''
|
||||
${indent}${n} {
|
||||
${toHyprconf' " ${indent}" attrs}${indent}}
|
||||
'';
|
||||
|
||||
mkFields = generators.toKeyValue {
|
||||
listsAsDuplicateKeys = true;
|
||||
inherit indent;
|
||||
};
|
||||
|
||||
allFields =
|
||||
filterAttrs (n: v: !(isAttrs v || (isList v && all isAttrs v)))
|
||||
attrs;
|
||||
|
||||
isImportantField = n: _:
|
||||
foldl (acc: prev:
|
||||
if hasPrefix prev n
|
||||
then true
|
||||
else acc)
|
||||
false
|
||||
importantPrefixes;
|
||||
|
||||
importantFields = filterAttrs isImportantField allFields;
|
||||
|
||||
fields =
|
||||
builtins.removeAttrs allFields
|
||||
(mapAttrsToList (n: _: n) importantFields);
|
||||
in
|
||||
mkFields importantFields
|
||||
+ concatStringsSep "\n" (mapAttrsToList mkSection sections)
|
||||
+ mkFields fields;
|
||||
in
|
||||
toHyprconf' initialIndent attrs;
|
||||
in {
|
||||
options.programs.hyprland = {
|
||||
plugins = lib.mkOption {
|
||||
type = with lib.types; listOf (either package path);
|
||||
default = [];
|
||||
description = ''
|
||||
List of Hyprland plugins to use. Can either be packages or
|
||||
absolute plugin paths.
|
||||
'';
|
||||
};
|
||||
|
||||
settings = lib.mkOption {
|
||||
type = with lib.types; let
|
||||
valueType =
|
||||
nullOr (oneOf [
|
||||
bool
|
||||
int
|
||||
float
|
||||
str
|
||||
path
|
||||
(attrsOf valueType)
|
||||
(listOf valueType)
|
||||
])
|
||||
// {
|
||||
description = "Hyprland configuration value";
|
||||
};
|
||||
in
|
||||
valueType;
|
||||
default = {};
|
||||
description = ''
|
||||
Hyprland configuration written in Nix. Entries with the same key
|
||||
should be written as lists. Variables' and colors' names should be
|
||||
quoted. See <https://wiki.hyprland.org> for more examples.
|
||||
|
||||
::: {.note}
|
||||
Use the [](#opt-wayland.windowManager.hyprland.plugins) option to
|
||||
declare plugins.
|
||||
:::
|
||||
|
||||
'';
|
||||
example = lib.literalExpression ''
|
||||
{
|
||||
decoration = {
|
||||
shadow_offset = "0 5";
|
||||
"col.shadow" = "rgba(00000099)";
|
||||
};
|
||||
|
||||
"$mod" = "SUPER";
|
||||
|
||||
bindm = [
|
||||
# mouse movements
|
||||
"$mod, mouse:272, movewindow"
|
||||
"$mod, mouse:273, resizewindow"
|
||||
"$mod ALT, mouse:272, resizewindow"
|
||||
];
|
||||
}
|
||||
'';
|
||||
};
|
||||
|
||||
extraConfig = lib.mkOption {
|
||||
type = lib.types.lines;
|
||||
default = "";
|
||||
example = ''
|
||||
# window resize
|
||||
bind = $mod, S, submap, resize
|
||||
|
||||
submap = resize
|
||||
binde = , right, resizeactive, 10 0
|
||||
binde = , left, resizeactive, -10 0
|
||||
binde = , up, resizeactive, 0 -10
|
||||
binde = , down, resizeactive, 0 10
|
||||
bind = , escape, submap, reset
|
||||
submap = reset
|
||||
'';
|
||||
description = ''
|
||||
Extra configuration lines to add to `~/.config/hypr/hyprland.conf`.
|
||||
'';
|
||||
};
|
||||
|
||||
sourceFirst =
|
||||
lib.mkEnableOption ''
|
||||
putting source entries at the top of the configuration
|
||||
''
|
||||
// {
|
||||
default = true;
|
||||
};
|
||||
|
||||
importantPrefixes = lib.mkOption {
|
||||
type = with lib.types; listOf str;
|
||||
default =
|
||||
["$" "bezier" "name"]
|
||||
++ lib.optionals cfg.sourceFirst ["source"];
|
||||
example = ["$" "bezier"];
|
||||
description = ''
|
||||
List of prefix of attributes to source at the top of the config.
|
||||
'';
|
||||
};
|
||||
};
|
||||
config = lib.mkIf cfg.enable {
|
||||
environment.systemPackages = lib.concatLists [
|
||||
(lib.optional (cfg.package != null) cfg.package)
|
||||
(lib.optional (cfg.xwayland.enable) pkgs.xwayland)
|
||||
];
|
||||
environment.etc."xdg/hypr/hyprland.conf" = let
|
||||
shouldGenerate = cfg.extraConfig != "" || cfg.settings != {} || cfg.plugins != [];
|
||||
|
||||
pluginsToHyprconf = plugins:
|
||||
toHyprconf {
|
||||
attrs = {
|
||||
plugin = let
|
||||
mkEntry = entry:
|
||||
if lib.types.package.check entry
|
||||
then "${entry}/lib/lib${entry.pname}.so"
|
||||
else entry;
|
||||
in
|
||||
map mkEntry cfg.plugins;
|
||||
};
|
||||
inherit (cfg) importantPrefixes;
|
||||
};
|
||||
in
|
||||
lib.mkIf shouldGenerate {
|
||||
text =
|
||||
lib.optionalString (cfg.plugins != [])
|
||||
(pluginsToHyprconf cfg.plugins)
|
||||
+ lib.optionalString (cfg.settings != {})
|
||||
(toHyprconf {
|
||||
attrs = cfg.settings;
|
||||
inherit (cfg) importantPrefixes;
|
||||
})
|
||||
+ lib.optionalString (cfg.extraConfig != "") cfg.extraConfig;
|
||||
};
|
||||
};
|
||||
}
|
|
@ -9,8 +9,9 @@
|
|||
inherit (builtins) toString;
|
||||
inherit (config.modules.style.colorScheme) colors;
|
||||
in {
|
||||
home-manager.users.${username} = {
|
||||
wayland.windowManager.hyprland.settings = {
|
||||
config = {
|
||||
programs.hyprland = {
|
||||
settings = {
|
||||
# Hyprland settings
|
||||
"$mainMod" = "SUPER";
|
||||
|
||||
|
@ -75,4 +76,5 @@ in {
|
|||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -3,13 +3,11 @@
|
|||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (config.meta.mainUser) username;
|
||||
inherit (config.modules.system.hardware) monitors;
|
||||
inherit (lib) imap0 flatten optionalString;
|
||||
inherit (builtins) map genList attrNames toString;
|
||||
in {
|
||||
home-manager.users.${username} = {
|
||||
wayland.windowManager.hyprland.settings = {
|
||||
programs.hyprland.settings = {
|
||||
# INFO: This is a custom function to map all of my monitors to workspaces.
|
||||
# Since I use split-monitor-workspaces, I map 10 workspaces to each monitor
|
||||
# and set the first one to be the default one.
|
||||
|
@ -43,5 +41,4 @@ in {
|
|||
"special:audio, decorate:false"
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue