-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathflake.nix
More file actions
118 lines (98 loc) · 2.72 KB
/
flake.nix
File metadata and controls
118 lines (98 loc) · 2.72 KB
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
{
description = "tux's widgets for wayland";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
ags = {
url = "github:aylur/ags";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = {
self,
nixpkgs,
ags,
}: let
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
pname = "tpanel";
entry = "app.ts";
agsPackages = with ags.packages.${system}; [
io
astal4
hyprland
apps
battery
tray
network
notifd
wireplumber
cava
];
extraPackages =
agsPackages
++ [
pkgs.libadwaita
];
in {
packages.${system} = {
default = let
tpanel = pkgs.stdenv.mkDerivation {
name = pname;
src = ./.;
nativeBuildInputs = with pkgs; [
wrapGAppsHook3
gobject-introspection
ags.packages.${system}.default
];
buildInputs = extraPackages ++ [pkgs.gjs];
installPhase = ''
runHook preInstall
mkdir -p $out/bin
mkdir -p $out/share
cp -r * $out/share
ags bundle ${entry} $out/bin/${pname} -d "SRC='$out/share'"
runHook postInstall
'';
# Remove any broken symlinks
postFixup = ''
find $out -type l ! -exec test -e {} \; -delete 2>/dev/null || true
'';
};
in
pkgs.runCommand "tpanel" {
nativeBuildInputs = [pkgs.makeWrapper];
} ''
mkdir -p $out/bin
# Copy the bundled app
cp -r ${tpanel}/* $out/
mv $out/bin/tpanel $out/bin/.tpanel-unwrapped
makeWrapper $out/bin/.tpanel-unwrapped $out/bin/tpanel \
--run 'ICONS_DIR="$HOME/.config/tpanel/assets/icons"
# Check if icons directory needs to be set up
if [ ! -d "$ICONS_DIR" ]; then
# Create necessary directories
mkdir -p "$ICONS_DIR"
# Copy icon files if source exists and destination is empty
if [ -d "'"$out"'/share/assets/icons" ]; then
cp -r "'"$out"'/share/assets/icons/"* "$ICONS_DIR/"
echo "Installed tpanel icons to $ICONS_DIR"
fi
fi'
'';
ags = ags.packages.${system};
};
apps.default = {
type = "app";
program = "${self.packages.${system}.default}/bin/tpanel";
};
devShells.${system} = {
default = pkgs.mkShell {
buildInputs = [
(ags.packages.${system}.default.override {
inherit extraPackages;
})
];
};
};
};
}