Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(emacs): Add dart support #354

Merged
merged 15 commits into from
Jan 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 32 additions & 32 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

inputs = {
# NixOS related inputs
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";

nixos-hardware.url = "github:NixOS/nixos-hardware/master";
sops-nix = {
Expand Down Expand Up @@ -35,7 +35,7 @@

# home-manager related inputs
home-manager = {
url = "github:nix-community/home-manager/release-24.05";
url = "github:nix-community/home-manager/release-24.11";
inputs.nixpkgs.follows = "nixpkgs";
};
nurpkgs.url = "github:nix-community/NUR";
Expand Down Expand Up @@ -89,6 +89,10 @@
};
};

nixosModules = {
nvidia = import ./nixos-modules/nvidia;
};

homeConfigurations = {
# NixOS home configuration setup lives in
# nixos-config/default.nix and their respective host-specific
Expand Down
4 changes: 4 additions & 0 deletions home-config/config/desktop/default.nix
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{ pkgs, ... }:
{
imports = [
./dunst.nix
Expand All @@ -7,6 +8,9 @@
./sway.nix
];

home.packages = with pkgs; [
caffeine-ng
];
services.caffeine.enable = true;
xsession.importedVariables = [ "PATH" ];
}
20 changes: 20 additions & 0 deletions home-config/config/desktop/sway.nix
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ in
home.packages = [
keepassxc-copy
pkgs.glib
pkgs.sway-contrib.grimshot
];

wayland.windowManager.sway = {
Expand Down Expand Up @@ -91,6 +92,25 @@ in
};
};

programs.eww = {
enable = true;
configDir = ../../dotfiles/eww;
};

systemd.user.services.eww = {
Unit = {
Description = "System tray";
After = [ "graphical-session-pre.target" ];
PartOf = [ "graphical-session.target" ];
};

Service = {
ExecStart = "${config.programs.eww.package}/bin/eww daemon --no-daemonize";
ExecStartPost = "${config.programs.eww.package}/bin/eww open tray";
};
Install.WantedBy = [ "graphical-session.target" ];
};

