about summary refs log tree commit diff
path: root/pkgs/by-name/wh/where-is-my-sddm-theme/package.nix
blob: 7ef69e5b1342feab93e3547d40823e5af2715eee (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
74
75
76
77
78
79
80
81
82
{
  lib,
  formats,
  stdenvNoCC,
  fetchFromGitHub,
  qt6,
  libsForQt5,
  variants ? [ "qt6" ],
  /*
    An example of how you can override the background on the NixOS logo

      environment.systemPackages = [
        (pkgs.where-is-my-sddm-theme.override {
          themeConfig.General = {
            background = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
            backgroundMode = "none";
          };
        })
      ];
  */
  themeConfig ? null,
}:

let
  user-cfg = (formats.ini { }).generate "theme.conf.user" themeConfig;
  validVariants = [
    "qt5"
    "qt6"
  ];
in

lib.checkListOfEnum "where-is-my-sddm-theme: variant" validVariants variants

  stdenvNoCC.mkDerivation
  (finalAttrs: {
    pname = "where-is-my-sddm-theme";
    version = "1.9.2";

    src = fetchFromGitHub {
      owner = "stepanzubkov";
      repo = "where-is-my-sddm-theme";
      rev = "refs/tags/v${finalAttrs.version}";
      hash = "sha256-7I8ucPuPPpUH/KyJoiwlfS7r4Bsh8ZnkHdOEED12TOQ=";
    };

    propagatedUserEnvPkgs =
      [ ]
      ++ lib.optionals (lib.elem "qt5" variants) [ libsForQt5.qtgraphicaleffects ]
      ++ lib.optionals (lib.elem "qt6" variants) [
        qt6.qt5compat
        qt6.qtsvg
      ];

    installPhase =
      ''
        mkdir -p $out/share/sddm/themes/
      ''
      + lib.optionalString (lib.elem "qt6" variants) (
        ''
          cp -r where_is_my_sddm_theme/ $out/share/sddm/themes/
        ''
        + lib.optionalString (lib.isAttrs themeConfig) ''
          ln -sf ${user-cfg} $out/share/sddm/themes/where_is_my_sddm_theme/theme.conf.user
        ''
      )
      + lib.optionalString (lib.elem "qt5" variants) (
        ''
          cp -r where_is_my_sddm_theme_qt5/ $out/share/sddm/themes/
        ''
        + lib.optionalString (lib.isAttrs themeConfig) ''
          ln -sf ${user-cfg} $out/share/sddm/themes/where_is_my_sddm_theme_qt5/theme.conf.user
        ''
      );

    meta = {
      description = "Most minimalistic SDDM theme among all themes";
      homepage = "https://github.com/stepanzubkov/where-is-my-sddm-theme";
      license = lib.licenses.mit;
      platforms = lib.platforms.linux;
      maintainers = with lib.maintainers; [ name-snrl ];
    };
  })