-
Notifications
You must be signed in to change notification settings - Fork 1
/
flake.nix
121 lines (109 loc) · 4.13 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
{
description = ''
A Nix flake for the Hyprland window manager.
<https://github.com/hyprwm/hyprland>
'';
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
# <https://github.com/nix-systems/nix-systems>
systems.url = "github:nix-systems/default-linux";
# Official `hyprwm` flakes. Re-listed here because you can `follows`
# this flake's inputs.
hyprland = {
url = "github:hyprwm/hyprland";
inputs.systems.follows = "systems";
inputs.nixpkgs.follows = "nixpkgs";
};
hyprland-protocols = {
url = "github:hyprwm/hyprland-protocols";
inputs.systems.follows = "systems";
inputs.nixpkgs.follows = "nixpkgs";
};
hyprland-xdph = {
url = "github:hyprwm/xdg-desktop-portal-hyprland";
inputs.systems.follows = "systems";
inputs.nixpkgs.follows = "nixpkgs";
inputs.hyprland-protocols.follows = "hyprland-protocols";
};
hyprlang = {
url = "github:hyprwm/hyprlang";
inputs.systems.follows = "systems";
inputs.nixpkgs.follows = "nixpkgs";
};
bird-nix-lib.url = "github:spikespaz/bird-nix-lib";
};
outputs = inputs@{ self, nixpkgs, systems, hyprland, hyprland-protocols
, hyprland-xdph, ... }:
let
lib' = nixpkgs.lib.pipe nixpkgs.lib [
(l: l.extend self.inputs.bird-nix-lib.lib.overlay)
(l: l.extend (import "${self}/lib"))
];
in let
lib = lib';
eachSystem = lib.genAttrs (import systems);
in {
lib = {
# The overlays are combined because members of this flake's `lib`
# may not work without `bird-nix-lib`.
overlay = lib.composeManyExtensions [
self.inputs.bird-nix-lib.lib.overlay
(import ./lib)
];
# Each module in this flake inherits the final `lib` exposed here.
lib = nixpkgs.lib.extend self.lib.overlay;
};
# Packages have priority from right-to-left. Packages from the rightmost
# attributes will replace those with the same name on the accumulated left.
# This is done specifically for when inputs of `hyprland-xdph`
# and `hyprland` diverge, packages from `hyprland-xdph` are chosen.
packages = eachSystem (system:
hyprland.packages.${system} // hyprland-xdph.packages.${system} // {
default = hyprland.packages.${system}.hyprland;
});
# The most important overlys are re-exported from this flake.
# This flake's `default` overlay contains minimum required overlays.
# Other overlays can be accessed through
# `inputs.hyprland-nix.inputs.<flake-name>.overlays.<overlay-name>`.
overlays = {
inherit (hyprland.overlays)
hyprland-packages hyprland-extras wlroots-hyprland;
inherit (hyprland-xdph.overlays)
xdg-desktop-portal-hyprland hyprland-share-picker;
} // {
default = lib.composeManyExtensions
(with self.overlays; [ hyprland-packages hyprland-extras ]);
};
homeManagerModules = {
default = self.homeManagerModules.hyprland;
hyprland = import ./hm-module self;
};
checks = eachSystem (system:
let pkgs = import nixpkgs { localSystem = system; };
in {
check-formatting = pkgs.stdenvNoCC.mkDerivation {
name = "check-formatting";
src = ./.;
phases = [ "checkPhase" "installPhase" ];
doCheck = true;
nativeCheckInputs = [ pkgs.nixfmt-classic ];
checkPhase = ''
cd $src
echo 'Checking Nix code formatting with Nixfmt:'
nixfmt --check .
'';
installPhase = "touch $out";
};
});
formatter =
eachSystem (system: nixpkgs.legacyPackages.${system}.nixfmt-classic);
# Should be kept in sync with upstream.
# <https://github.com/hyprwm/Hyprland/blob/1925e64c21811ce76e5059d7a063f968c2d3e98c/flake.nix#L98-L101>
nixConfig = {
extra-substituters = [ "https://hyprland.cachix.org" ];
extra-trusted-public-keys = [
"hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="
];
};
};
}