summaryrefslogtreecommitdiff
path: root/users/ryan/linux.nix
blob: a86cad1eab53f13eab3c1c7649d5552d3e4fda7c (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
{ config, pkgs, lib, inputs, ... }:

{
  imports = [
    ./linux/firefox-nightly
  ];

  home.username = "ryan";
  home.homeDirectory = "/home/ryan";
  home.stateVersion = "23.11"; # Please read the comment before changing.

  nixpkgs.config.allowUnfree = true;

  programs.zsh.shellAliases = {
    ls = "ls -p --color=auto";
    spt = "spotify_player";
    python = "python3";
  };

  # `nix shell nixpkgs#...`/`nix run nixpkgs#...` etc. resolve `nixpkgs` to
  # this flake's own pinned input instead of fetching latest nixpkgs-unstable.
  # This is the standalone-HM equivalent of RyanMac's /etc/nix/flake-registry.json.
  # HM owns the whole ~/.config/nix directory (including nix.conf) so this
  # doesn't end up writing through guix-dotfiles' `nix-config` symlink - see
  # MIGRATION.md.
  xdg.configFile."nix/nix.conf".text = "experimental-features = nix-command flakes\n";
  xdg.configFile."nix/registry.json".text = builtins.toJSON {
    version = 2;
    flakes = [
      {
        from = { type = "indirect"; id = "nixpkgs"; };
        to = {
          type = "path";
          path = inputs.nixpkgs.outPath;
          lastModified = inputs.nixpkgs.lastModified;
          narHash = inputs.nixpkgs.narHash;
        };
      }
    ];
  };

  # Non-NixOS (Guix), so HM has to write its own fontconfig instead of
  # relying on a system module.
  fonts.fontconfig.enable = true;
  fonts.fontconfig.defaultFonts = {
    monospace = [ "DejaVu Sans Mono" ];
    sansSerif = [ "DejaVu Sans" ];
    serif = [ "DejaVu Serif" ];
  };

  # Cursor theme. Replaces the previously hand-vendored Bibata asset (which
  # embedded oddly-versioned theme names) with nixpkgs' own build - see the
  # comment in linux/hypr/hyprland.conf for the corresponding env var change.
  home.pointerCursor = {
    enable = true;
    package = pkgs.bibata-cursors;
    name = "Bibata-Modern-Classic";
    size = 24;
    gtk.enable = true;
    x11.enable = true;
  };

  # gpg-agent itself is enabled in common.nix; nixpkgs' pinentry here instead
  # of depending on Guix's system profile path.
  services.gpg-agent.pinentry.package = pkgs.pinentry-qt;

  wayland.windowManager.hyprland = {
    enable = true;
    package = pkgs.hyprland;
    portalPackage = pkgs.xdg-desktop-portal-hyprland;
    extraConfig = builtins.readFile ./linux/hypr/hyprland.conf;
  };

  xdg.configFile = {
    "hypr/monitors.conf".source = ./linux/hypr/monitors.conf;
    "hypr/kanshi.conf".source = ./linux/hypr/kanshi.conf;
    "hypr/pyprland.toml".source = ./linux/hypr/pyprland.toml;
    "hypr/hypridle.conf".source = ./linux/hypr/hypridle.conf;
    "hypr/hyprlock.conf".source = ./linux/hypr/hyprlock.conf;
    "hypr/scripts" = { source = ./linux/hypr/scripts; recursive = true; };
    "hypr/family_guy.mp4".source = ./linux/hypr/family_guy.mp4;
    "hypr/subwaysurfer.webm".source = ./linux/hypr/subwaysurfer.webm;

    "waybar" = { source = ./linux/waybar; recursive = true; };
    "alacritty" = { source = ./linux/alacritty; recursive = true; };
    "foot" = { source = ./linux/foot; recursive = true; };
    "wpaperd" = { source = ./linux/wpaperd; recursive = true; };
    "mpv" = { source = ./linux/mpv; recursive = true; };

    "pulse/client.conf".source = ./linux/pulseaudio/client.conf;
    "spotify-player/app.toml".source = ./linux/spotify-player/app.toml;
  };

  home.file = {
    ".local/share/mailvelope" = { source = ./linux/mailvelope; recursive = true; };
    ".local/share/tridactyl" = { source = ./linux/tridactyl; recursive = true; };
    ".mozilla/native-messaging-hosts/tridactyl.json".source = ./linux/tridactyl/tridactyl.json;
  };

  home.packages = with pkgs; [
    rustup
    zoxide
    pnpm
    gcc
    pkg-config
    wttrbar
    wl-clip-persist
    gifski
    waypaper
    spotify-player
    xwayland
    xdg-desktop-portal
    xdg-desktop-portal-gtk
    mpv
    imv
    libva
    libvdpau
    hypridle
    hyprpicker
    wpaperd
    wl-mirror
    pyprland
    satty
    fluxcd
    sops
    restic
    kdePackages.kdenlive
    bluetui
    supercell-wx
    chromium

    # foot is Guix system-packaged and is the terminal actually wired into
    # the WM; alacritty's config was carried over from guix-dotfiles but
    # nothing provided its binary there either - see MIGRATION.md.
    alacritty

    # Nerd Fonts, replacing the hand-vendored ttf files that used to live in
    # guix-dotfiles/home-config/fonts (Fira Code and "Monofur For Powerline"
    # dropped - superseded by these, unreferenced anywhere)
    nerd-fonts.anonymice
    nerd-fonts.monofur
    nerd-fonts.lilex
    nerd-fonts.fira-code
    noto-fonts
    dejavu_fonts
    liberation_ttf
    noto-fonts-cjk-sans
    noto-fonts-color-emoji

    # hyprlock built by nix needs Guix's PAM/fontconfig libs preloaded to run
    # under the Guix system profile - same interop hack as before.
    (pkgs.writeScriptBin "hyprlock" ''
      #! ${pkgs.bash}/bin/bash
      export LD_PRELOAD="/run/current-system/profile/lib/libpam.so.0:/run/current-system/profile/lib/libfontconfig.so:$LD_PRELOAD"
      exec ${pkgs.hyprlock}/bin/hyprlock "$@"
    '')

    # Guix's mesa doesn't match nixpkgs', so GL apps built by nix need nixGL.
    inputs.nixgl.packages.${pkgs.system}.nixGLIntel
    inputs.clipboard-sync.packages.${pkgs.system}.default
  ];
}