treewide: alejandra -> nixfmt
This commit is contained in:
parent
d98f7ffaf5
commit
52ece2b017
8 changed files with 521 additions and 460 deletions
66
flake.nix
66
flake.nix
|
|
@ -88,23 +88,28 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = inputs @ {
|
outputs =
|
||||||
|
inputs@{
|
||||||
self,
|
self,
|
||||||
nixpkgs,
|
nixpkgs,
|
||||||
systems,
|
systems,
|
||||||
...
|
...
|
||||||
}: let
|
}:
|
||||||
|
let
|
||||||
inherit (nixpkgs) lib;
|
inherit (nixpkgs) lib;
|
||||||
eachSystem = lib.genAttrs (import systems);
|
eachSystem = lib.genAttrs (import systems);
|
||||||
pkgsFor = eachSystem (system:
|
pkgsFor = eachSystem (
|
||||||
|
system:
|
||||||
import nixpkgs {
|
import nixpkgs {
|
||||||
localSystem = system;
|
localSystem = system;
|
||||||
overlays = with self.overlays; [
|
overlays = with self.overlays; [
|
||||||
hyprland-packages
|
hyprland-packages
|
||||||
hyprland-extras
|
hyprland-extras
|
||||||
];
|
];
|
||||||
});
|
}
|
||||||
pkgsCrossFor = eachSystem (system: crossSystem:
|
);
|
||||||
|
pkgsCrossFor = eachSystem (
|
||||||
|
system: crossSystem:
|
||||||
import nixpkgs {
|
import nixpkgs {
|
||||||
localSystem = system;
|
localSystem = system;
|
||||||
inherit crossSystem;
|
inherit crossSystem;
|
||||||
|
|
@ -112,29 +117,36 @@
|
||||||
hyprland-packages
|
hyprland-packages
|
||||||
hyprland-extras
|
hyprland-extras
|
||||||
];
|
];
|
||||||
});
|
}
|
||||||
pkgsDebugFor = eachSystem (system:
|
);
|
||||||
|
pkgsDebugFor = eachSystem (
|
||||||
|
system:
|
||||||
import nixpkgs {
|
import nixpkgs {
|
||||||
localSystem = system;
|
localSystem = system;
|
||||||
overlays = with self.overlays; [
|
overlays = with self.overlays; [
|
||||||
hyprland-debug
|
hyprland-debug
|
||||||
];
|
];
|
||||||
});
|
}
|
||||||
pkgsDebugCrossFor = eachSystem (system: crossSystem:
|
);
|
||||||
|
pkgsDebugCrossFor = eachSystem (
|
||||||
|
system: crossSystem:
|
||||||
import nixpkgs {
|
import nixpkgs {
|
||||||
localSystem = system;
|
localSystem = system;
|
||||||
inherit crossSystem;
|
inherit crossSystem;
|
||||||
overlays = with self.overlays; [
|
overlays = with self.overlays; [
|
||||||
hyprland-debug
|
hyprland-debug
|
||||||
];
|
];
|
||||||
});
|
}
|
||||||
in {
|
);
|
||||||
overlays = import ./nix/overlays.nix {inherit self lib inputs;};
|
in
|
||||||
|
{
|
||||||
|
overlays = import ./nix/overlays.nix { inherit self lib inputs; };
|
||||||
|
|
||||||
checks = eachSystem (system:
|
checks = eachSystem (
|
||||||
(lib.filterAttrs
|
system:
|
||||||
(n: _: (lib.hasPrefix "hyprland" n) && !(lib.hasSuffix "debug" n))
|
(lib.filterAttrs (
|
||||||
self.packages.${system})
|
n: _: (lib.hasPrefix "hyprland" n) && !(lib.hasSuffix "debug" n)
|
||||||
|
) self.packages.${system})
|
||||||
// {
|
// {
|
||||||
inherit (self.packages.${system}) xdg-desktop-portal-hyprland;
|
inherit (self.packages.${system}) xdg-desktop-portal-hyprland;
|
||||||
pre-commit-check = inputs.pre-commit-hooks.lib.${system}.run {
|
pre-commit-check = inputs.pre-commit-hooks.lib.${system}.run {
|
||||||
|
|
@ -144,18 +156,18 @@
|
||||||
enable = true;
|
enable = true;
|
||||||
entry = "${self.formatter.${system}}/bin/hyprland-treewide-formatter";
|
entry = "${self.formatter.${system}}/bin/hyprland-treewide-formatter";
|
||||||
pass_filenames = false;
|
pass_filenames = false;
|
||||||
excludes = ["subprojects"];
|
excludes = [ "subprojects" ];
|
||||||
always_run = true;
|
always_run = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
// (import ./nix/tests inputs pkgsFor.${system}));
|
// (import ./nix/tests inputs pkgsFor.${system})
|
||||||
|
);
|
||||||
|
|
||||||
packages = eachSystem (system: {
|
packages = eachSystem (system: {
|
||||||
default = self.packages.${system}.hyprland;
|
default = self.packages.${system}.hyprland;
|
||||||
inherit
|
inherit (pkgsFor.${system})
|
||||||
(pkgsFor.${system})
|
|
||||||
# hyprland-packages
|
# hyprland-packages
|
||||||
hyprland
|
hyprland
|
||||||
hyprland-unwrapped
|
hyprland-unwrapped
|
||||||
|
|
@ -170,18 +182,20 @@
|
||||||
|
|
||||||
devShells = eachSystem (system: {
|
devShells = eachSystem (system: {
|
||||||
default =
|
default =
|
||||||
pkgsFor.${system}.mkShell.override {
|
pkgsFor.${system}.mkShell.override
|
||||||
|
{
|
||||||
inherit (self.packages.${system}.default) stdenv;
|
inherit (self.packages.${system}.default) stdenv;
|
||||||
} {
|
}
|
||||||
|
{
|
||||||
name = "hyprland-shell";
|
name = "hyprland-shell";
|
||||||
hardeningDisable = ["fortify"];
|
hardeningDisable = [ "fortify" ];
|
||||||
inputsFrom = [pkgsFor.${system}.hyprland];
|
inputsFrom = [ pkgsFor.${system}.hyprland ];
|
||||||
packages = [pkgsFor.${system}.clang-tools];
|
packages = [ pkgsFor.${system}.clang-tools ];
|
||||||
inherit (self.checks.${system}.pre-commit-check) shellHook;
|
inherit (self.checks.${system}.pre-commit-check) shellHook;
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
formatter = eachSystem (system: pkgsFor.${system}.callPackage ./nix/formatter.nix {});
|
formatter = eachSystem (system: pkgsFor.${system}.callPackage ./nix/formatter.nix { });
|
||||||
|
|
||||||
nixosModules.default = import ./nix/module.nix inputs;
|
nixosModules.default = import ./nix/module.nix inputs;
|
||||||
homeManagerModules.default = import ./nix/hm-module.nix self;
|
homeManagerModules.default = import ./nix/hm-module.nix self;
|
||||||
|
|
|
||||||
|
|
@ -60,12 +60,23 @@
|
||||||
hidpiXWayland ? false,
|
hidpiXWayland ? false,
|
||||||
legacyRenderer ? false,
|
legacyRenderer ? false,
|
||||||
withHyprtester ? false,
|
withHyprtester ? false,
|
||||||
}: let
|
}:
|
||||||
|
let
|
||||||
inherit (builtins) foldl' readFile;
|
inherit (builtins) foldl' readFile;
|
||||||
inherit (lib.asserts) assertMsg;
|
inherit (lib.asserts) assertMsg;
|
||||||
inherit (lib.attrsets) mapAttrsToList;
|
inherit (lib.attrsets) mapAttrsToList;
|
||||||
inherit (lib.lists) flatten concatLists optional optionals;
|
inherit (lib.lists)
|
||||||
inherit (lib.strings) makeBinPath optionalString cmakeBool trim;
|
flatten
|
||||||
|
concatLists
|
||||||
|
optional
|
||||||
|
optionals
|
||||||
|
;
|
||||||
|
inherit (lib.strings)
|
||||||
|
makeBinPath
|
||||||
|
optionalString
|
||||||
|
cmakeBool
|
||||||
|
trim
|
||||||
|
;
|
||||||
fs = lib.fileset;
|
fs = lib.fileset;
|
||||||
|
|
||||||
adapters = flatten [
|
adapters = flatten [
|
||||||
|
|
@ -75,12 +86,17 @@
|
||||||
|
|
||||||
customStdenv = foldl' (acc: adapter: adapter acc) stdenv adapters;
|
customStdenv = foldl' (acc: adapter: adapter acc) stdenv adapters;
|
||||||
in
|
in
|
||||||
assert assertMsg (!nvidiaPatches) "The option `nvidiaPatches` has been removed.";
|
assert assertMsg (!nvidiaPatches) "The option `nvidiaPatches` has been removed.";
|
||||||
assert assertMsg (!enableNvidiaPatches) "The option `enableNvidiaPatches` has been removed.";
|
assert assertMsg (!enableNvidiaPatches) "The option `enableNvidiaPatches` has been removed.";
|
||||||
assert assertMsg (!hidpiXWayland) "The option `hidpiXWayland` has been removed. Please refer https://wiki.hypr.land/Configuring/XWayland";
|
assert assertMsg (!hidpiXWayland)
|
||||||
assert assertMsg (!legacyRenderer) "The option `legacyRenderer` has been removed. Legacy renderer is no longer supported.";
|
"The option `hidpiXWayland` has been removed. Please refer https://wiki.hypr.land/Configuring/XWayland";
|
||||||
assert assertMsg (!withHyprtester) "The option `withHyprtester` has been removed. Hyprtester is always built now.";
|
assert assertMsg (
|
||||||
customStdenv.mkDerivation (finalAttrs: {
|
!legacyRenderer
|
||||||
|
) "The option `legacyRenderer` has been removed. Legacy renderer is no longer supported.";
|
||||||
|
assert assertMsg (
|
||||||
|
!withHyprtester
|
||||||
|
) "The option `withHyprtester` has been removed. Hyprtester is always built now.";
|
||||||
|
customStdenv.mkDerivation (finalAttrs: {
|
||||||
pname = "hyprland${optionalString debug "-debug"}";
|
pname = "hyprland${optionalString debug "-debug"}";
|
||||||
inherit version withTests;
|
inherit version withTests;
|
||||||
|
|
||||||
|
|
@ -90,7 +106,8 @@ in
|
||||||
fs.intersection
|
fs.intersection
|
||||||
# allows non-flake builds to only include files tracked by git
|
# allows non-flake builds to only include files tracked by git
|
||||||
(fs.gitTracked ../.)
|
(fs.gitTracked ../.)
|
||||||
(fs.unions (flatten [
|
(
|
||||||
|
fs.unions (flatten [
|
||||||
../assets/hyprland-portals.conf
|
../assets/hyprland-portals.conf
|
||||||
../assets/install
|
../assets/install
|
||||||
../hyprctl
|
../hyprctl
|
||||||
|
|
@ -106,8 +123,12 @@ in
|
||||||
(fs.fileFilter (file: file.hasExt "conf" || file.hasExt "in") ../example)
|
(fs.fileFilter (file: file.hasExt "conf" || file.hasExt "in") ../example)
|
||||||
(fs.fileFilter (file: file.hasExt "sh") ../scripts)
|
(fs.fileFilter (file: file.hasExt "sh") ../scripts)
|
||||||
(fs.fileFilter (file: file.name == "CMakeLists.txt") ../.)
|
(fs.fileFilter (file: file.name == "CMakeLists.txt") ../.)
|
||||||
(optional withTests [../tests ../hyprtester])
|
(optional withTests [
|
||||||
]));
|
../tests
|
||||||
|
../hyprtester
|
||||||
|
])
|
||||||
|
])
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
postPatch = ''
|
postPatch = ''
|
||||||
|
|
@ -175,8 +196,8 @@ in
|
||||||
wayland-protocols
|
wayland-protocols
|
||||||
wayland-scanner
|
wayland-scanner
|
||||||
]
|
]
|
||||||
(optionals customStdenv.hostPlatform.isBSD [epoll-shim])
|
(optionals customStdenv.hostPlatform.isBSD [ epoll-shim ])
|
||||||
(optionals customStdenv.hostPlatform.isMusl [libexecinfo])
|
(optionals customStdenv.hostPlatform.isMusl [ libexecinfo ])
|
||||||
(optionals enableXWayland [
|
(optionals enableXWayland [
|
||||||
libxcb
|
libxcb
|
||||||
libxcb-errors
|
libxcb-errors
|
||||||
|
|
@ -190,10 +211,7 @@ in
|
||||||
|
|
||||||
strictDeps = true;
|
strictDeps = true;
|
||||||
|
|
||||||
cmakeBuildType =
|
cmakeBuildType = if debug then "Debug" else "RelWithDebInfo";
|
||||||
if debug
|
|
||||||
then "Debug"
|
|
||||||
else "RelWithDebInfo";
|
|
||||||
|
|
||||||
# we want as much debug info as possible
|
# we want as much debug info as possible
|
||||||
dontStrip = debug;
|
dontStrip = debug;
|
||||||
|
|
@ -218,12 +236,14 @@ in
|
||||||
postInstall = ''
|
postInstall = ''
|
||||||
${optionalString wrapRuntimeDeps ''
|
${optionalString wrapRuntimeDeps ''
|
||||||
wrapProgram $out/bin/Hyprland \
|
wrapProgram $out/bin/Hyprland \
|
||||||
--suffix PATH : ${makeBinPath [
|
--suffix PATH : ${
|
||||||
|
makeBinPath [
|
||||||
binutils
|
binutils
|
||||||
hyprland-guiutils
|
hyprland-guiutils
|
||||||
pciutils
|
pciutils
|
||||||
pkgconf
|
pkgconf
|
||||||
]}
|
]
|
||||||
|
}
|
||||||
''}
|
''}
|
||||||
|
|
||||||
${optionalString withTests ''
|
${optionalString withTests ''
|
||||||
|
|
@ -235,7 +255,7 @@ in
|
||||||
''}
|
''}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
passthru.providedSessions = ["hyprland"] ++ optionals withSystemd ["hyprland-uwsm"];
|
passthru.providedSessions = [ "hyprland" ] ++ optionals withSystemd [ "hyprland-uwsm" ];
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
homepage = "https://github.com/hyprwm/Hyprland";
|
homepage = "https://github.com/hyprwm/Hyprland";
|
||||||
|
|
@ -244,4 +264,4 @@ in
|
||||||
platforms = lib.platforms.linux;
|
platforms = lib.platforms.linux;
|
||||||
mainProgram = "Hyprland";
|
mainProgram = "Hyprland";
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
writeShellApplication,
|
writeShellApplication,
|
||||||
deadnix,
|
deadnix,
|
||||||
statix,
|
statix,
|
||||||
alejandra,
|
nixfmt,
|
||||||
llvmPackages_19,
|
llvmPackages_19,
|
||||||
fd,
|
fd,
|
||||||
}:
|
}:
|
||||||
|
|
@ -11,7 +11,7 @@ writeShellApplication {
|
||||||
runtimeInputs = [
|
runtimeInputs = [
|
||||||
deadnix
|
deadnix
|
||||||
statix
|
statix
|
||||||
alejandra
|
nixfmt
|
||||||
llvmPackages_19.clang-tools
|
llvmPackages_19.clang-tools
|
||||||
fd
|
fd
|
||||||
];
|
];
|
||||||
|
|
@ -24,14 +24,14 @@ writeShellApplication {
|
||||||
nix_format() {
|
nix_format() {
|
||||||
if [ "$*" = 0 ]; then
|
if [ "$*" = 0 ]; then
|
||||||
fd '.*\.nix' . -E "$excludes" -x statix fix -- {} \;
|
fd '.*\.nix' . -E "$excludes" -x statix fix -- {} \;
|
||||||
fd '.*\.nix' . -E "$excludes" -X deadnix -e -- {} \; -X alejandra {} \;
|
fd '.*\.nix' . -E "$excludes" -X deadnix -e -- {} \; -X nixfmt {} \;
|
||||||
elif [ -d "$1" ]; then
|
elif [ -d "$1" ]; then
|
||||||
fd '.*\.nix' "$1" -E "$excludes" -i -x statix fix -- {} \;
|
fd '.*\.nix' "$1" -E "$excludes" -i -x statix fix -- {} \;
|
||||||
fd '.*\.nix' "$1" -E "$excludes" -i -X deadnix -e -- {} \; -X alejandra {} \;
|
fd '.*\.nix' "$1" -E "$excludes" -i -X deadnix -e -- {} \; -X nixfmt {} \;
|
||||||
else
|
else
|
||||||
statix fix -- "$1"
|
statix fix -- "$1"
|
||||||
deadnix -e "$1"
|
deadnix -e "$1"
|
||||||
alejandra "$1"
|
nixfmt "$1"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,15 @@
|
||||||
self: {
|
self:
|
||||||
config,
|
{
|
||||||
lib,
|
lib,
|
||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}: let
|
}:
|
||||||
|
let
|
||||||
inherit (pkgs.stdenv.hostPlatform) system;
|
inherit (pkgs.stdenv.hostPlatform) system;
|
||||||
|
|
||||||
package = self.packages.${system}.default;
|
package = self.packages.${system}.default;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
config = {
|
config = {
|
||||||
wayland.windowManager.hyprland.package = lib.mkDefault package;
|
wayland.windowManager.hyprland.package = lib.mkDefault package;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
51
nix/lib.nix
51
nix/lib.nix
|
|
@ -1,4 +1,5 @@
|
||||||
lib: let
|
lib:
|
||||||
|
let
|
||||||
inherit (lib)
|
inherit (lib)
|
||||||
attrNames
|
attrNames
|
||||||
filterAttrs
|
filterAttrs
|
||||||
|
|
@ -81,15 +82,23 @@ lib: let
|
||||||
|
|
||||||
:::
|
:::
|
||||||
*/
|
*/
|
||||||
toHyprlang = {
|
toHyprlang =
|
||||||
topCommandsPrefixes ? ["$" "bezier"],
|
{
|
||||||
bottomCommandsPrefixes ? [],
|
topCommandsPrefixes ? [
|
||||||
}: attrs: let
|
"$"
|
||||||
toHyprlang' = attrs: let
|
"bezier"
|
||||||
|
],
|
||||||
|
bottomCommandsPrefixes ? [ ],
|
||||||
|
}:
|
||||||
|
attrs:
|
||||||
|
let
|
||||||
|
toHyprlang' =
|
||||||
|
attrs:
|
||||||
|
let
|
||||||
# Specially configured `toKeyValue` generator with support for duplicate keys
|
# Specially configured `toKeyValue` generator with support for duplicate keys
|
||||||
# and a legible key-value separator.
|
# and a legible key-value separator.
|
||||||
mkCommands = generators.toKeyValue {
|
mkCommands = generators.toKeyValue {
|
||||||
mkKeyValue = generators.mkKeyValueDefault {} " = ";
|
mkKeyValue = generators.mkKeyValueDefault { } " = ";
|
||||||
listsAsDuplicateKeys = true;
|
listsAsDuplicateKeys = true;
|
||||||
indent = ""; # No indent, since we don't have nesting
|
indent = ""; # No indent, since we don't have nesting
|
||||||
};
|
};
|
||||||
|
|
@ -99,8 +108,7 @@ lib: let
|
||||||
commands = flattenAttrs (p: k: "${p}:${k}") attrs;
|
commands = flattenAttrs (p: k: "${p}:${k}") attrs;
|
||||||
|
|
||||||
# General filtering function to check if a key starts with any prefix in a given list.
|
# General filtering function to check if a key starts with any prefix in a given list.
|
||||||
filterCommands = list: n:
|
filterCommands = list: n: foldl (acc: prefix: acc || hasPrefix prefix n) false list;
|
||||||
foldl (acc: prefix: acc || hasPrefix prefix n) false list;
|
|
||||||
|
|
||||||
# Partition keys into top commands and the rest
|
# Partition keys into top commands and the rest
|
||||||
result = partition (filterCommands topCommandsPrefixes) (attrNames commands);
|
result = partition (filterCommands topCommandsPrefixes) (attrNames commands);
|
||||||
|
|
@ -174,25 +182,20 @@ lib: let
|
||||||
```
|
```
|
||||||
|
|
||||||
:::
|
:::
|
||||||
|
|
||||||
*/
|
*/
|
||||||
flattenAttrs = pred: attrs: let
|
flattenAttrs =
|
||||||
flattenAttrs' = prefix: attrs:
|
pred: attrs:
|
||||||
|
let
|
||||||
|
flattenAttrs' =
|
||||||
|
prefix: attrs:
|
||||||
builtins.foldl' (
|
builtins.foldl' (
|
||||||
acc: key: let
|
acc: key:
|
||||||
|
let
|
||||||
value = attrs.${key};
|
value = attrs.${key};
|
||||||
newKey =
|
newKey = if prefix == "" then key else pred prefix key;
|
||||||
if prefix == ""
|
|
||||||
then key
|
|
||||||
else pred prefix key;
|
|
||||||
in
|
in
|
||||||
acc
|
acc // (if builtins.isAttrs value then flattenAttrs' newKey value else { "${newKey}" = value; })
|
||||||
// (
|
) { } (builtins.attrNames attrs);
|
||||||
if builtins.isAttrs value
|
|
||||||
then flattenAttrs' newKey value
|
|
||||||
else {"${newKey}" = value;}
|
|
||||||
)
|
|
||||||
) {} (builtins.attrNames attrs);
|
|
||||||
in
|
in
|
||||||
flattenAttrs' "" attrs;
|
flattenAttrs' "" attrs;
|
||||||
in
|
in
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,21 @@
|
||||||
inputs: {
|
inputs:
|
||||||
|
{
|
||||||
config,
|
config,
|
||||||
lib,
|
lib,
|
||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}: let
|
}:
|
||||||
|
let
|
||||||
inherit (pkgs.stdenv.hostPlatform) system;
|
inherit (pkgs.stdenv.hostPlatform) system;
|
||||||
selflib = import ./lib.nix lib;
|
selflib = import ./lib.nix lib;
|
||||||
cfg = config.programs.hyprland;
|
cfg = config.programs.hyprland;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
options = {
|
options = {
|
||||||
programs.hyprland = {
|
programs.hyprland = {
|
||||||
plugins = lib.mkOption {
|
plugins = lib.mkOption {
|
||||||
type = with lib.types; listOf (either package path);
|
type = with lib.types; listOf (either package path);
|
||||||
default = [];
|
default = [ ];
|
||||||
description = ''
|
description = ''
|
||||||
List of Hyprland plugins to use. Can either be packages or
|
List of Hyprland plugins to use. Can either be packages or
|
||||||
absolute plugin paths.
|
absolute plugin paths.
|
||||||
|
|
@ -20,7 +23,9 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
settings = lib.mkOption {
|
settings = lib.mkOption {
|
||||||
type = with lib.types; let
|
type =
|
||||||
|
with lib.types;
|
||||||
|
let
|
||||||
valueType =
|
valueType =
|
||||||
nullOr (oneOf [
|
nullOr (oneOf [
|
||||||
bool
|
bool
|
||||||
|
|
@ -36,7 +41,7 @@ in {
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
valueType;
|
valueType;
|
||||||
default = {};
|
default = { };
|
||||||
description = ''
|
description = ''
|
||||||
Hyprland configuration written in Nix. Entries with the same key
|
Hyprland configuration written in Nix. Entries with the same key
|
||||||
should be written as lists. Variables' and colors' names should be
|
should be written as lists. Variables' and colors' names should be
|
||||||
|
|
@ -92,8 +97,15 @@ in {
|
||||||
|
|
||||||
topPrefixes = lib.mkOption {
|
topPrefixes = lib.mkOption {
|
||||||
type = with lib.types; listOf str;
|
type = with lib.types; listOf str;
|
||||||
default = ["$" "bezier"];
|
default = [
|
||||||
example = ["$" "bezier" "source"];
|
"$"
|
||||||
|
"bezier"
|
||||||
|
];
|
||||||
|
example = [
|
||||||
|
"$"
|
||||||
|
"bezier"
|
||||||
|
"source"
|
||||||
|
];
|
||||||
description = ''
|
description = ''
|
||||||
List of prefix of attributes to put at the top of the config.
|
List of prefix of attributes to put at the top of the config.
|
||||||
'';
|
'';
|
||||||
|
|
@ -101,8 +113,8 @@ in {
|
||||||
|
|
||||||
bottomPrefixes = lib.mkOption {
|
bottomPrefixes = lib.mkOption {
|
||||||
type = with lib.types; listOf str;
|
type = with lib.types; listOf str;
|
||||||
default = [];
|
default = [ ];
|
||||||
example = ["source"];
|
example = [ "source" ];
|
||||||
description = ''
|
description = ''
|
||||||
List of prefix of attributes to put at the bottom of the config.
|
List of prefix of attributes to put at the bottom of the config.
|
||||||
'';
|
'';
|
||||||
|
|
@ -117,20 +129,22 @@ in {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
(lib.mkIf cfg.enable {
|
(lib.mkIf cfg.enable {
|
||||||
environment.etc."xdg/hypr/hyprland.conf" = let
|
environment.etc."xdg/hypr/hyprland.conf" =
|
||||||
shouldGenerate = cfg.extraConfig != "" || cfg.settings != {} || cfg.plugins != [];
|
let
|
||||||
|
shouldGenerate = cfg.extraConfig != "" || cfg.settings != { } || cfg.plugins != [ ];
|
||||||
|
|
||||||
pluginsToHyprlang = plugins:
|
pluginsToHyprlang =
|
||||||
selflib.toHyprlang {
|
_plugins:
|
||||||
|
selflib.toHyprlang
|
||||||
|
{
|
||||||
topCommandsPrefixes = cfg.topPrefixes;
|
topCommandsPrefixes = cfg.topPrefixes;
|
||||||
bottomCommandsPrefixes = cfg.bottomPrefixes;
|
bottomCommandsPrefixes = cfg.bottomPrefixes;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
"exec-once" = let
|
"exec-once" =
|
||||||
mkEntry = entry:
|
let
|
||||||
if lib.types.package.check entry
|
mkEntry =
|
||||||
then "${entry}/lib/lib${entry.pname}.so"
|
entry: if lib.types.package.check entry then "${entry}/lib/lib${entry.pname}.so" else entry;
|
||||||
else entry;
|
|
||||||
hyprctl = lib.getExe' config.programs.hyprland.package "hyprctl";
|
hyprctl = lib.getExe' config.programs.hyprland.package "hyprctl";
|
||||||
in
|
in
|
||||||
map (p: "${hyprctl} plugin load ${mkEntry p}") cfg.plugins;
|
map (p: "${hyprctl} plugin load ${mkEntry p}") cfg.plugins;
|
||||||
|
|
@ -138,14 +152,13 @@ in {
|
||||||
in
|
in
|
||||||
lib.mkIf shouldGenerate {
|
lib.mkIf shouldGenerate {
|
||||||
text =
|
text =
|
||||||
lib.optionalString (cfg.plugins != [])
|
lib.optionalString (cfg.plugins != [ ]) (pluginsToHyprlang cfg.plugins)
|
||||||
(pluginsToHyprlang cfg.plugins)
|
+ lib.optionalString (cfg.settings != { }) (
|
||||||
+ lib.optionalString (cfg.settings != {})
|
selflib.toHyprlang {
|
||||||
(selflib.toHyprlang {
|
|
||||||
topCommandsPrefixes = cfg.topPrefixes;
|
topCommandsPrefixes = cfg.topPrefixes;
|
||||||
bottomCommandsPrefixes = cfg.bottomPrefixes;
|
bottomCommandsPrefixes = cfg.bottomPrefixes;
|
||||||
}
|
} cfg.settings
|
||||||
cfg.settings)
|
)
|
||||||
+ lib.optionalString (cfg.extraConfig != "") cfg.extraConfig;
|
+ lib.optionalString (cfg.extraConfig != "") cfg.extraConfig;
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -2,20 +2,27 @@
|
||||||
self,
|
self,
|
||||||
lib,
|
lib,
|
||||||
inputs,
|
inputs,
|
||||||
}: let
|
}:
|
||||||
mkDate = longDate: (lib.concatStringsSep "-" [
|
let
|
||||||
|
mkDate =
|
||||||
|
longDate:
|
||||||
|
(lib.concatStringsSep "-" [
|
||||||
(builtins.substring 0 4 longDate)
|
(builtins.substring 0 4 longDate)
|
||||||
(builtins.substring 4 2 longDate)
|
(builtins.substring 4 2 longDate)
|
||||||
(builtins.substring 6 2 longDate)
|
(builtins.substring 6 2 longDate)
|
||||||
]);
|
]);
|
||||||
ver = lib.removeSuffix "\n" (builtins.readFile ../VERSION);
|
ver = lib.removeSuffix "\n" (builtins.readFile ../VERSION);
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
# Contains what a user is most likely to care about:
|
# Contains what a user is most likely to care about:
|
||||||
# Hyprland itself, XDPH and the Share Picker.
|
# Hyprland itself, XDPH and the Share Picker.
|
||||||
default = lib.composeManyExtensions (with self.overlays; [
|
default = lib.composeManyExtensions (
|
||||||
|
with self.overlays;
|
||||||
|
[
|
||||||
hyprland-packages
|
hyprland-packages
|
||||||
hyprland-extras
|
hyprland-extras
|
||||||
]);
|
]
|
||||||
|
);
|
||||||
|
|
||||||
# Packages for variations of Hyprland, dependencies included.
|
# Packages for variations of Hyprland, dependencies included.
|
||||||
hyprland-packages = lib.composeManyExtensions [
|
hyprland-packages = lib.composeManyExtensions [
|
||||||
|
|
@ -33,49 +40,45 @@ in {
|
||||||
self.overlays.glaze
|
self.overlays.glaze
|
||||||
|
|
||||||
# Hyprland packages themselves
|
# Hyprland packages themselves
|
||||||
(final: _prev: let
|
(
|
||||||
|
final: _prev:
|
||||||
|
let
|
||||||
date = mkDate (self.lastModifiedDate or "19700101");
|
date = mkDate (self.lastModifiedDate or "19700101");
|
||||||
version = "${ver}+date=${date}_${self.shortRev or "dirty"}";
|
version = "${ver}+date=${date}_${self.shortRev or "dirty"}";
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
hyprland = final.callPackage ./default.nix {
|
hyprland = final.callPackage ./default.nix {
|
||||||
stdenv = final.gcc15Stdenv;
|
stdenv = final.gcc15Stdenv;
|
||||||
commit = self.rev or "";
|
commit = self.rev or "";
|
||||||
revCount = self.sourceInfo.revCount or "";
|
revCount = self.sourceInfo.revCount or "";
|
||||||
inherit date version;
|
inherit date version;
|
||||||
};
|
};
|
||||||
hyprland-unwrapped = final.hyprland.override {wrapRuntimeDeps = false;};
|
hyprland-unwrapped = final.hyprland.override { wrapRuntimeDeps = false; };
|
||||||
|
|
||||||
hyprland-with-tests = final.hyprland.override {withTests = true;};
|
hyprland-with-tests = final.hyprland.override { withTests = true; };
|
||||||
|
|
||||||
hyprland-with-hyprtester =
|
hyprland-with-hyprtester = builtins.trace ''
|
||||||
builtins.trace ''
|
|
||||||
hyprland-with-hyprtester was removed. Please use the hyprland package.
|
hyprland-with-hyprtester was removed. Please use the hyprland package.
|
||||||
Hyprtester is always built now.
|
Hyprtester is always built now.
|
||||||
''
|
'' final.hyprland;
|
||||||
final.hyprland;
|
|
||||||
|
|
||||||
# deprecated packages
|
# deprecated packages
|
||||||
hyprland-legacy-renderer =
|
hyprland-legacy-renderer = builtins.trace ''
|
||||||
builtins.trace ''
|
|
||||||
hyprland-legacy-renderer was removed. Please use the hyprland package.
|
hyprland-legacy-renderer was removed. Please use the hyprland package.
|
||||||
Legacy renderer is no longer supported.
|
Legacy renderer is no longer supported.
|
||||||
''
|
'' final.hyprland;
|
||||||
final.hyprland;
|
|
||||||
|
|
||||||
hyprland-nvidia =
|
hyprland-nvidia = builtins.trace ''
|
||||||
builtins.trace ''
|
|
||||||
hyprland-nvidia was removed. Please use the hyprland package.
|
hyprland-nvidia was removed. Please use the hyprland package.
|
||||||
Nvidia patches are no longer needed.
|
Nvidia patches are no longer needed.
|
||||||
''
|
'' final.hyprland;
|
||||||
final.hyprland;
|
|
||||||
|
|
||||||
hyprland-hidpi =
|
hyprland-hidpi = builtins.trace ''
|
||||||
builtins.trace ''
|
|
||||||
hyprland-hidpi was removed. Please use the hyprland package.
|
hyprland-hidpi was removed. Please use the hyprland package.
|
||||||
For more information, refer to https://wiki.hypr.land/Configuring/XWayland.
|
For more information, refer to https://wiki.hypr.land/Configuring/XWayland.
|
||||||
''
|
'' final.hyprland;
|
||||||
final.hyprland;
|
}
|
||||||
})
|
)
|
||||||
];
|
];
|
||||||
|
|
||||||
# Debug
|
# Debug
|
||||||
|
|
@ -83,10 +86,10 @@ in {
|
||||||
# Dependencies
|
# Dependencies
|
||||||
self.overlays.hyprland-packages
|
self.overlays.hyprland-packages
|
||||||
|
|
||||||
(final: prev: {
|
(_final: prev: {
|
||||||
aquamarine = prev.aquamarine.override {debug = true;};
|
aquamarine = prev.aquamarine.override { debug = true; };
|
||||||
hyprutils = prev.hyprutils.override {debug = true;};
|
hyprutils = prev.hyprutils.override { debug = true; };
|
||||||
hyprland-debug = prev.hyprland.override {debug = true;};
|
hyprland-debug = prev.hyprland.override { debug = true; };
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
@ -100,7 +103,8 @@ in {
|
||||||
# this version is the one used in the git submodule, and allows us to
|
# this version is the one used in the git submodule, and allows us to
|
||||||
# fetch the source without '?submodules=1'
|
# fetch the source without '?submodules=1'
|
||||||
udis86 = final: prev: {
|
udis86 = final: prev: {
|
||||||
udis86-hyprland = prev.udis86.overrideAttrs (_self: _super: {
|
udis86-hyprland = prev.udis86.overrideAttrs (
|
||||||
|
_self: _super: {
|
||||||
src = final.fetchFromGitHub {
|
src = final.fetchFromGitHub {
|
||||||
owner = "canihavesomecoffee";
|
owner = "canihavesomecoffee";
|
||||||
repo = "udis86";
|
repo = "udis86";
|
||||||
|
|
@ -108,13 +112,14 @@ in {
|
||||||
hash = "sha256-HifdUQPGsKQKQprByeIznvRLONdOXeolOsU5nkwIv3g=";
|
hash = "sha256-HifdUQPGsKQKQprByeIznvRLONdOXeolOsU5nkwIv3g=";
|
||||||
};
|
};
|
||||||
|
|
||||||
patches = [];
|
patches = [ ];
|
||||||
});
|
}
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
# Even though glaze itself disables it by default, nixpkgs sets ENABLE_SSL set to true.
|
# Even though glaze itself disables it by default, nixpkgs sets ENABLE_SSL set to true.
|
||||||
# Since we don't include openssl, the build failes without the `enableSSL = false;` override
|
# Since we don't include openssl, the build failes without the `enableSSL = false;` override
|
||||||
glaze = final: prev: {
|
glaze = _final: prev: {
|
||||||
glaze-hyprland = prev.glaze.override {
|
glaze-hyprland = prev.glaze.override {
|
||||||
enableSSL = false;
|
enableSSL = false;
|
||||||
enableInterop = false;
|
enableInterop = false;
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,15 @@
|
||||||
inputs: pkgs: let
|
inputs: pkgs:
|
||||||
|
let
|
||||||
flake = inputs.self.packages.${pkgs.stdenv.hostPlatform.system};
|
flake = inputs.self.packages.${pkgs.stdenv.hostPlatform.system};
|
||||||
hyprland = flake.hyprland-with-tests;
|
hyprland = flake.hyprland-with-tests;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
tests = pkgs.testers.runNixOSTest {
|
tests = pkgs.testers.runNixOSTest {
|
||||||
name = "hyprland-tests";
|
name = "hyprland-tests";
|
||||||
|
|
||||||
nodes.machine = {pkgs, ...}: {
|
nodes.machine =
|
||||||
|
{ pkgs, ... }:
|
||||||
|
{
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
# Programs needed for tests
|
# Programs needed for tests
|
||||||
jq
|
jq
|
||||||
|
|
@ -63,7 +67,7 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
# Doesn't seem to do much, thought it would fix XWayland crashing
|
# Doesn't seem to do much, thought it would fix XWayland crashing
|
||||||
qemu.options = ["-vga none -device virtio-gpu-pci"];
|
qemu.options = [ "-vga none -device virtio-gpu-pci" ];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue