summaryrefslogtreecommitdiff
path: root/accounts/gkleen@sif/default.nix
blob: 7982484491cd0c869bba8ca0e13b8a034a8a12b3 (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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
{ flake, userName, pkgs, customUtils, lib, config, ... }@inputs:
let
  cfg = config.home-manager.users.${userName};
  xmonad = import ./xmonad pkgs.haskellPackages;
  emacsclientDesktopItem = pkgs.makeDesktopItem {
    name = "emacsclient";
    genericName = "Text Editor";
    desktopName = "emacsclient";
    icon = "emacs";
    mimeType = "text/english;text/plain;text/x-makefile;text/x-c++hdr;text/x-c++src;text/x-chdr;text/x-csrc;text/x-java;text/x-moc;text/x-pascal;text/x-tcl;text/x-tex;application/x-shellscript;text/x-c;text/x-c++;";
    exec = "${config.home-manager.users.${userName}.programs.emacs.package}/bin/emacsclient -a \"\" %F";
  };
in {
  imports = with flake.nixosModules.userProfiles.${userName}; [
    mpv
  ];
  
  home-manager.users.${userName} = {
    programs = {
      ssh = {
        matchBlocks = import ./ssh-hosts.nix; # customUtils.recImport { dir = ./ssh-hosts; };
        extraConfig = ''
          Match host uniworx3.ifi.lmu.de,uniworx4.ifi.lmu.de,uni2workgw.ifi.lmu.de,blackbeard.tcs.ifi.lmu.de,gitlab2.rz.ifi.lmu.de,oregon.tcs.ifi.lmu.de !exec "nc -z -w 1 %h %p &>/dev/null"
            ProxyJump gate

          Host *
        '';
      };

      emacs = {
        enable = true;
        extraPackages = epkgs: with epkgs; [
          evil evil-dvorak evil-magit undo-tree magit haskell-mode
          nix-mode yaml-mode json-mode shakespeare-mode
          smart-mode-line highlight-parentheses highlight-symbol
          notmuch ag sass-mode lua-mode fira-code-mode
        ];
      };
      firefox = {
        enable = true;
        profiles.default = {
          settings = {
            "layout.css.devPixelsPerPx" = "1.75";
            "browser.tabs.drawInTitlebar" = false;
            "toolkit.legacyUserProfileCustomizations.stylesheets" = true;
            "dom.security.https_only_mode" = true;
          };
        };
      };

      urxvt = {
        enable = true;
        package = pkgs.rxvt_unicode-with-plugins;
        fonts = [ "xft:FiraCode Nerd Font Mono:style=Regular:pixelsize=21" ];
        scroll = {
          lines = 0;
          bar.enable = false;
        };
        extraConfig = {
          urgentOnBell = false;
          print-pipe = "cat >/dev/null";
          perl-ext-common = "52-osc,url-select";
          "url-select.launcher" = "firefox";
          "url-select.underline" = true;
        };
        keybindings = {
          "M-u" = "perl:url-select:select_next";
        };
      };

      zathura = {
        enable = true;
        package = pkgs.zathura.override { useMupdf = false; };
      };

      mpv.config = {
        demuxer-max-bytes = 1073741824;
        demuxer-max-back-bytes = 268435456;
      };

      autorandr = {
        enable = true;
        hooks.postswitch = {
          # "restart-compton" = "${pkgs.systemd}/bin/systemctl --user try-restart picom";
          "restart-trays" = ''
              ${pkgs.coreutils}/bin/sleep 5
              ${pkgs.systemd}/bin/systemctl --user try-restart trayer xmobar
            '';
        };
        profiles = customUtils.recImport { dir = ./autorandr-profiles; };
      };

      zsh.initExtra = "source ${./zshrc}";
      zsh.dirHashes = {
        u2w = "$HOME/projects/uni2work";
        docs = "$HOME/documents";
        dl = "$HOME/Downloads";
        flk = "$HOME/config/nixos-flakes";
      };
    };

    services = {
      dunst = {
        settings = import ./dunst-settings.nix;
        iconTheme = cfg.gtk.iconTheme;
        enable = true;
      };
      emacs.enable = true;
      gpg-agent = {
        enable = true;
        enableSshSupport = true;
        extraConfig = ''
          pinentry-program ${pkgs.pinentry-gtk2}/bin/pinentry
          grab
        '';
      };
      pasystray.enable = true;
      udiskie = {
        enable = true;
        automount = false;
      };
      unclutter = {
        enable = true;
        timeout = 5;
      };
      network-manager-applet.enable = true;
      blueman-applet.enable = true;

      sxhkd = {
        enable = true;
        keybindings = {
          "button8" = "${pkgs.pulseaudio}/bin/pacmd set-source-mute @DEFAULT_SOURCE@ 0";
          "@button8" = "${pkgs.pulseaudio}/bin/pacmd set-source-mute @DEFAULT_SOURCE@ 1";
          "button9" = "${pkgs.pulseaudio}/bin/pacmd set-sink-mute @DEFAULT_SINK@ 1";
          "@button9" = "${pkgs.pulseaudio}/bin/pacmd set-sink-mute @DEFAULT_SINK@ 0";
        };
      };
    };

    gtk = {
      enable = true;
      font.name = "DejaVu Sans 6";
      theme = {
        package = pkgs.equilux-theme;
        name = "Equilux-compact";
      };
      iconTheme = {
        package = pkgs.paper-icon-theme;
        name = "Paper";
      };
    };

    xsession = {
      enable = true;

      windowManager.command = "${xmonad}/bin/xmonad";

      initExtra = let
          lockScript = pkgs.writeScript "lock" ''
            #!${pkgs.stdenv.shell}
            ${pkgs.playerctl}/bin/playerctl -a pause
            exec ${pkgs.xsecurelock}/bin/xsecurelock
          '';
        in ''
             ${pkgs.coreutils}/bin/env XSECURELOCK_WANT_FIRST_KEYPRESS=1 XSECURELOCK_DIM_ALPHA=1 ${pkgs.xss-lock}/bin/xss-lock -l -n ${pkgs.xsecurelock}/libexec/xsecurelock/dimmer -- ${lockScript} &
             ${pkgs.xorg.xinput}/bin/xinput disable 'SynPS/2 Synaptics TouchPad' # Synaptics TM3512-010
             ${pkgs.xorg.xset}/bin/xset s 590 10
           '';
    };

    xresources.properties = import ./xresources.nix;

    home = {
      packages = with pkgs; [
        fira-code powerline-fonts nerdfonts pavucontrol keepassxc
        youtube-dl sxiv xclip mumble pulseaudio-ctl libnotify synergy
        xorg.xbacklight screen-message pidgin-with-plugins
        google-play-music-desktop-player qt5ct playerctl evince
        thunderbird zulip zoom-us steam steam-run wireshark skype
        virt-manager rclone cached-nix-shell xournal discord xmonad
        worktime fira-code-symbols emacsclientDesktopItem
      ];

      file = {
        ".emacs".source = ./emacs.el;
        ".backup-munin".source = ./backup-patterns;
        ".mozilla/firefox/default/chrome/userChrome.css".source = ./firefox-chrome.css;
        ".mozilla/firefox/default/chrome/userContent.css".source = ./firefox-content.css;
      };

      sessionVariables = {
        GDK_SCALE = 96.0 / 282.0;
        QT_AUTO_SCREEN_SCALE_FACTOR = 1;
        QT_QPA_PLATFORMTHEME = "qt5ct";
      };

      extraProfileCommands = ''
        export XDG_DATA_DIRS="${pkgs.gsettings-desktop-schemas}/share/gsettings-schemas/${pkgs.gsettings-desktop-schemas.name}:${pkgs.gtk3}/share/gsettings-schemas/${pkgs.gtk3.name}''${XDG_DATA_DIRS:+:''${XDG_DATA_DIRS}}"
      '';

      stateVersion = "20.03";
    };

    fonts.fontconfig.enable = true;

    systemd.user = import ./systemd.nix inputs;
  };
}