aboutsummaryrefslogtreecommitdiff
path: root/roles/home/desktop/default.nix
blob: 484def51ded00b96cec2a58f404280d493cdf38e (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
87
88
89
90
91
92
93
94
{ config, lib, pkgs, ... }:
with lib;

let cfg = config.home.roles.desktop; in {
  imports = [
    ./theme.nix

    ./i3.nix
    ./picom.nix
    ./polybar.nix
    ./rofi.nix
    ./kitty.nix

    ./gtk.nix
    ./fcitx5.nix

    ./discord.nix
    ./eww.nix
    ./mpv.nix
    ./flameshot.nix
    ./fastfetch.nix
    ./cmus.nix
  ];

  options.home.roles.desktop = {
    enable = mkEnableOption "desktop home role";

    discord = mkOption {
      type = types.bool;
      default = cfg.enable;
    };

    eww = mkOption {
      type = types.bool;
      default = cfg.enable;
    };

    mpv = mkOption {
      type = types.bool;
      default = cfg.enable;
    };

    screenshot = mkOption {
      type = types.bool;
      default = cfg.enable;
    };

    fetch = mkOption {
      type = types.bool;
      default = cfg.enable;
    };

    music = mkOption {
      type = types.bool;
      default = cfg.enable;
    };
  };

  config = mkIf cfg.enable {
    gtk.enable = true;

    programs = {
      fastfetch.enable = cfg.fetch;
    };

    services = {
      flameshot.enable = cfg.screenshot;
    };

    home = {
      packages = with pkgs; [
        (writeShellScriptBin "switch-theme" ''
          #!/usr/bin/env bash

          cd /etc/nixos

          rm theme.nix
          ln -s ./themes/$1.nix theme.nix

          sudo nixos-rebuild switch --flake path:/etc/nixos

          i3-msg restart
        '')

        kdePackages.breeze
      ];

      file.".Xresources".text = ''
        Xcursor.size:   24
        Xcursor.theme:  breeze_cursors
      '';
    };
  };
}