about summary refs log tree commit diff
path: root/modules/user/devhell/profiles/base.nix
blob: 3ce8828e45efa3e4ae2f02165dffbd8a659c8190 (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
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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
{ config, pkgs, lib, ... }:

let
  cfg = config.vuizvui.user.devhell.profiles.base;

in {
  options.vuizvui.user.devhell.profiles.base = {
    enable = lib.mkEnableOption "Base profile for devhell";
  };

  config = lib.mkIf cfg.enable {
    boot = {
      kernelPackages = pkgs.linuxPackages_latest;
      tmp.cleanOnBoot = true;
    };

    nix.settings = {
      sandbox = true;
      cores = 0;
      auto-optimise-store = true;
      experimental-features = [ "nix-command" "flakes" ];
    };

    system = {
      fsPackages = with pkgs; [
        sshfs-fuse
        fuse
        cryptsetup
      ];
    };

    hardware = {
      enableAllFirmware = true;
      nitrokey.enable = true;
      opengl = {
        driSupport32Bit = true;
      };
    };

    networking = {
      firewall.enable = false;
      useDHCP = false;
    };

    security.rtkit.enable = true;

    zramSwap.enable = true;

    users.users.dev = {
      isNormalUser = true;
      extraGroups = [ "nitrokey" "plugdev" "docker" "vboxusers" "wheel" "libvirtd" "wireshark" "video" "audio" ];
      uid = 1000;
      shell = "${pkgs.zsh}/bin/zsh";
    };

    nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
      "steam"
      "steam-original"
      "steam-runtime"
      "steam-run"
    ];

    programs = {
      dconf.enable = true;
      iftop.enable = true;
      iotop.enable = true;
      usbtop.enable = true;
      less.enable = true;
      steam.enable = true;
      tmux.enable = true;
      traceroute.enable = true;
      wireshark.enable = true;
      wavemon.enable = true;
      bandwhich.enable = true;
      git.enable = true;
      liboping.enable = true;
      htop.enable = true;
      fzf = {
        keybindings = true;
        fuzzyCompletion = true;
      };
      gnupg = {
        agent.enable = true;
        agent.enableSSHSupport = true;
        agent.pinentryPackage = pkgs.pinentry-gnome3;
      };
      ssh = {
        startAgent = false;
      };
      bash = {
        enableCompletion = true;
      };
      starship = {
        enable = true;
        settings = {
          command_timeout = 1000;
          nix_shell.disabled = false;
        };
      };
      zsh = {
        enable = true;
        promptInit = ''
          eval "$(${pkgs.starship}/bin/starship init zsh)"
          ${pkgs.any-nix-shell}/bin/any-nix-shell zsh --info-right | source /dev/stdin
        '';
        interactiveShellInit = ''
          zstyle ':completion:*' menu select
          source ${pkgs.fzf}/share/fzf/key-bindings.zsh
        '';
        shellAliases = {
          ls = "lsd";
          grep = "rg";
          ip = "ip --color=auto";
          tree = "broot";
          ps = "procs";
          ack = "ag";
          less = "peep";
        };
        setOptions = [
          "auto_cd"
          "auto_pushd"
          "correct"
          "hist_fcntl_lock"
          "hist_ignore_dups"
          "hist_no_store"
          "hist_reduce_blanks"
        ];
      };
    };

    environment = {
      sessionVariables = {
        XDG_SESSION_TYPE = "wayland";
        XDG_CURRENT_DESKTOP = "sway";
        MOZ_ENABLE_WAYLAND = "1";
        MOZ_USE_XINPUT2 = "1";
        SDL_VIDEODRIVER = "wayland";
        QT_QPA_PLATFORM = "wayland-egl";
        QT_WAYLAND_DISABLE_WINDOWDECORATION = "1";
        XKB_DEFAULT_LAYOUT = "gb";
      };
      shellInit = ''
        export GPG_AGENT_INFO=$HOME/.gnupg/S.gpg-agent
        export LIBVIRT_DEFAULT_URI=qemu:///system
        export LS_COLORS="$(vivid generate snazzy)"
        export LESS_TERMCAP_mb=$'\E[1;31m'
        export LESS_TERMCAP_md=$'\E[1;36m'
        export LESS_TERMCAP_me=$'\E[0m'
        export LESS_TERMCAP_so=$'\E[01;33m'
        export LESS_TERMCAP_se=$'\E[0m'
        export LESS_TERMCAP_us=$'\E[1;32m'
        export LESS_TERMCAP_ue=$'\E[0m'
        export EDITOR='vim'
      '';
      shells = [ pkgs.zsh ];
    };

    xdg.portal = {
      enable = true;
      extraPortals = with pkgs; [ xdg-desktop-portal-wlr xdg-desktop-portal-gtk ];
    };

    fonts = {
      fontconfig = {
        enable = true;
        useEmbeddedBitmaps = true;
      };
      enableGhostscriptFonts = true;
      packages = let
        mkNerdFont = src: pkgs.stdenv.mkDerivation {
          name = lib.removeSuffix ".zip" src.name;
          inherit src;
          sourceRoot = ".";
          nativeBuildInputs = [ pkgs.unzip ];
          dontBuild = true;
          patchPhase = "find -iname '*Windows Compatible*' -delete";
          installPhase = ''
            find -iname '*.otf' -exec install -vD -m0644 {} \
              "$out/share/fonts/opentype/NerdFonts/{}" \;
            find -iname '*.ttf' -exec install -vD -m0644 {} \
              "$out/share/fonts/truetype/NerdFonts/{}" \;
          '';
        };
      in with pkgs; [
        clearlyU
        fixedsys-excelsior
        cm_unicode
        corefonts
        cozette
        dosemu_fonts
        freefont_ttf
        google-fonts
        junicode
        siji
        tewi-font
        tt2020
        ultimate-oldschool-pc-font-pack
        unifont
        vistafonts
        wqy_microhei
      ] ++ lib.filter lib.isDerivation (lib.attrValues lohit-fonts)
        ++ map mkNerdFont pkgs.nerdfonts.srcs;
    };
  };
}