summaryrefslogtreecommitdiff
path: root/env/wsl/wsl-dev-host.nix
blob: 0e9877ec512d70ff4ef8a22cc9d03c350469a453 (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
{ config, lib, pkgs, ... }:
let
  inherit (import ./settings.nix) user font scheme;
in {
  wsl = {
    enable = true;
    defaultUser = user;
    useWindowsDriver = true;
  };

  users.users.${user}.extraGroups = [ "audio" "video" ];

  nix = {
    settings = {
      experimental-features = [ "nix-command" "flakes" ];
      trusted-users = [ user ];
    };
  };

  nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
  boot.supportedFilesystems = [ "ntfs" "nfs" ];
  boot.kernelParams = [ "mitigations=off" ];

  nixpkgs.config.allowUnfree = true;
  hardware.enableRedistributableFirmware = true;

  networking.hostName = "wsl-dev";
  networking.firewall.enable = false;

  services.pulseaudio.enable = true;

  xdg.portal = {
    enable = true;
    extraPortals = [ pkgs.xdg-desktop-portal-gtk ];
    config.common.default = "*";
  };

  environment.systemPackages = with pkgs; [
    git
    htop
    neovim
    kitty
    pavucontrol
    glxinfo
    neofetch
    cmatrix
  ];

  # @TEMP: https://github.com/nix-community/NixOS-WSL/issues/650
  # Needed for Wayland.
  systemd.services."user-runtime-dir@" = {
    overrideStrategy = "asDropin";
    serviceConfig.ExecStart = [
      "" # unset old value
      "${pkgs.coreutils}/bin/true"
    ];
  };

  fonts = {
    fontDir.enable = true;
    packages = with pkgs; [
      corefonts
      vistafonts
      noto-fonts
      noto-fonts-extra
      noto-fonts-cjk-sans
      noto-fonts-cjk-serif
      noto-fonts-emoji-blob-bin
      ubuntu_font_family
    ];
    fontconfig = {
      enable = true;
      includeUserConf = false;
      antialias = true;
      hinting.enable = true;
      allowBitmaps = true;
      subpixel = {
        rgba = "rgb";
        lcdfilter = "default";
      };
      defaultFonts = {
        serif = [ "Ubuntu Light" ];
        sansSerif = [ "Ubuntu Light" ];
        monospace = [ font.name ];
        emoji = [ "Blobmoji" ];
      };
    };
  };

  environment.sessionVariables = {
    TERMINAL = "kitty";
  };

  home-manager.users.${user} = let
    homeDir = "${config.users.users.${user}.home}";
  in {
    programs.bash = {
      enable = true;
      enableCompletion = false;
      initExtra = ''
        PS1="\u@\H:\w > "
      '';
    };
    programs.kitty = {
      enable = true;
      font = {
        name = font.name;
        size = font.size;
      };
      shellIntegration = {
        mode = "enabled";
        enableBashIntegration = true;
      };
      extraConfig = ''
        shell ${pkgs.bashInteractive}/bin/bash --login
        update_check_interval 0
        confirm_os_window_close 0
        enable_audio_bell no
        allow_remote_control yes
        linux_display_server x11
        initial_window_width 800
        initial_window_height 600
        remember_window_size yes
        placement_strategy top-left
        disable_ligatures always
        modify_font baseline ${font.baseline}
        cursor #${scheme.foreground}
        foreground #${scheme.foreground}
        background #${scheme.background}
        color0 #${scheme.color0}
        color1 #${scheme.color1}
        color2 #${scheme.color2}
        color3 #${scheme.color3}
        color4 #${scheme.color4}
        color5 #${scheme.color5}
        color6 #${scheme.color6}
        color7 #${scheme.color7}
        color8 #${scheme.color8}
        color9 #${scheme.color9}
        color10 #${scheme.color10}
        color11 #${scheme.color11}
        color12 #${scheme.color12}
        color13 #${scheme.color13}
        color14 #${scheme.color14}
        color15 #${scheme.color15}
        selection_foreground #${scheme.background}
        selection_background #${scheme.color6}
        mark1_foreground #${scheme.background}
        mark1_background #${scheme.color5}
        mark2_foreground #${scheme.background}
        mark2_background #${scheme.color6}
        mark3_foreground #${scheme.background}
        mark3_background #${scheme.color4}
        background_opacity 0.965
      '';
    };
    programs.neovim = {
      enable = true;
      viAlias = true;
      vimAlias = true;
    };
    home.stateVersion = "${config.system.stateVersion}";
  };

  system.stateVersion = "25.05";
}