-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathflake.nix
89 lines (80 loc) · 2.37 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
{
description = "Hyprspace";
inputs = {
systems = {
type = "github";
owner = "nix-systems";
repo = "default-linux";
};
hyprland = {
owner = "hyprwm";
repo = "Hyprland";
type = "github";
inputs.systems.follows = "systems";
};
};
outputs = {
self,
systems,
hyprland,
...
}: let
inherit (builtins) concatStringsSep elemAt head readFile split substring;
inherit (hyprland.inputs) nixpkgs;
perSystem = attrs:
nixpkgs.lib.genAttrs (import systems) (system:
attrs system (import nixpkgs {
inherit system;
overlays = [hyprland.overlays.hyprland-packages];
}));
# Generate version
mkDate = longDate: (concatStringsSep "-" [
(substring 0 4 longDate)
(substring 4 2 longDate)
(substring 6 2 longDate)
]);
version =
(head (split "'"
(elemAt
(split " version: '" (readFile ./meson.build))
2)))
+ "+date=${mkDate (self.lastModifiedDate or "19700101")}_${self.shortRev or "dirty"}";
in {
packages = perSystem (system: pkgs: {
Hyprspace = let
hyprlandPkg = hyprland.packages.${system}.hyprland;
in
pkgs.gcc14Stdenv.mkDerivation {
pname = "Hyprspace";
inherit version;
src = ./.;
nativeBuildInputs = hyprlandPkg.nativeBuildInputs;
buildInputs = [hyprlandPkg] ++ hyprlandPkg.buildInputs;
dontUseCmakeConfigure = true;
meta = with pkgs.lib; {
homepage = "https://github.com/KZDKM/Hyprspace";
description = "Workspace overview plugin for Hyprland";
license = licenses.gpl2Only;
platforms = platforms.linux;
};
};
default = self.packages.${system}.Hyprspace;
});
devShells = perSystem (system: pkgs: {
default = pkgs.mkShell {
name = "Hyprspace-shell";
nativeBuildInputs = with pkgs; [gcc14];
buildInputs = [hyprland.packages.${system}.hyprland];
inputsFrom = [
hyprland.packages.${system}.hyprland
self.packages.${system}.Hyprspace
];
shellHook = ''
meson setup build --reconfigure
sed -e 's/c++23/c++2b/g' ./build/compile_commands.json > ./compile_commands.json
'';
};
});
formatter = perSystem (_: pkgs: pkgs.alejandra);
};
}