mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-26 05:45:59 +01:00
Merge pull request #241 from viperML/main
Nix: refactor packages and overlays
This commit is contained in:
commit
f58bb0187b
2 changed files with 21 additions and 24 deletions
43
flake.nix
43
flake.nix
|
@ -16,40 +16,37 @@
|
||||||
}: let
|
}: let
|
||||||
inherit (nixpkgs) lib;
|
inherit (nixpkgs) lib;
|
||||||
genSystems = lib.genAttrs [
|
genSystems = lib.genAttrs [
|
||||||
|
# Add more systems if they are supported
|
||||||
"x86_64-linux"
|
"x86_64-linux"
|
||||||
];
|
];
|
||||||
pkgsFor = nixpkgs.legacyPackages;
|
pkgsFor = nixpkgs.legacyPackages;
|
||||||
# https://github.com/NixOS/rfcs/pull/107
|
mkDate = longDate: (lib.concatStringsSep "-" [
|
||||||
mkVersion = longDate:
|
(__substring 0 4 longDate)
|
||||||
lib.concatStrings [
|
(__substring 4 2 longDate)
|
||||||
"0.pre"
|
(__substring 6 2 longDate)
|
||||||
"+date="
|
]);
|
||||||
(lib.concatStringsSep "-" [
|
|
||||||
(__substring 0 4 longDate)
|
|
||||||
(__substring 4 2 longDate)
|
|
||||||
(__substring 6 2 longDate)
|
|
||||||
])
|
|
||||||
];
|
|
||||||
in {
|
in {
|
||||||
packages = genSystems (system: {
|
overlays.default = _: prev: rec {
|
||||||
wlroots = pkgsFor.${system}.wlroots.overrideAttrs (prev: {
|
wlroots-hyprland = prev.wlroots.overrideAttrs (__: {
|
||||||
version = mkVersion (toString (inputs.wlroots.lastModifiedDate or inputs.wlroots.lastModified or "19700101"));
|
version = mkDate (inputs.wlroots.lastModifiedDate or "19700101");
|
||||||
src = inputs.wlroots;
|
src = inputs.wlroots;
|
||||||
});
|
});
|
||||||
default = pkgsFor.${system}.callPackage ./nix/default.nix {
|
hyprland = prev.callPackage ./nix/default.nix {
|
||||||
version = mkVersion (toString (self.lastModifiedDate or self.lastModified or "19700101"));
|
version = "0.pre" + "+date=" + (mkDate (self.lastModifiedDate or "19700101"));
|
||||||
inherit (self.packages.${system}) wlroots;
|
wlroots = wlroots-hyprland;
|
||||||
};
|
};
|
||||||
});
|
};
|
||||||
|
|
||||||
|
packages = genSystems (system:
|
||||||
|
(self.overlays.default null pkgsFor.${system})
|
||||||
|
// {
|
||||||
|
default = self.packages.${system}.hyprland;
|
||||||
|
});
|
||||||
|
|
||||||
formatter = genSystems (system: pkgsFor.${system}.alejandra);
|
formatter = genSystems (system: pkgsFor.${system}.alejandra);
|
||||||
|
|
||||||
nixosModules.default = import ./nix/module.nix self;
|
nixosModules.default = import ./nix/module.nix self;
|
||||||
|
|
||||||
# Deprecated
|
overlay = throw "Hyprland: .overlay output is deprecated, please use the .overlays.default output";
|
||||||
overlays.default = _: prev: {
|
|
||||||
hyprland = self.packages.${prev.system}.default;
|
|
||||||
};
|
|
||||||
overlay = self.overlays.default;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ in {
|
||||||
|
|
||||||
package = mkOption {
|
package = mkOption {
|
||||||
type = types.package;
|
type = types.package;
|
||||||
default = self.packages.${pkgs.system}.default;
|
default = pkgs.hyprland or self.packages.${pkgs.system}.default;
|
||||||
defaultText = literalExpression "<Hyprland flake>.packages.<system>.default";
|
defaultText = literalExpression "<Hyprland flake>.packages.<system>.default";
|
||||||
example = literalExpression "<Hyprland flake>.packages.<system>.default.override { }";
|
example = literalExpression "<Hyprland flake>.packages.<system>.default.override { }";
|
||||||
description = ''
|
description = ''
|
||||||
|
|
Loading…
Reference in a new issue