summaryrefslogtreecommitdiff
path: root/default.nix
blob: 292fcf38cc682c4b3494e64775b81a7efb90f5ed (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
85
86
{
  rev,
  lib,
  python3,
  installShellFiles,
  swappy,
  libnotify,
  slurp,
  wl-clipboard,
  cliphist,
  app2unit,
  dart-sass,
  grim,
  fuzzel,
  wl-screenrec,
  dconf,
  killall,
  caelestia-shell,
  withShell ? false,
  discordBin ? "discord",
  qtctStyle ? "Fusion",
}:
python3.pkgs.buildPythonApplication {
  pname = "caelestia-cli";
  version = "${rev}";
  src = ./.;
  pyproject = true;

  build-system = with python3.pkgs; [
    hatch-vcs
    hatchling
  ];

  dependencies = with python3.pkgs; [
    materialyoucolor
    pillow
  ];

  pythonImportsCheck = ["caelestia"];

  nativeBuildInputs = [installShellFiles];
  propagatedBuildInputs =
    [
      swappy
      libnotify
      slurp
      wl-clipboard
      cliphist
      app2unit
      dart-sass
      grim
      fuzzel
      wl-screenrec
      dconf
      killall
    ]
    ++ lib.optional withShell caelestia-shell;

  SETUPTOOLS_SCM_PRETEND_VERSION = 1;

  patchPhase = ''
    # Replace qs config call with nix shell pkg bin
    substituteInPlace src/caelestia/subcommands/shell.py \
    	--replace-fail '"qs", "-c", "caelestia"' '"caelestia-shell"'
    substituteInPlace src/caelestia/subcommands/screenshot.py \
    	--replace-fail '"qs", "-c", "caelestia"' '"caelestia-shell"'

    # Use config bin instead of discord
    substituteInPlace src/caelestia/subcommands/toggle.py \
    	--replace-fail 'discord' ${discordBin}

    # Use config style instead of fusion
    substituteInPlace src/caelestia/data/templates/qtct.conf \
    	--replace-fail 'Fusion' '${qtctStyle}'
  '';

  postInstall = "installShellCompletion completions/caelestia.fish";

  meta = {
    description = "The main control script for the Caelestia dotfiles";
    homepage = "https://github.com/caelestia-dots/cli";
    license = lib.licenses.gpl3Only;
    mainProgram = "caelestia";
    platforms = lib.platforms.linux;
  };
}