systemd.user.services.swaylock = {
Unit.Description = "Lock screen";
Service.ExecStart = "${config.programs.swaylock.package}/bin/swaylock";
Expand Down
1 change: 1 addition & 0 deletions home-config/config/xdg-settings.nix
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ in
_JAVA_OPTIONS = concatStringsSep " " [
"-Djava.util.prefs.userRoot='${xdg.configHome}'/java"
"-Djavafx.cachedir='${xdg.cacheHome}/openjfx'"
"-Dorg.lwjgl.glfw.libname='${pkgs.glfw-wayland-minecraft}/lib/libglfw.so'"
];
LESSKEY = "${xdg.cacheHome}/less/key";
LESSHISTFILE = "${xdg.cacheHome}/less/history";
Expand Down
3 changes: 2 additions & 1 deletion home-config/dotfiles/emacs.d/config/editing.el
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@
(leaf files
:ensure nil
:custom (require-final-newline . "visit-save")
:custom (major-mode-remap-alist . '((sh-mode . bash-ts-mode))))
:custom (major-mode-remap-alist . '((sh-mode . bash-ts-mode)
(css-mode . css-ts-mode))))

;; ----------------------------------------------------------------------------------
;;; Snippets
Expand Down
19 changes: 17 additions & 2 deletions home-config/dotfiles/emacs.d/config/programming-languages.el
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@
;; ----------------------------------------------------------------------------------

(leaf scss-mode
:ensure nil
:mode `(,(rx (or ".sass" ".scss") string-end))
:hook (scss-mode-hook . (lambda () (setq-local devdocs-current-docs '("css" "sass")))))

Expand All @@ -245,6 +246,14 @@
string-end)
. systemd-mode))

;; ----------------------------------------------------------------------------------
;;; Dart
;; ----------------------------------------------------------------------------------

(leaf dart-mode
:mode `(,(rx ".dart" string-end))
:hook (dart-mode-hook . (lambda () (set (make-local-variable 'eglot-x-client-commands) '()))))

;; ----------------------------------------------------------------------------------
;;; TypeScript (and other web-related DSLs)
;; ----------------------------------------------------------------------------------
Expand Down Expand Up @@ -307,7 +316,8 @@
(leaf eglot
:commands (eglot eglot-format eglot-managed-p)
:hook (((kotlin-mode-hook web-mode-hook rust-mode-hook python-mode-hook
sh-mode-hook bash-ts-mode-hook c-mode-hook c++-mode-hook nix-mode-hook json-mode-hook) .
sh-mode-hook bash-ts-mode-hook c-mode-hook c++-mode-hook nix-mode-hook json-mode-hook
dart-mode-hook) .
eglot-ensure)
(eglot-managed-mode-hook . set-eldoc-compose))
:bind (:eglot-mode-map
Expand Down Expand Up @@ -400,7 +410,10 @@
(reformatter-define latexindent
:program "latexindent"
:group 'latex-mode
:lighter " LF")))
:lighter " LF")
(reformatter-define dart-format
:program "dart"
:args '("format"))))

(defun autoformat ()
"Autoformat the current buffer."
Expand All @@ -410,6 +423,8 @@
(clang-format-buffer))
('latex-mode
(latexindent-buffer))
('dart-mode
(dart-format-buffer))
((or 'mhtml-mode 'web-mode 'scss-mode 'json-mode)
(biome-format-buffer))
('haskell-mode (haskell-mode-stylish-buffer))
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# -*- mode: snippet -*-
# name: git-conventional-commit
# key: c
# condition: (git-commit-mode)
# --
${1:type$(yas-choose-value '( "feat" "fix" "test" "chore" "refactor" "doc" "style" "release" "update" "bump" "perf" "ci"))}${2:(scope)}: ${3:Commit message}

$0
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# -*- mode: snippet -*-
# name: git-conventional-commit
# key: c!
# condition: (git-commit-mode)
# --
${1:type$(yas-choose-value '( "feat" "fix" "test" "chore" "refactor" "doc" "style" "release" "update" "bump" "perf" "ci"))}${2:(scope)}!: ${3:Commit message}

$0
5 changes: 5 additions & 0 deletions home-config/dotfiles/eww/eww.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
* { all: unset; }

.tray-items {
font-size: 1.35em;
}
49 changes: 49 additions & 0 deletions home-config/dotfiles/eww/eww.yuck
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
(defwindow tray
:monitor 0
:geometry (geometry :height "0%"
:width "0%"
:anchor "bottom left")
:stacking "bottom"
:exclusive true
:focusable false

(_tray_items))

(defwidget _tray_items []
(box :class "tray-items"

:spacing 3
:vexpand true
:hexpand true
:valign "center"
:halign "start"
:space-evenly false

(_battery_icon)
(_clock)
"|"
(systray :spacing 5
:orientation "horizontal"
:space-evenly false)))

(defwidget _battery_icon []
(label :text {
EWW_BATTERY == "" ? "" :
jq(EWW_BATTERY, "first(.[])").status == "Charging" ?
"" :
jq(EWW_BATTERY, "first(.[])").capacity > 75 ?
"" :
jq(EWW_BATTERY, "first(.[])").capacity > 50 ?
"" :
jq(EWW_BATTERY, "first(.[])").capacity > 25 ?
"" :
jq(EWW_BATTERY, "first(.[])").capacity > 5 ?
"" :
""
}
:visible {EWW_BATTERY != ""}
:tooltip "${EWW_BATTERY == "" ? "" : jq(EWW_BATTERY, "first(.[])").capacity}%"))

(defwidget _clock []
(label :text { formattime(EWW_TIME, "%R") }
:tooltip { formattime(EWW_TIME, "%F") }))
Loading
Loading