~sumner/home-manager-config

e3cf859aa49e762b32fc177a29ecb088becc5da0 — Sumner Evans 8 months ago f657d59
Lots more additions to home manager
M host-configurations/coruscant.nix => host-configurations/coruscant.nix +1 -0
@@ 1,5 1,6 @@
{ ... }: {
  xorg.enable = true;
  xorg.remapEscToCaps = false;
  networking.interfaces = [ "enp37s0" "wlp35s0" ];
  programs.i3status-rust.extraBlocks = [
    {

M programs/alacritty.nix => programs/alacritty.nix +1 -1
@@ 3,7 3,7 @@
    enable = true;
    settings = {
      window.title = "Terminal";
      font.size = 11.5;
      font.size = 10;

      # Colors (One Dark)
      # https://github.com/eendroroy/alacritty-theme/blob/master/themes/one_dark.yaml

M programs/default.nix => programs/default.nix +1 -0
@@ 17,6 17,7 @@ in
    ./i3status-rust.nix
    ./neovim.nix
    ./newsboat.nix
    ./rofi.nix
    ./tmux.nix
    ./zsh
  ];

A programs/rofi.nix => programs/rofi.nix +16 -0
@@ 0,0 1,16 @@
{ pkgs, ... }: {
  programs.rofi = {
    enable = true;
    font = "pango:Iosevka 12";
    lines = 15;
    location = "top";
    terminal = "${pkgs.alacritty}/bin/alacritty";
    theme = "solarized_alternate";
    width = 25;
    yoffset = 80;
    extraConfig = {
      matching = "fuzzy";
    };
  };
  programs.rofi.pass.enable = true;
}

M programs/zsh/aliases.nix => programs/zsh/aliases.nix +0 -1
@@ 33,7 33,6 @@ in
      gst = "git stash";

      # Config
      i3conf = "chezmoi edit -a ~/.config/i3/config";
      muttrc = "chezmoi edit -a ~/.mutt/muttrc && chezmoi apply";
      nvimrc = "chezmoi edit -a ~/.config/nvim/init.vim";
      projectlist = "vim ~st/projectlist && projectsync";

M services/window-manager/common.nix => services/window-manager/common.nix +11 -3
@@ 61,7 61,6 @@
        assigns = {
          # Browsers
          "${elemAt workspaces 0}" = [
            { class = "Pale moon"; }
            { class = "Firefox"; }
          ];



@@ 69,8 68,6 @@
          "${(elemAt extraWorkspaces 0).name}" = [
            { class = "discord"; }
            { class = "Element"; }
            { class = "HexChat"; }
            { class = "quassel"; }
            { class = "Slack"; }
            { class = "Telegram"; }
            { title = "Mutt"; }


@@ 158,6 155,17 @@
          # VOLUME KEYS
          XF86AudioLowerVolume = "exec amixer set Master playback 2%-";
          XF86AudioRaiseVolume = "exec amixer set Master playback 2%+";
          XF86AudioMute = "exec amixer set Master toggle";

          # MEDIA CONTROLS
          XF86AudioPrev = "exec playerctl previous";
          XF86AudioPlay = "exec playerctl play-pause";
          XF86AudioStop = "exec playerctl stop";
          XF86AudioNext = "exec playerctl next";

          # SCREEN BRIGHTNESS CONTROLS
          XF86MonBrightnessDown = mkIf config.laptop.enable "exec brightnessctl s 5%-";
          XF86MonBrightnessUp = mkIf config.laptop.enable "exec brightnessctl s +5%";
        };

        keycodebindings = listToAttrs (

M services/window-manager/default.nix => services/window-manager/default.nix +0 -2
@@ 21,8 21,6 @@ in
  config = mkIf (waylandCfg.enable || xorgCfg.enable) {
    home.packages = with pkgs; [
      brightnessctl
      rofi
      rofi-pass
      screenkey
    ];


M services/window-manager/wayland.nix => services/window-manager/wayland.nix +2 -2
@@ 52,7 52,7 @@ in
        in
          {
            # Popup Clipboard Manager
            "${modifier}+c" = "exec ${clipmanCmd} pick -t rofi ${clipmanHistpath}";
            "${modifier}+c" = "exec ${clipmanCmd} pick -t ${pkgs.rofi}/bin/rofi ${clipmanHistpath}";

            # Lock screen
            "${modifier}+Shift+x" = "exec ${swaylockCmd}";


@@ 62,7 62,7 @@ in

            # Screenshots
            "${modifier}+shift+c" = ''exec ${grim} -g "$(${slurp})" ${screenshotOutfile}'';
            "${modifier}+shift+ctrl+c" = "exec ${grim} ${screenshotOutfile}";
            Print = "exec ${grim} ${screenshotOutfile}";
          };

        extraConfig = ''

M services/window-manager/xorg.nix => services/window-manager/xorg.nix +84 -31
@@ 1,37 1,44 @@
{ config, lib, pkgs, ... }: with lib; let
  cfg = config.xorg;
  common = import ./common.nix { inherit config lib pkgs; };

  modifier = config.windowManager.modKey;
  tmpdir = "${config.home.homeDirectory}/tmp";
  mvTmp = "${pkgs.coreutils}/bin/mv $f ${tmpdir}";
  scrotCmd = "${pkgs.scrot}/bin/scrot '%Y-%m-%d-%T.png'";
  i3lockcmd = "${pkgs.i3lock-fancy}/bin/i3lock-fancy --font Iosevka -- ${scrotCmd} -z";
in
{
  options = {
    xorg.enable = mkOption {
  options.xorg = {
    enable = mkOption {
      type = types.bool;
      description = "Enable Xorg stack";
      default = false;
    };
    xorg.extrai3wmConfig = mkOption {
    extrai3wmConfig = mkOption {
      type = types.attrsOf types.anything;
      description = "Extra config for i3wm";
      default = {};
    };
    remapEscToCaps = mkOption {
      type = types.bool;
      description = "Remap the physical escape key to Caps Lock";
      default = true;
    };
  };

  config = mkIf cfg.enable {
    xsession.windowManager.i3 = mkMerge [
      common.i3SwayConfig
      {
        config.startup = [
          { command = "${config.home.homeDirectory}/bin/display-configuration.sh"; }
          { command = "systemctl --user import-environment; systemctl --user start graphical-session.target"; }
        ];

        config.keybindings = let
          modifier = config.windowManager.modKey;
          scrot = "${pkgs.scrot}/bin/scrot";
          i3lockcmd = "${pkgs.i3lock-fancy}/bin/i3lock-fancy --font Iosevka -- ${scrot} -z";
          tmpdir = "${config.home.homeDirectory}/tmp";
        in
          {
    xsession = {
      enable = true;

      windowManager.i3 = mkMerge [
        common.i3SwayConfig
        {
          config.startup = [
            { command = "${config.home.homeDirectory}/bin/display-configuration.sh"; }
          ];

          config.keybindings = {
            # Popup Clipboard Manager
            "${modifier}+c" = "exec ${pkgs.clipmenu}/bin/clipmenu";



@@ 39,16 46,28 @@ in
            "${modifier}+Shift+x" = "exec ${config.home.homeDirectory}/bin/fuzzy_lock_sleep.sh";

            # exit i3wm (logs you out of your session)
            "${modifier}+Shift+e" = "exec ${pkgs.i3-gaps}/bin/i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -b 'Yes, exit i3' 'i3-msg exit'";
            "${modifier}+Shift+e" = ''exec "${pkgs.i3-gaps}/bin/i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -b 'Yes, exit i3' 'i3-msg exit'"'';

            # Screenshots
            "${modifier}+shift+c" = "${scrot} -s '%Y-%m-%d-%T.png' -e 'mv $f ${tmpdir} && xclip -selection clipboard -i ${tmpdir}/$f -t image/png'";
            "${modifier}+shift+ctrl+c" = "exec ${scrot}";
            "${modifier}+shift+f" = "exec ${pkgs.flameshot}/bin/flameshot gui -p ${tmpdir}";
            "${modifier}+shift+ctrl+c" = ''exec "${scrotCmd} -e '${mvTmp}'"'';
            "${modifier}+shift+c" = ''exec "${pkgs.flameshot}/bin/flameshot gui -p ${tmpdir}"'';
            "${modifier}+shift+f" = ''exec "${pkgs.flameshot}/bin/flameshot gui -p ${tmpdir}"'';
            Print = ''exec "${scrotCmd} -e '${mvTmp}'"'';
          };
      }
      cfg.extrai3wmConfig
    ];
        }
        cfg.extrai3wmConfig
      ];

      pointerCursor = {
        package = pkgs.capitaine-cursors;
        name = "Capitaine";
        size = 16;
      };
    };

    xresources.extraConfig = ''
      Xft.dpi: 100
    '';

    services.clipmenu.enable = true;
    home.sessionVariables = {


@@ 56,10 75,17 @@ in
      CM_LAUNCHER = "rofi";
    };

    # xsession.pointerCursor = {
    #   package = pkgs.capitaine-cursors;
    #   name = "Capitaine";
    # };
    home.packages = with pkgs; [
      dunst
      flameshot
      i3lock
      lxappearance
      scrot
      xclip
      xorg.xbacklight
      xorg.xdpyinfo
      xorg.xprop
    ];

    services.redshift = common.redshiftGammastepCfg;



@@ 100,8 126,9 @@ in

      inactiveOpacity = "0.8";
      opacityRule = [
        "100:class_g = 'obs'"
        "100:class_g = 'i3lock'"
        "100:class_g *= 'obs'"
        "100:class_g *= 'i3lock'"
        "100:class_g ?= 'rofi'"
      ];

      shadow = true;


@@ 114,5 141,31 @@ in
        "_GTK_FRAME_EXTENTS@:c"
      ];
    };

    systemd.user.services = let
      xmodmapConfig = pkgs.writeText "Xmodmap.conf" ''
        ! Reverse scrolling
        ! pointer = 1 2 3 5 4 6 7 8 9 10 11 12
        keycode 9 = Caps_Lock Caps_Lock Caps_Lock
      '';
      startupServices = {
        xbanish = "${pkgs.xbanish}/bin/xbanish";
      } // (
        optionalAttrs cfg.remapEscToCaps {
          xmodmap = "${pkgs.xorg.xmodmap}/bin/xmodmap ${xmodmapConfig}";
        }
      );
    in
      mapAttrs (
        name: value: {
          Unit = {
            Description = "Run ${name} on startup.";
            PartOf = [ "graphical-session.target" ];
          };
          Service.ExecStart = value;
          Service.Restart = "always";
          Install.WantedBy = [ "graphical-session.target" ];
        }
      ) startupServices;
  };
}