aboutsummaryrefslogtreecommitdiff
path: root/modules/global.nix
blob: 9c474d56d91318283ebd69514558a06be597b055 (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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
{
  config,
  lib,
  pkgs,
  inputs,
  ...
}:
let
  cfg = config.modules.global;
  binaryninja = pkgs.callPackage ../packages/binaryninja.nix { inherit pkgs; };
  ida = pkgs.callPackage ../packages/ida.nix { inherit pkgs; };
  scheme = config.modules.scheme;
in
{
  imports = [ ./default.nix ];

  options.modules.global = with lib.options; {
    notNixOS = mkOption {
      type = lib.types.bool;
      default = false;
      description = "Whether nix is running outside of NixOS.";
    };
    wayland = mkEnableOption "Wayland";
    extraPackages = mkOption {
      type = with lib.types; listOf package;
      description = "List of extra packages to install";
      example = [
        pkgs.cowsay
        pkgs.lolcat
      ];
      default = [ ];
    };
    menu = mkOption {
      type = lib.types.submodule {
        package = lib.types.package;
        dmenu = lib.mkOption {
          type = lib.types.pathInStore;
          description = "derivation that will behave like dmenu";
          example = pkgs.dmenu;
          default = pkgs.fuzzel;
        };
      };
    };
  };

  config = {
    modules = rec {
      global = {
        wayland = lib.mkDefault true;
      };
      firefox.enable = true;
      sway = {
        wrapWithNixGL = cfg.notNixOS;
      };
      qutebrowser = {
        wrapWithNixGL = cfg.notNixOS;
      };
      email.enable = true;
      aerc.enable = true;
      zsh.enable = true;
      tmux.enable = true;
      fzf.enable = true;
      git.enable = true;
      lazygit.enable = true;
      fuzzel.enable = true;
      zathura.enable = true;
      weechat.enable = true;
    };

    nixGL = lib.mkIf cfg.notNixOS {
      packages = inputs.nixgl.packages;
      defaultWrapper = "mesa";
    };

    programs = {
      home-manager.enable = true;
      direnv = {
        enable = true;
        enableZshIntegration = true;
        enableBashIntegration = true;
        silent = true;
      };
    };

    fonts.fontconfig = {
      enable = true;
      defaultFonts = {
        monospace = [ "AdwaitaMono Nerd Font Mono" "NotoMono Nerd Font Mono" ];
        sansSerif = [ "Adwaita Sans" "Noto Sans" ];
        serif = [ "Noto Serif" ];
        emoji = [ "Noto Color Emoji" ];
      };
    };

    dconf = {
      enable = true;
      settings = {
        "org/gnome/desktop/interface" = {
          color-scheme = "${if scheme.light then "prefer-light" else "prefer-dark"}";
        };
        "org/gnome/shell" = {
          disable-user-extensions = false;
          enabled-extensions = with pkgs.gnomeExtensions; [
            blur-my-shell.extensionUuid
          ];
        };
      };
    };

    gtk = {
      enable = true;
      gtk3.extraConfig.gtk-application-prefer-dark-theme = if scheme.light then 0 else 1;
      gtk4.extraConfig.gtk-application-prefer-dark-theme = if scheme.light then 0 else 1;
      theme = {
        name = "${if scheme.light then "Adwaita" else "Adwaita-dark"}";
        package = pkgs.gnome-themes-extra;
      };
      # iconTheme = {
      #   name = "Adwaita-dark";
      #   package = pkgs.adwaita-icon-theme;
      # };
    };

    qt = {
      enable = true;
      platformTheme.name = "adwaita";
      style = {
        package = pkgs.adwaita-qt;
        name = "${if scheme.light then "adwaita" else "adwaita-dark"}";
      };
    };

    targets.genericLinux.enable = cfg.notNixOS;

    home = {
      username = "stefan";
      homeDirectory = "/home/stefan";
      stateVersion = "24.11";
      shell.enableZshIntegration = true;

      sessionPath = [
        "$HOME/.local/opt/binaryninja/bin"
        "$HOME/scripts"
      ];

      packages =
        with pkgs;
        [
          eza
          fanwood
          jq
          ripgrep
          elan
          dmenu
          binaryninja
          ida
          tamzen
          roboto
          roboto-serif
          cozette
          inter
          adwaita-fonts
          noto-fonts
          noto-fonts-cjk-sans
          noto-fonts-cjk-serif
          noto-fonts-color-emoji
          material-icons
          # (callPackage ida-pro {
          #   runfile = /nix/store/s9gq70w56355yrg33054g97zscr3r64i-ida-pro_91_x64linux.run;
          # })
        ]
        ++ (builtins.filter lib.attrsets.isDerivation (builtins.attrValues pkgs.nerd-fonts))
        ++ (lib.optional cfg.notNixOS nixgl.auto.nixGLDefault)
        ++ (lib.optionals cfg.wayland [
          wl-clipboard
          #...
        ])
        ++ cfg.extraPackages;
    };

  };
}