summaryrefslogtreecommitdiff
path: root/default.nix
blob: 9f440bed4c922b0af7f99320079938262201a46f (plain)
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
{
  rev,
  lib,
  stdenv,
  makeWrapper,
  makeFontsConf,
  fish,
  ddcutil,
  brightnessctl,
  app2unit,
  cava,
  networkmanager,
  lm_sensors,
  grim,
  swappy,
  wl-clipboard,
  libqalculate,
  inotify-tools,
  bluez,
  bash,
  hyprland,
  material-symbols,
  gcc,
  quickshell,
  aubio,
  pipewire,
}: let
  runtimeDeps = [
    fish
    ddcutil
    brightnessctl
    app2unit
    cava
    networkmanager
    lm_sensors
    grim
    swappy
    wl-clipboard
    libqalculate
    inotify-tools
    bluez
    bash
    hyprland
  ];
  fontconfig = makeFontsConf {
    fontDirectories = [material-symbols];
  };
in
  stdenv.mkDerivation {
    pname = "caelestia-shell";
    version = "${rev}";
    src = ./.;

    nativeBuildInputs = [gcc makeWrapper];
    buildInputs = [quickshell aubio pipewire];
    propogatedBuildInputs = runtimeDeps;

    buildPhase = ''
      mkdir -p bin
      g++ -std=c++17 -Wall -Wextra \
      	-I${pipewire.dev}/include/pipewire-0.3 \
      	-I${pipewire.dev}/include/spa-0.2 \
      	-I${aubio}/include/aubio \
      	assets/beat_detector.cpp \
      	-o bin/beat_detector \
      	-lpipewire-0.3 -laubio
    '';

    installPhase = ''
      install -Dm755 bin/beat_detector $out/bin/beat_detector
      makeWrapper ${quickshell}/bin/qs $out/bin/caelestia-shell \
      	--prefix PATH : "${lib.makeBinPath runtimeDeps}" \
      	--set FONTCONFIG_FILE "${fontconfig}" \
      	--set CAELESTIA_BD_PATH $out/bin/beat_detector \
      	--add-flags '-p ${./.}'
    '';

    meta = {
      description = "A very segsy desktop shell";
      homepage = "https://github.com/caelestia-dots/shell";
      license = lib.licenses.gpl3Only;
      mainProgram = "caelestia-shell";
    };
  }