DEVELOPMENT ENVIRONMENT

~liljamo/nix-arta

33f3c514a7b5f01d3d0cdac25a55354c54e3f0d8 — Jonni Liljamo 4 months ago 62f07cf
feat: hyprland, kitty, shell env
6 files changed, 321 insertions(+), 0 deletions(-)

M hosts/arwen/default.nix
M roles/default.nix
A roles/direnv.elv
A roles/hyprland.nix
A roles/kitty.nix
A roles/shell.nix
M hosts/arwen/default.nix => hosts/arwen/default.nix +3 -0
@@ 33,5 33,8 @@
    '';
  };

  roles.shell.enable = true;
  roles.zellij.enable = true;
  roles.kitty.enable = true;
  roles.hyprland.enable = true;
}

M roles/default.nix => roles/default.nix +3 -0
@@ 4,7 4,10 @@
    ./bluetooth.nix
    ./base.nix
    ./git.nix
    ./hyprland.nix
    ./kitty.nix
    ./nix.nix
    ./shell.nix
    ./zellij.nix
  ];
}

A roles/direnv.elv => roles/direnv.elv +18 -0
@@ 0,0 1,18 @@
## hook for direnv as of direnv 2.34.0
set @edit:before-readline = $@edit:before-readline {
	try {
		var m = [("direnv" export elvish | from-json)]
		if (> (count $m) 0) {
			set m = (all $m)
			keys $m | each { |k|
				if $m[$k] {
					set-env $k $m[$k]
				} else {
					unset-env $k
				}
			}
		}
	} catch e {
		echo $e
	}
}

A roles/hyprland.nix => roles/hyprland.nix +141 -0
@@ 0,0 1,141 @@
{
  config,
  lib,
  ...
}: let
  cfg = config.roles.hyprland;
in {
  options.roles.hyprland = {
    enable = lib.mkEnableOption "enable hyprland";
  };

  config = lib.mkIf cfg.enable {
    programs.hyprland.enable = true;

    hm = {
      wayland.windowManager.hyprland = {
        enable = true;
        settings = {
          monitor = [
            "eDP-1,1920x1080@60,0x0,1"
          ];

          exec-once = [
            "wpaperd"
          ];

          general = {
            border_size = 1;
            gaps_in = 2;
            gaps_out = 2;
          };

          decoration = {
            rounding = false;
            drop_shadow = false;
            blur = {
              enabled = false;
            };
          };

          animations = {
            enabled = false;
            first_launch_animation = false;
          };

          input = {
            kb_layout = "us,fi,no";
            kb_options = "grp:win_space_toggle,ctrl:nocaps";
            accel_profile = "flat";
            touchpad = {
              disable_while_typing = false;
            };
          };

          misc = {
            disable_hyprland_logo = true;
            disable_splash_rendering = true;
          };

          "$mod" = "SUPER";
          bind = [
            "$mod, Return, exec, kitty"
            "$mod SHIFT, return, exec, bemenu-run"
            "$mod SHIFT, x, exec, hyprlock"

            "$mod SHIFT, c, killactive"
            "$mod SHIFT, q, exit"

            "$mod, f, fullscreen, 0"
            "$mod SHIFT, space, togglefloating"

            "$mod, Tab, cyclenext,"
            "$mod, Tab, bringactivetotop,"

            "$mod, h, movefocus, l"
            "$mod, j, movefocus, d"
            "$mod, k, movefocus, u"
            "$mod, l, movefocus, r"
            "$mod SHIFT, h, movewindow, l"
            "$mod SHIFT, j, movewindow, d"
            "$mod SHIFT, k, movewindow, u"
            "$mod SHIFT, l, movewindow, r"

            "$mod, 1, workspace, 1"
            "$mod, 2, workspace, 2"
            "$mod, 3, workspace, 3"
            "$mod, 4, workspace, 4"
            "$mod SHIFT, 1, movetoworkspace, 1"
            "$mod SHIFT, 2, movetoworkspace, 2"
            "$mod SHIFT, 3, movetoworkspace, 3"
            "$mod SHIFT, 4, movetoworkspace, 4"
          ];
          binde = [
            "$mod CTRL, h, resizeactive, -10 0"
            "$mod CTRL, j, resizeactive, 0 -10"
            "$mod CTRL, k, resizeactive, 0 10"
            "$mod CTRL, l, resizeactive, 10 0"
          ];

          bindm = [
            "$mod, mouse:272, movewindow"
            "$mod, mouse:273, resizewindow"
          ];
        };
      };

      services.hypridle = {
        enable = true;
        settings = {
          listener = [
            {
              timeout = 500;
            }
          ];
          general.lock_cmd = "hyprlock";
        };
      };

      programs.hyprlock = {
        enable = true;
        settings = {
          background = [
            {
              path = "/home/skye/dev/femboys.png";
            }
          ];
        };
      };

      programs.wpaperd = {
        enable = true;
        settings = {
          eDP-1 = {
            path = "/home/skye/wallpapers/middleearth";
            duration = "5m";
          };
        };
      };
    };
  };
}

