-
Notifications
You must be signed in to change notification settings - Fork 17
/
flake.nix
124 lines (114 loc) · 3.24 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
122
123
124
{
description = "hyprscroller";
inputs.hyprland = {
type = "git";
url = "https://github.com/hyprwm/Hyprland";
submodules = true;
};
outputs =
{ self, hyprland }:
let
inherit (hyprland.inputs) nixpkgs;
inherit (nixpkgs) lib;
allSystems = [
"x86_64-linux"
"aarch64-linux"
];
forAllSystems =
func:
lib.genAttrs allSystems (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
hyprlandPkg = hyprland.packages.${system}.hyprland;
hyprscrollerPkg = self.packages.${system}.hyprscroller;
in
func { inherit pkgs hyprlandPkg hyprscrollerPkg; }
);
inherit (builtins) substring;
mkDate =
date:
(lib.concatStringsSep "-" [
(substring 0 4 date)
(substring 4 2 date)
(substring 6 2 date)
]);
rawCommitPins = (builtins.fromTOML (builtins.readFile ./hyprpm.toml)).repository.commit_pins;
commitPins = builtins.listToAttrs (
map (p: {
name = builtins.head p;
value = builtins.elemAt p 1;
}) rawCommitPins
);
selfRev = "${commitPins.${hyprland.rev} or "git"}";
selfShortRev = substring 0 7 selfRev;
version = "date=${
mkDate (self.lastModifiedDate or "19700101")
}_${self.shortRev or "dirty"}_${selfShortRev}";
in
{
packages = forAllSystems (
{
pkgs,
hyprlandPkg,
hyprscrollerPkg,
}:
{
hyprscroller = pkgs.stdenv.mkDerivation {
pname = "hyprscroller";
inherit version;
src =
if (commitPins ? ${hyprland.rev}) && (self ? rev) then
(builtins.fetchGit {
url = "https://github.com/dawsers/hyprscroller";
rev = selfRev;
})
else
./.;
nativeBuildInputs = [
pkgs.cmake
pkgs.pkg-config
hyprlandPkg
];
buildInputs = [ hyprlandPkg ] ++ hyprlandPkg.buildInputs;
buildPhase = ''
make all
'';
installPhase = ''
mkdir -p $out/lib
cp ./hyprscroller.so $out/lib/libhyprscroller.so
'';
meta = with lib; {
homepage = "https://github.com/dawsers/hyprscroller";
description = "Hyprland layout plugin providing a scrolling layout like PaperWM";
license = licenses.mit;
platforms = platforms.linux;
};
};
default = hyprscrollerPkg;
}
);
devShells = forAllSystems (
{
pkgs,
hyprlandPkg,
hyprscrollerPkg,
}:
{
default = pkgs.mkShell {
shellHook = ''
make dev
'';
name = "hyprscroller-shell";
nativeBuildInputs = with pkgs; [ cmake ];
buildInputs = [ hyprlandPkg ];
inputsFrom = [
hyprlandPkg
hyprscrollerPkg
];
};
}
);
formatter = forAllSystems ({ pkgs, ... }: pkgs.nixfmt-rfc-style);
};
}