diff --git a/flake.lock b/flake.lock index a2e3009..a38bc60 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,38 @@ { "nodes": { + "aquamarine": { + "inputs": { + "hyprutils": [ + "hyprland", + "hyprutils" + ], + "hyprwayland-scanner": [ + "hyprland", + "hyprwayland-scanner" + ], + "nixpkgs": [ + "hyprland", + "nixpkgs" + ], + "systems": [ + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1743265529, + "narHash": "sha256-QbjP15/2N+VJl0b5jxrrTc+VOt39aU4XrDvtP0Lz5ik=", + "owner": "hyprwm", + "repo": "aquamarine", + "rev": "1d2dbd72c2bbaceab031c592d4810f744741d203", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "aquamarine", + "type": "github" + } + }, "crane": { "locked": { "lastModified": 1741148495, @@ -16,6 +49,22 @@ } }, "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-compat_2": { "flake": false, "locked": { "lastModified": 1733328505, @@ -53,6 +102,28 @@ } }, "gitignore": { + "inputs": { + "nixpkgs": [ + "hyprland", + "pre-commit-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709087332, + "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, + "gitignore_2": { "inputs": { "nixpkgs": [ "lanzaboote", @@ -74,6 +145,269 @@ "type": "github" } }, + "hyprcursor": { + "inputs": { + "hyprlang": [ + "hyprland", + "hyprlang" + ], + "nixpkgs": [ + "hyprland", + "nixpkgs" + ], + "systems": [ + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1742215578, + "narHash": "sha256-zfs71PXVVPEe56WEyNi2TJQPs0wabU4WAlq0XV7GcdE=", + "owner": "hyprwm", + "repo": "hyprcursor", + "rev": "2fd36421c21aa87e2fe3bee11067540ae612f719", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprcursor", + "type": "github" + } + }, + "hyprgraphics": { + "inputs": { + "hyprutils": [ + "hyprland", + "hyprutils" + ], + "nixpkgs": [ + "hyprland", + "nixpkgs" + ], + "systems": [ + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1739049071, + "narHash": "sha256-3+7TpXMrbsUXSwgr5VAKAnmkzMb6JO+Rvc9XRb5NMg4=", + "owner": "hyprwm", + "repo": "hyprgraphics", + "rev": "175c6b29b6ff82100539e7c4363a35a02c74dd73", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprgraphics", + "type": "github" + } + }, + "hyprland": { + "inputs": { + "aquamarine": "aquamarine", + "hyprcursor": "hyprcursor", + "hyprgraphics": "hyprgraphics", + "hyprland-protocols": "hyprland-protocols", + "hyprland-qtutils": "hyprland-qtutils", + "hyprlang": "hyprlang", + "hyprutils": "hyprutils", + "hyprwayland-scanner": "hyprwayland-scanner", + "nixpkgs": [ + "nixpkgs" + ], + "pre-commit-hooks": "pre-commit-hooks", + "systems": [ + "systems" + ], + "xdph": "xdph" + }, + "locked": { + "lastModified": 1743953518, + "narHash": "sha256-TAEUQ7yWGm/gx2irRieD1zoCo9wA39EfgS3EPMmz0EI=", + "owner": "hyprwm", + "repo": "hyprland", + "rev": "3c128679ee8c86bbbeb5ae38621f6de622525cf1", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprland", + "type": "github" + } + }, + "hyprland-protocols": { + "inputs": { + "nixpkgs": [ + "hyprland", + "nixpkgs" + ], + "systems": [ + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1743714874, + "narHash": "sha256-yt8F7NhMFCFHUHy/lNjH/pjZyIDFNk52Q4tivQ31WFo=", + "owner": "hyprwm", + "repo": "hyprland-protocols", + "rev": "3a5c2bda1c1a4e55cc1330c782547695a93f05b2", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprland-protocols", + "type": "github" + } + }, + "hyprland-qt-support": { + "inputs": { + "hyprlang": [ + "hyprland", + "hyprland-qtutils", + "hyprlang" + ], + "nixpkgs": [ + "hyprland", + "hyprland-qtutils", + "nixpkgs" + ], + "systems": [ + "hyprland", + "hyprland-qtutils", + "systems" + ] + }, + "locked": { + "lastModified": 1737634706, + "narHash": "sha256-nGCibkfsXz7ARx5R+SnisRtMq21IQIhazp6viBU8I/A=", + "owner": "hyprwm", + "repo": "hyprland-qt-support", + "rev": "8810df502cdee755993cb803eba7b23f189db795", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprland-qt-support", + "type": "github" + } + }, + "hyprland-qtutils": { + "inputs": { + "hyprland-qt-support": "hyprland-qt-support", + "hyprlang": [ + "hyprland", + "hyprlang" + ], + "hyprutils": [ + "hyprland", + "hyprland-qtutils", + "hyprlang", + "hyprutils" + ], + "nixpkgs": [ + "hyprland", + "nixpkgs" + ], + "systems": [ + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1739048983, + "narHash": "sha256-REhTcXq4qs3B3cCDtLlYDz0GZvmsBSh947Ub6pQWGTQ=", + "owner": "hyprwm", + "repo": "hyprland-qtutils", + "rev": "3504a293c8f8db4127cb0f7cfc1a318ffb4316f8", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprland-qtutils", + "type": "github" + } + }, + "hyprlang": { + "inputs": { + "hyprutils": [ + "hyprland", + "hyprutils" + ], + "nixpkgs": [ + "hyprland", + "nixpkgs" + ], + "systems": [ + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1741191527, + "narHash": "sha256-kM+11Nch47Xwfgtw2EpRitJuORy4miwoMuRi5tyMBDY=", + "owner": "hyprwm", + "repo": "hyprlang", + "rev": "72df3861f1197e41b078faa3e38eedd60e00018d", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprlang", + "type": "github" + } + }, + "hyprutils": { + "inputs": { + "nixpkgs": [ + "hyprland", + "nixpkgs" + ], + "systems": [ + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1743950287, + "narHash": "sha256-/6IAEWyb8gC/NKZElxiHChkouiUOrVYNq9YqG0Pzm4Y=", + "owner": "hyprwm", + "repo": "hyprutils", + "rev": "f2dc70e448b994cef627a157ee340135bd68fbc6", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprutils", + "type": "github" + } + }, + "hyprwayland-scanner": { + "inputs": { + "nixpkgs": [ + "hyprland", + "nixpkgs" + ], + "systems": [ + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1739870480, + "narHash": "sha256-SiDN5BGxa/1hAsqhgJsS03C3t2QrLgBT8u+ENJ0Qzwc=", + "owner": "hyprwm", + "repo": "hyprwayland-scanner", + "rev": "206367a08dc5ac4ba7ad31bdca391d098082e64b", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprwayland-scanner", + "type": "github" + } + }, "impermanence": { "locked": { "lastModified": 1737831083, @@ -92,7 +426,7 @@ "lanzaboote": { "inputs": { "crane": "crane", - "flake-compat": "flake-compat", + "flake-compat": "flake-compat_2", "flake-parts": "flake-parts", "nixpkgs": [ "nixpkgs" @@ -130,13 +464,36 @@ "type": "github" } }, + "pre-commit-hooks": { + "inputs": { + "flake-compat": "flake-compat", + "gitignore": "gitignore", + "nixpkgs": [ + "hyprland", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1742649964, + "narHash": "sha256-DwOTp7nvfi8mRfuL1escHDXabVXFGT1VlPD1JHrtrco=", + "owner": "cachix", + "repo": "git-hooks.nix", + "rev": "dcf5072734cb576d2b0c59b2ac44f5050b5eac82", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "git-hooks.nix", + "type": "github" + } + }, "pre-commit-hooks-nix": { "inputs": { "flake-compat": [ "lanzaboote", "flake-compat" ], - "gitignore": "gitignore", + "gitignore": "gitignore_2", "nixpkgs": [ "lanzaboote", "nixpkgs" @@ -158,6 +515,7 @@ }, "root": { "inputs": { + "hyprland": "hyprland", "impermanence": "impermanence", "lanzaboote": "lanzaboote", "nixpkgs": "nixpkgs", @@ -199,6 +557,47 @@ "repo": "default-linux", "type": "github" } + }, + "xdph": { + "inputs": { + "hyprland-protocols": [ + "hyprland", + "hyprland-protocols" + ], + "hyprlang": [ + "hyprland", + "hyprlang" + ], + "hyprutils": [ + "hyprland", + "hyprutils" + ], + "hyprwayland-scanner": [ + "hyprland", + "hyprwayland-scanner" + ], + "nixpkgs": [ + "hyprland", + "nixpkgs" + ], + "systems": [ + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1741934139, + "narHash": "sha256-ZhTcTH9FoeAtbPfWGrhkH7RjLJZ7GeF18nygLAMR+WE=", + "owner": "hyprwm", + "repo": "xdg-desktop-portal-hyprland", + "rev": "150b0b6f52bb422a1b232a53698606fe0320dde0", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "xdg-desktop-portal-hyprland", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 03d8bb6..9a4b1c2 100644 --- a/flake.nix +++ b/flake.nix @@ -43,5 +43,11 @@ url = "github:nix-community/lanzaboote"; inputs.nixpkgs.follows = "nixpkgs"; }; + + hyprland = { + url = "github:hyprwm/hyprland"; + inputs.nixpkgs.follows = "nixpkgs"; + inputs.systems.follows = "systems"; + }; }; } diff --git a/modules/wms/wayland/hyprland/decorations.nix b/modules/wms/wayland/hyprland/decorations.nix index 77edb4d..fd3a2c5 100644 --- a/modules/wms/wayland/hyprland/decorations.nix +++ b/modules/wms/wayland/hyprland/decorations.nix @@ -17,13 +17,13 @@ _: { # Hyprland anomations, using the above bezier curves animations = { enabled = false; - animation = [ - "windows, 1, 4, dupa, popin" - "windowsOut, 1, 4, dupa, slide" - "border, 1, 15, default" - "fade, 1, 10, default" - "workspaces, 1, 5, dupa, slidevert" - ]; + # animation = [ + # "windows, 1, 4, dupa, popin" + # "windowsOut, 1, 4, dupa, slide" + # "border, 1, 15, default" + # "fade, 1, 10, default" + # "workspaces, 1, 5, dupa, slidevert" + # ]; }; cursor = { diff --git a/modules/wms/wayland/hyprland/module.nix b/modules/wms/wayland/hyprland/module.nix index e6e42c7..e745493 100644 --- a/modules/wms/wayland/hyprland/module.nix +++ b/modules/wms/wayland/hyprland/module.nix @@ -1,7 +1,8 @@ { config, - pkgs, + inputs, lib, + pkgs, ... }: let cfg = config.modules.desktops.hyprland; @@ -16,10 +17,10 @@ in { ./exec.nix ./settings.nix ./workspaces.nix - ./nixos-module.nix + inputs.hyprland.nixosModules.default ]; # we disable the default hyprland module - disabledModules = ["programs/hyprland.nix"]; + # disabledModules = ["programs/hyprland.nix"]; options.modules.desktops.hyprland = { enable = mkOption { diff --git a/modules/wms/wayland/hyprland/nixos-module.nix b/modules/wms/wayland/hyprland/nixos-module.nix deleted file mode 100644 index a77a27a..0000000 --- a/modules/wms/wayland/hyprland/nixos-module.nix +++ /dev/null @@ -1,204 +0,0 @@ -{ - 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 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; - }; - }; -}