about summary refs log tree commit diff
path: root/pkgs/applications/window-managers/ragnarwm/default.nix
blob: 6ffdc8a0a39e2512e8f9e46f9331e5535cc9dd27 (plain) (blame)
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
{ lib
, stdenv
, fetchFromGitHub
, writeText
, fontconfig
, libX11
, libXft
, libXcursor
, libXcomposite
, conf ? null
, nixosTests
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "ragnarwm";
  version = "1.4";

  src = fetchFromGitHub {
    owner = "cococry";
    repo = "Ragnar";
    rev = finalAttrs.version;
    hash = "sha256-OZhIwrKEhTfkw9K8nZIwGZzxXBObseWS92Y+85HmdNs=";
  };

  prePatch = ''
    substituteInPlace Makefile \
      --replace '/usr/bin' "$out/bin" \
      --replace '/usr/share' "$out/share"
  '';

  postPatch =
    let
      configFile =
        if lib.isDerivation conf || builtins.isPath conf
        then conf else writeText "config.h" conf;
    in
    lib.optionalString (conf != null) "cp ${configFile} config.h";

  buildInputs = [
    fontconfig
    libX11
    libXft
    libXcursor
    libXcomposite
  ];

  makeFlags = [ "CC=${stdenv.cc.targetPrefix}cc" ];
  enableParallelBuilding = true;

  preInstall = ''
    mkdir -p $out/bin
    mkdir -p $out/share/applications
  '';

  postInstall = ''
    install -Dm644 $out/share/applications/ragnar.desktop $out/share/xsessions/ragnar.desktop
  '';

  passthru = {
    tests.ragnarwm = nixosTests.ragnarwm;
    providedSessions = [ "ragnar" ];
  };

  meta = {
    description = "Minimal, flexible & user-friendly X tiling window manager";
    homepage = "https://ragnar-website.vercel.app";
    changelog = "https://github.com/cococry/Ragnar/releases/tag/${finalAttrs.version}";
    license = lib.licenses.gpl3Only;
    maintainers = with lib.maintainers; [ sigmanificient ];
    mainProgram = "ragnar";
    platforms = lib.platforms.linux;
  };
})