A roles/kitty.nix => roles/kitty.nix +80 -0
@@ 0,0 1,80 @@
{
  config,
  lib,
  ...
}: let
  cfg = config.roles.kitty;
in {
  options.roles.kitty = {
    enable = lib.mkEnableOption "enable kitty";
  };

  config.hm = lib.mkIf cfg.enable {
    programs.kitty = {
      enable = true;
      settings = {
        shell = "elvish";

        font_family = "FiraCode Nerd Font Mono";
        bold_font = "auto";
        italic_font = "auto";
        bold_italic_font = "auto";

        font_size = "12.0";

        enable_audio_bell = false;

        window_padding_width = 10;

        background_opacity = "0.9";

        foreground = "#5c6a72";
        background = "#fffbef";

        selection_foreground = "#829181";
        selection_background = "#f0f2d4";

        cursor = "#5c6a72";
        cursor_text_color = "#f8f5e4";

        url_color = "#3a94c5";

        active_border_color = "#8da101";
        inactive_border_color = "#bec5b2";
        bell_border_color = "#f57d26";
        visual_bell_color = "none";

        active_tab_background = "#fffbef";
        active_tab_foreground = "#5c6a72";
        inactive_tab_background = "#f2efdf";
        inactive_tab_foreground = "#939f91";
        tab_bar_background = "#f8f5e4";
        tab_bar_margin_color = "none";

        mark1_foreground = "#fffbef";
        mark1_background = "#3a94c5";
        mark2_foreground = "#fffbef";
        mark2_background = "#d3c6aa";
        mark3_foreground = "#fffbef";
        mark3_background = "#df69ba";

        color0 = "#708089";
        color8 = "#829181";
        color1 = "#f85552";
        color9 = "#e66868";
        color2 = "#8da101";
        color10 = "#93b259";
        color3 = "#dfa000";
        color11 = "#dfa000";
        color4 = "#3a94c5";
        color12 = "#3a94c5";
        color5 = "#df69ba";
        color13 = "#df69ba";
        color6 = "#35a77c";
        color14 = "#35a77c";
        color7 = "#939f91";
        color15 = "#a6b0a0";
      };
    };
  };
}

A roles/shell.nix => roles/shell.nix +76 -0
@@ 0,0 1,76 @@
{
  config,
  lib,
  pkgs,
  ...
}: let
  cfg = config.roles.shell;
in {
  options.roles.shell = {
    enable = lib.mkEnableOption "an opnionated shell environment";
  };

  config = lib.mkIf cfg.enable {
    environment.systemPackages = [pkgs.elvish];
    programs.direnv = {
      enable = true;
      nix-direnv.enable = true;
    };
    hm = {
      home.file = {
        ".config/elvish/lib/direnv.elv" = {
          executable = true;
          source = ./direnv.elv;
        };
        ".config/elvish/rc.elv" = {
          executable = true;
          text = ''
            #!/usr/bin/env elvish
            use direnv
            eval (starship init elvish)
          '';
        };
      };
      programs.bash = {
        enable = true;
        bashrcExtra = ''
          eval "$(direnv hook bash)"
          eval "$(starship init bash)"
        '';
      };
      programs.starship = {
        enable = true;
        settings = {
          add_newline = false;
          scan_timeout = 10;
          /*
          format = lib.concatStrings [
            "$line_break"
            "$shell"
            "$nix_shell"
            "$directory"
            "$character"
          ];
          #format_right = lib.concatStrings [
          #
          #];
          character = {
            success_symbol = " >";
            error_symbol = " >";
          };
          directory = {
            truncation_length = 3;
            truncate_to_repo = true;
            format = "[$path](bold cyan)";
          };
          */
          shell = {
            disabled = false;
            bash_indicator = "bsh";
            elvish_indicator = "elv";
          };
        };
      };
    };
  };
}