authorgravatar for nmarks413@gmail.comNatalie Marks <nmarks413@gmail.com> 2025-05-19 21:42:58-07:00
committergravatar for nmarks413@gmail.comNatalie Marks <nmarks413@gmail.com> 2025-05-19 21:42:58-07:00
log69e9b167cbf154160adcdd28dcc7f6c4f901ee97
tree3be9a8687743f2fd7f4254d71bd36b4839d9006a
parent3449484e73eaf94679f490f8c96a7b187997462d
signature Commit is signed but in an unrecognized format.

add custom nvf stuff and merge


12 files changed, 898 insertions(+), 1215 deletions(-)

flake.nix+104-107
...@@ -39,72 +39,71 @@...@@ -39,72 +39,71 @@
39 nix-index-database.url = "github:nix-community/nix-index-database";39 nix-index-database.url = "github:nix-community/nix-index-database";
40 nix-index-database.inputs.nixpkgs.follows = "nixpkgs";40 nix-index-database.inputs.nixpkgs.follows = "nixpkgs";
41 };41 };
42 outputs =42 outputs = {
43 {43 self,
44 nixpkgs,44 nixpkgs,
45 nixos-cosmic,45 nixos-cosmic,
46 darwin,46 darwin,
47 ...47 ...
48 }@inputs:48 } @ inputs: let
49 let49 lib = nixpkgs.lib;
50 lib = nixpkgs.lib;50
5151 # TODO: apply these overlays sooner and remove uses of legacyPackages elsewhere.
52 # TODO: apply these overlays sooner and remove uses of legacyPackages elsewhere.52 overlays = [
53 overlays = [53 inputs.zig.overlays.default
54 inputs.zig.overlays.default54 inputs.rust-overlay.overlays.default
55 inputs.rust-overlay.overlays.default55 inputs.nh.overlays.default
56 inputs.nh.overlays.default56
5757 # https://github.com/LnL7/nix-darwin/issues/1041
58 # https://github.com/LnL7/nix-darwin/issues/104158 (_: prev: {
59 (_: prev: {59 karabiner-elements = prev.karabiner-elements.overrideAttrs (old: {
60 karabiner-elements = prev.karabiner-elements.overrideAttrs (old: {60 version = "14.13.0";
61 version = "14.13.0";61
6262 src = prev.fetchurl {
63 src = prev.fetchurl {63 inherit (old.src) url;
64 inherit (old.src) url;64 hash = "sha256-gmJwoht/Tfm5qMecmq1N6PSAIfWOqsvuHU8VDJY8bLw=";
65 hash = "sha256-gmJwoht/Tfm5qMecmq1N6PSAIfWOqsvuHU8VDJY8bLw=";65 };
66 };66 });
67 });67 })
68 ];
69
70 # Users of this flake currently use x86_64 Linux and Apple Silicon
71 systems = [
72 "x86_64-linux"
73 "aarch64-darwin"
74 ];
75 forAllSystems = f:
76 builtins.listToAttrs (
77 builtins.map (system: {
78 name = system;
79 value = f (
80 inputs
81 // {
82 inherit system;
83 pkgs = nixpkgs.legacyPackages.${system};
84 }
85 );
68 })86 })
69 ];87 systems
88 );
7089
71 # Users of this flake currently use x86_64 Linux and Apple Silicon90 mkSystem = import ./lib/mkSystem.nix {
72 systems = [91 inherit
73 "x86_64-linux"92 overlays
74 "aarch64-darwin"93 nixpkgs
75 ];94 inputs
76 forAllSystems =95 mkNeovim
77 f:96 ;
78 builtins.listToAttrs (97 };
79 builtins.map (system: {98 mkNeovim = import ./lib/mkNeovim.nix {
80 name = system;99 inherit self overlays nixpkgs inputs;
81 value = f (100 };
82 inputs101 in rec {
83 // {102 inherit self;
84 inherit system;103 # "nix fmt"
85 pkgs = nixpkgs.legacyPackages.${system};104 formatter = forAllSystems (inputs: inputs.pkgs.nixfmt-tree);
86 }105 packages = forAllSystems (
87 );106 {system, ...}:
88 }) systems
89 );
90
91 mkSystem = import ./lib/mkSystem.nix {
92 inherit
93 overlays
94 nixpkgs
95 inputs
96 mkNeovim
97 ;
98 };
99 mkNeovim = import ./lib/mkNeovim.nix {
100 inherit overlays nixpkgs inputs;
101 };
102 in
103 rec {
104 # "nix fmt"
105 formatter = forAllSystems (inputs: inputs.pkgs.nixfmt-tree);
106 packages = forAllSystems (
107 { system, ... }:
108 {107 {
109 nvim-chloe = mkNeovim "chloe" system;108 nvim-chloe = mkNeovim "chloe" system;
110 nvim-natalie = mkNeovim "natalie" system;109 nvim-natalie = mkNeovim "natalie" system;
...@@ -113,49 +112,47 @@...@@ -113,49 +112,47 @@
113 # "nix run .#darwin-rebuild"112 # "nix run .#darwin-rebuild"
114 darwin-rebuild = darwin.packages.aarch64-darwin.darwin-rebuild;113 darwin-rebuild = darwin.packages.aarch64-darwin.darwin-rebuild;
115 }114 }
116 );115 );
116
117 # natalie's desktop computer
118 nixosConfigurations.nixos = mkSystem "nixos" {
119 user = "natalie";
120 host = "desktop";
121 system = "x86_64-linux";
122 extraModules = [
123 nixos-cosmic.nixosModules.default
124 ];
125 };
126 # natalie's laptop
127 darwinConfigurations."Natalies-MacBook-Air" = mkSystem "Natalies-MacBook-Air" {
128 user = "natalie";
129 host = "laptop";
130 system = "aarch64-darwin";
131 };
117132
118 # natalie's desktop computer133 # chloe's mac studio "sandwich"
119 nixosConfigurations.nixos = mkSystem "nixos" {134 darwinConfigurations.sandwich = mkSystem "sandwich" {
120 user = "natalie";135 user = "chloe";
121 host = "desktop";136 host = "sandwich";
122 system = "x86_64-linux";137 system = "aarch64-darwin";
123 extraModules = [138 };
124 nixos-cosmic.nixosModules.default139 # chloe's macbook air "paperback"
125 ];140 darwinConfigurations.paperback = mkSystem "paperback" {
126 };141 user = "chloe";
127 # natalie's laptop142 host = "paperback";
128 darwinConfigurations."Natalies-MacBook-Air" = mkSystem "Natalies-MacBook-Air" {143 system = "aarch64-darwin";
129 user = "natalie";
130 host = "laptop";
131 system = "aarch64-darwin";
132 };
133
134 # chloe's mac studio "sandwich"
135 darwinConfigurations.sandwich = mkSystem "sandwich" {
136 user = "chloe";
137 host = "sandwich";
138 system = "aarch64-darwin";
139 };
140 # chloe's macbook air "paperback"
141 darwinConfigurations.paperback = mkSystem "paperback" {
142 user = "chloe";
143 host = "paperback";
144 system = "aarch64-darwin";
145 };
146
147 # generate checks for "nix flake check --all-systems --no-build"
148 checks.aarch64-darwin = builtins.listToAttrs (
149 builtins.map (
150 name:
151 let
152 d = darwinConfigurations.${name}.system;
153 in
154 {
155 name = "darwinConfiguration-" + d.name;
156 value = d;
157 }
158 ) (builtins.attrNames darwinConfigurations)
159 );
160 };144 };
145
146 # generate checks for "nix flake check --all-systems --no-build"
147 checks.aarch64-darwin = builtins.listToAttrs (
148 builtins.map (
149 name: let
150 d = darwinConfigurations.${name}.system;
151 in {
152 name = "darwinConfiguration-" + d.name;
153 value = d;
154 }
155 ) (builtins.attrNames darwinConfigurations)
156 );
157 };
161}158}
lib/mkNeovim.nix+14-14
...@@ -1,11 +1,10 @@...@@ -1,11 +1,10 @@
1{1{
2 self,
2 nixpkgs,3 nixpkgs,
3 # TODO: apply overlays here4 # TODO: apply overlays here
4 overlays,5 overlays,
5 inputs,6 inputs,
6}:7}: user: system: let
7user: system:
8let
9 darwin = nixpkgs.lib.strings.hasSuffix "-darwin" system;8 darwin = nixpkgs.lib.strings.hasSuffix "-darwin" system;
109
11 host = {10 host = {
...@@ -16,14 +15,15 @@ let...@@ -16,14 +15,15 @@ let
16 userDir = ../users + "/${user}";15 userDir = ../users + "/${user}";
17 userConfig = import (userDir + "/user.nix");16 userConfig = import (userDir + "/user.nix");
18in17in
19(inputs.nvf.lib.neovimConfiguration {18 (inputs.nvf.lib.neovimConfiguration {
20 pkgs = nixpkgs.legacyPackages.${system};19 pkgs = nixpkgs.legacyPackages.${system};
21 modules = builtins.filter (f: f != null) [20 modules = builtins.filter (f: f != null) [
22 (../users + ("/" + user + "/vim.nix"))21 (../users + ("/" + user + "/vim.nix"))
23 ../modules/neovim22 ../modules/neovim
24 ];23 ];
25 extraSpecialArgs = {24 extraSpecialArgs = {
26 inherit host;25 inherit host;
27 user = userConfig;26 flake = self;
28 };27 user = userConfig;
29}).neovim28 };
29 }).neovim
lib/mkSystem.nix+78-56
...@@ -5,20 +5,29 @@...@@ -5,20 +5,29 @@
5 overlays,5 overlays,
6 inputs,6 inputs,
7 mkNeovim,7 mkNeovim,
8}:8}: name: {
9name:
10{
11 user, # ./users/{name}9 user, # ./users/{name}
12 host, # ./users/{name}/{host} (optional)10 host, # ./users/{name}/{host} (optional)
13 system, # arch-os11 system, # arch-os
14 extraModules ? [ ],12 extraModules ? [],
15}:13}: let
16let
17 darwin = nixpkgs.lib.strings.hasSuffix "-darwin" system;14 darwin = nixpkgs.lib.strings.hasSuffix "-darwin" system;
18 getInputModule = a: b: inputs.${a}.${if darwin then "darwinModules" else "nixosModules"}.${b};15 getInputModule = a: b:
16 inputs.${
17 a
18 }.${
19 if darwin
20 then "darwinModules"
21 else "nixosModules"
22 }.${
23 b
24 };
1925
20 # NixOS vs nix-darwin functions26 # NixOS vs nix-darwin functions
21 systemFunc = if darwin then inputs.darwin.lib.darwinSystem else nixpkgs.lib.nixosSystem;27 systemFunc =
28 if darwin
29 then inputs.darwin.lib.darwinSystem
30 else nixpkgs.lib.nixosSystem;
2231
23 userDir = ../users + "/${user}";32 userDir = ../users + "/${user}";
24 userConfig = import (userDir + "/user.nix");33 userConfig = import (userDir + "/user.nix");
...@@ -29,7 +38,10 @@ let...@@ -29,7 +38,10 @@ let
29 hostHomePath = hostDir + "/home.nix";38 hostHomePath = hostDir + "/home.nix";
30 userHomePath = userDir + "/home.nix";39 userHomePath = userDir + "/home.nix";
3140
32 pathOrNull = a: if builtins.pathExists a then a else null;41 pathOrNull = a:
42 if builtins.pathExists a
43 then a
44 else null;
3345
34 # Arguments passed to all module files46 # Arguments passed to all module files
35 args = {47 args = {
...@@ -56,14 +68,18 @@ let...@@ -56,14 +68,18 @@ let
56 term, # preferred $TERM68 term, # preferred $TERM
57 editor, # preferred $EDITOR69 editor, # preferred $EDITOR
58 browser ? null, # preferred $BROWSER70 browser ? null, # preferred $BROWSER
59 }@user:71 } @ user:
60 user72 user
61 )73 )
62 userConfig;74 userConfig;
63 };75 };
64 systemSettings = rec {76 systemSettings = rec {
65 inherit darwin;77 inherit darwin;
66 homeDir = "/${if darwin then "Users" else "home"}/${userConfig.username}";78 homeDir = "/${
79 if darwin
80 then "Users"
81 else "home"
82 }/${userConfig.username}";
67 };83 };
6884
69 mainHomeImports = builtins.filter (f: f != null) [85 mainHomeImports = builtins.filter (f: f != null) [
...@@ -76,54 +92,60 @@ let...@@ -76,54 +92,60 @@ let
76 }92 }
77 ];93 ];
78in94in
79systemFunc {95 systemFunc {
80 inherit system;96 inherit system;
8197
82 modules =98 modules =
83 builtins.filter (f: f != null) [99 builtins.filter (f: f != null) [
84 # Apply our overlays. Overlays are keyed by system type so we have100 # Apply our overlays. Overlays are keyed by system type so we have
85 # to go through and apply our system type. We do this first so101 # to go through and apply our system type. We do this first so
86 # the overlays are available globally.102 # the overlays are available globally.
87 { nixpkgs.overlays = overlays; }103 {nixpkgs.overlays = overlays;}
88104
89 # Modules shared between nix-darwin and NixOS105 # Modules shared between nix-darwin and NixOS
90 ../modules/shared106 ../modules/shared
91 # Modules for the specific OS107 # Modules for the specific OS
92 (if darwin then ../modules/macos else ../modules/nixos)108 (
109 if darwin
110 then ../modules/macos
111 else ../modules/nixos
112 )
93113
94 # The user-wide configuration.nix114 # The user-wide configuration.nix
95 (pathOrNull userConfigPath)115 (pathOrNull userConfigPath)
96 # The host-wide configuration.nix116 # The host-wide configuration.nix
97 (pathOrNull hostConfigPath)117 (pathOrNull hostConfigPath)
98118
99 # Set up nix-index and enable comma for easy one-shot command use119 # Set up nix-index and enable comma for easy one-shot command use
100 # https://github.com/nix-community/comma120 # https://github.com/nix-community/comma
101 (getInputModule "nix-index-database" "nix-index")121 (getInputModule "nix-index-database" "nix-index")
102 { programs.nix-index-database.comma.enable = true; }122 {programs.nix-index-database.comma.enable = true;}
103123
104 # Themes for all programs124 # Themes for all programs
105 (getInputModule "stylix" "stylix")125 (getInputModule "stylix" "stylix")
106126
107 # Home manager127 # Home manager
108 (getInputModule "home-manager" "home-manager")128 (getInputModule "home-manager" "home-manager")
109 {129 {
110 home-manager = {130 home-manager = {
111 useGlobalPkgs = true;131 useGlobalPkgs = true;
112 useUserPackages = true;132 useUserPackages = true;
113 backupFileExtension = "hm-backup";133 backupFileExtension = "hm-backup";
114 # Arguments passed to all module files134 # Arguments passed to all module files
115 extraSpecialArgs = args // {135 extraSpecialArgs =
116 inherit mainHomeImports;136 args
137 // {
138 inherit mainHomeImports;
139 };
140 # can't find how to make this an array without the param
141 users.${userConfig.username} = ../modules/home;
117 };142 };
118 # can't find how to make this an array without the param143 users.users.${userConfig.username}.home = systemSettings.homeDir;
119 users.${userConfig.username} = ../modules/home;144 }
120 };
121 users.users.${userConfig.username}.home = systemSettings.homeDir;
122 }
123145
124 # Arguments passed to all module files146 # Arguments passed to all module files
125 { config._module.args = args; }147 {config._module.args = args;}
126 ]148 ]
127 # Add extra modules specified from config149 # Add extra modules specified from config
128 ++ extraModules;150 ++ extraModules;
129}151 }
modules/home/macos/sketchybar.nix+522-395
...@@ -2,407 +2,534 @@...@@ -2,407 +2,534 @@
2 pkgs,2 pkgs,
3 lib,3 lib,
4 config,4 config,
5 host,
6 ...5 ...
7}:6}: {
8let
9 # folder = "${config.home.homeDirectory}.dotfiles/files/sketchybar";
10 # folder = "~/.dotfiles/files/sketchybar";
11 folder = ../../../files/sketchybar;
12in
13lib.mkIf (host.darwin) {
14 home.file =7 home.file =
15 lib.attrsets.mapAttrs8 lib.attrsets.mapAttrs (file: value: (
16 (9 lib.attrsets.overrideExisting value {enable = config.shared.darwin.tiling.enable;}
17 file: value: (lib.attrsets.overrideExisting value { enable = config.shared.darwin.tiling.enable; })10 )) {
18 )11 sketchybarrc = {
19 {12 executable = true;
20 sketchybarrc = {13 target = ".config/sketchybar/sketchybarrc";
21 executable = true;14 text = ''
22 target = ".config/sketchybar/sketchybarrc";15 #!/usr/bin/env sh
23 text = ''16
24 #!/usr/bin/env sh17 source "$HOME/.config/sketchybar/colors.sh" # Loads all defined colors
2518
26 source "$HOME/.config/sketchybar/colors.sh" # Loads all defined colors19 ITEM_DIR="$HOME/.config/sketchybar/items" # Directory where the items are configured
27 source "$HOME/.config/sketchybar/icons.sh" # Loads all defined icons20 PLUGIN_DIR="$HOME/.config/sketchybar/plugins" # Directory where all the plugin scripts are stored
2821
29 ITEM_DIR="$HOME/.config/sketchybar/items" # Directory where the items are configured22 FONT="SF Pro" # Needs to have Regular, Bold, Semibold, Heavy and Black variants
30 PLUGIN_DIR="$HOME/.config/sketchybar/plugins" # Directory where all the plugin scripts are stored23 PADDINGS=3 # All paddings use this value (icon, label, background)
3124
32 FONT="SF Pro" # Needs to have Regular, Bold, Semibold, Heavy and Black variants25
33 PADDINGS=3 # All paddings use this value (icon, label, background)26 # Setting up the general bar appearance and default values
3427 ${pkgs.sketchybar}/bin/sketchybar --bar height=40 \
35 # Setting up and starting the helper process28 blur_radius=30 \
36 HELPER=git.felix.helper29 position=top \
37 killall helper30 sticky=on \
38 cd $HOME/.config/sketchybar/helper && make31 padding_left=10 \
39 $HOME/.config/sketchybar/helper/helper $HELPER > /dev/null 2>&1 &32 padding_right=10
4033
41 # Unload the macOS on screen indicator overlay for volume change34
42 # launchctl unload -F /System/Library/LaunchAgents/com.apple.OSDUIHelper.plist > /dev/null 2>&1 &35 ${pkgs.sketchybar}/bin/sketchybar --default icon.font="SF Pro:Semibold:12.0" \
4336 icon.color=$ITEM_COLOR \
44 # Setting up the general bar appearance and default values37 label.font="SF Pro:Semibold:12.0" \
45 ${pkgs.sketchybar}/bin/sketchybar --bar height=40 \38 label.color=$ITEM_COLOR \
46 color=$BAR_COLOR \39 background.color=$ACCENT_COLOR \
47 shadow=off \40 background.corner_radius=10 \
48 position=top \41 background.height=20 \
49 sticky=on \42 padding_left=4 \
50 padding_right=0 \43 padding_right=4 \
51 padding_left=0 \44 icon.padding_left=6 \
52 corner_radius=12 \45 icon.padding_right=3 \
53 y_offset=0 \46 label.padding_left=3 \
54 margin=2 \47 label.padding_right=6
55 blur_radius=0 \48
56 notch_width=0 \49
57 --default updates=when_shown \50 # Left
58 icon.font="$FONT:Bold:14.0" \51 # source "$ITEM_DIR/apple.sh"
59 icon.color=$ICON_COLOR \52 source "$ITEM_DIR/spaces.sh"
60 icon.padding_left=$PADDINGS \53 source "$ITEM_DIR/front_app.sh"
61 icon.padding_right=$PADDINGS \54
62 label.font="$FONT:Semibold:13.0" \55 # Center
63 label.color=$LABEL_COLOR \56 # source "$ITEM_DIR/spotify.sh"
64 label.padding_left=$PADDINGS \57 source "$ITEM_DIR/calendar.sh"
65 label.padding_right=$PADDINGS \58
66 background.padding_right=$PADDINGS \59 # Right
67 background.padding_left=$PADDINGS \60 source $ITEM_DIR/calendar.sh
68 background.height=26 \61 source $ITEM_DIR/wifi.sh
69 background.corner_radius=9 \62 source $ITEM_DIR/battery.sh
70 popup.background.border_width=2 \63 source $ITEM_DIR/volume.sh
71 popup.background.corner_radius=11 \64
72 popup.background.border_color=$POPUP_BORDER_COLOR \65 # Forcing all item scripts to run (never do this outside of sketchybarrc)
73 popup.background.color=$POPUP_BACKGROUND_COLOR \66 ${pkgs.sketchybar}/bin/sketchybar --update
74 popup.background.shadow.drawing=on67
7568 echo "sketchybar configuation loaded.."
76 # Left69 '';
77 source "$ITEM_DIR/apple.sh"70 };
78 source "$ITEM_DIR/spaces.sh"71 icons = {
79 source "$ITEM_DIR/front_app.sh"72 executable = true;
8073 target = ".config/sketchybar/plugins/icons.sh";
81 # Center74 text = ''
82 # source "$ITEM_DIR/spotify.sh"75 #!/usr/bin/env sh
83 source "$ITEM_DIR/calendar.sh"76
8477 # Source the icon map with all the application icons
85 # Right78 source ${pkgs.sketchybar-app-font}/bin/icon_map.sh
86 # source "$ITEM_DIR/brew.sh"79
87 # source "$ITEM_DIR/github.sh"80 # Create a cache directory if it doesn't exist
88 source "$ITEM_DIR/volume.sh"81 CACHE_DIR="$HOME/.cache/sketchybar"
89 # source "$ITEM_DIR/divider.sh"82 mkdir -p "$CACHE_DIR"
90 # source "$ITEM_DIR/cpu.sh"83
9184 # Cache file for icon mappings
92 # Forcing all item scripts to run (never do this outside of sketchybarrc)85 ICON_CACHE="$CACHE_DIR/icon_cache.txt"
93 ${pkgs.sketchybar}/bin/sketchybar --update86
9487 # Create the cache file if it doesn't exist
95 echo "sketchybar configuation loaded.."88 if [ ! -f "$ICON_CACHE" ]; then
96 '';89 touch "$ICON_CACHE"
97 };90 fi
98 icons = {91
99 executable = true;92 # Check if the app is already in cache
100 target = ".config/sketchybar/icons.sh";93 APP_NAME=$(if [ "$1" = "Zen" ]; then echo "Zen Browser"; else echo "$1"; fi)
101 source = folder + /icons.sh;94
102 };95 CACHED_ICON=$(grep "^$APP_NAME|" "$ICON_CACHE" | cut -d '|' -f2)
103 colors = {96
104 executable = true;97 if [ -n "$CACHED_ICON" ]; then
105 target = ".config/sketchybar/colors.sh";98 # Cache hit, return the icon
106 text = ''99 echo "$CACHED_ICON"
107 #!/usr/bin/env sh100 exit 0
108 # Color Palette101 fi
109 export BLACK=0xff4c4f69102
110 export WHITE=0xffeff1f5103 # Get icon from the mapping function
111 export RED=0xffd20f39104 __icon_map "$APP_NAME"
112 export GREEN=0xff40a02b105
113 export BLUE=0xff1e66f5106 if [ -n "$icon_result" ]; then
114 export YELLOW=0xffdf8e1d107 echo "$APP_NAME|$icon_result" >>"$ICON_CACHE"
115 export ORANGE=0xfffe640b108 fi
116 export MAGENTA=0xffea76cb109
117 export GREY=0xff9ca0b0110 echo "$icon_result"
118 export TRANSPARENT=0xff000000111 '';
119 export BLUE2=0xff7287fd112 };
120 export FLAMINGO=0xffdd7878113 colors = {
121114 executable = true;
122 # General bar colors115 target = ".config/sketchybar/colors.sh";
123 export BAR_COLOR=0xeff1f5ff # Color of the bar116 text = ''
124 export ICON_COLOR=0xff4c4f69117
125 export LABEL_COLOR=0xff4c4f69 # Color of all labels118 export TRANSPARENT=0x00ffffff
126 export BACKGROUND_1=0xffbcc0cc119
127 export BACKGROUND_2=0xffbcc0cc120 # -- Gray Scheme --
128121 export ITEM_COLOR=0xff000000
129 export POPUP_BACKGROUND_COLOR=$BLACK122 export ACCENT_COLOR=0xffc3c6cb
130 export POPUP_BORDER_COLOR=$WHITE123
131124 # -- White Scheme --
132 export SHADOW_COLOR=$BLACK125 # export ITEM_COLOR=0xff000000
133 '';126 # export ACCENT_COLOR=0xffffffff
134 };127
135 items_apple = {128 # -- Teal Scheme --
136 executable = true;129 # export ITEM_COLOR=0xff000000
137 target = ".config/sketchybar/items/apple.sh";130 # export ACCENT_COLOR=0xff2cf9ed
138 source = folder + /items/executable_apple.sh;131
139 };132 # -- Purple Scheme --
140 items_brew = {133 # export ITEM_COLOR=0xff000000
141 executable = true;134 # export ACCENT_COLOR=0xffeb46f9
142 target = ".config/sketchybar/items/brew.sh";135
143 source = folder + /items/executable_brew.sh;136 # -- Red Scheme ---
144 };137 # export ITEM_COLOR=0xff000000
145 items_calendar = {138 # export ACCENT_COLOR=0xffff2453
146 executable = true;139
147 target = ".config/sketchybar/items/calendar.sh";140 # -- Blue Scheme ---
148 text = ''141 # export ITEM_COLOR=0xff000000
149 #!/usr/bin/env sh142 # export ACCENT_COLOR=0xff15bdf9
150143
151 sketchybar --add item calendar center \144 # -- Green Scheme --
152 --set calendar icon=cal \145 # export ITEM_COLOR=0xff000000
153 display=1 \146 # export ACCENT_COLOR=0xff1dfca1
154 icon.font="$FONT:Black:12.0" \147
155 icon.padding_right=0 \148 # -- Orange Scheme --
156 label.width=50 \149 # export ITEM_COLOR=0xffffffff
157 label.align=right \150 # export ACCENT_COLOR=0xfff97716
158 background.padding_left=15 \151
159 update_freq=30 \152 # -- Yellow Scheme --
160 script="$PLUGIN_DIR/calendar.sh" \153 # export ITEM_COLOR=0xff000000
161 click_script="$PLUGIN_DIR/zen.sh"154 # export ACCENT_COLOR=0xfff7fc17
162 '';155 '';
163 };156 };
164 items_cpu = {157 items_wifi = {
165 executable = true;158 executable = true;
166 target = ".config/sketchybar/items/cpu.sh";159 target = ".config/sketchybar/items/wifi.sh";
167 source = folder + /items/executable_cpu.sh;160 text = ''
168 };161 #!/usr/bin/env/ sh
169 items_divider = {162
170 executable = true;163 sketchybar --add item wifi right \
171 target = ".config/sketchybar/items/divider.sh";164 --set wifi \
172 source = folder + /items/executable_divider.sh;165 icon="􀙥" \
173 };166 label="Updating..." \
174 items_front_app = {167 script="$PLUGIN_DIR/wifi.sh" \
175 executable = true;168 --subscribe wifi wifi_change
176 target = ".config/sketchybar/items/front_app.sh";169 '';
177 text = ''170 };
178 #!/usr/bin/env sh171 items_battery = {
179 FRONT_APP_SCRIPT='sketchybar --set $NAME label="$INFO"'172 executable = true;
180 sketchybar --add event window_focus \173 target = ".config/sketchybar/items/battery.sh";
181 --add event windows_on_spaces \174 text = ''
182 --add item system.aerospace left \175 #!/usr/bin/env/ sh
183 --set system.aerospace script="$PLUGIN_DIR/aerospace.sh" \176 sketchybar --add item battery right \
184 icon.font="$FONT:Bold:16.0" \177 --set battery update_freq=180 \
185 label.drawing=off \178 script="$PLUGIN_DIR/battery.sh" \
186 icon.width=30 \179 --subscribe battery system_woke power_source_change
187 icon=$YABAI_GRID \180 '';
188 icon.color=$BLACK \181 };
189 updates=on \182 items_calendar = {
190 display=active \183 executable = true;
191 --subscribe system.aerospace window_focus \184 target = ".config/sketchybar/items/calendar.sh";
192 windows_on_spaces \185 text = ''
193 mouse.clicked \186 #!/usr/bin/env sh
194 --add item front_app left \187 sketchybar --add item calendar right \
195 --set front_app script="$FRONT_APP_SCRIPT" \188 --set calendar icon=􀧞 \
196 icon.drawing=off \189 update_freq=15 \
197 background.padding_left=0 \190 script="$PLUGIN_DIR/calendar.sh"
198 background.padding_right=10 \191 '';
199 label.color=$BLACK \192 };
200 label.font="$FONT:Black:12.0" \193 items_front_app = {
201 display=active \194 executable = true;
202 --subscribe front_app front_app_switched195 target = ".config/sketchybar/items/front_app.sh";
203 '';196 text = ''
204 };197 #!/usr/bin/env sh
205 items_github = {198
206 executable = true;199 sketchybar --add item front_app left \
207 target = ".config/sketchybar/items/github.sh";200 --set front_app background.color=$ACCENT_COLOR \
208 source = folder + /items/executable_github.sh;201 icon.color=$ITEM_COLOR \
209 };202 label.color=$ITEM_COLOR \
210 items_spaces = {203 icon.font="sketchybar-app-font:Regular:12.0" \
211 executable = true;204 label.font="SF Pro:Semibold:12.0" \
212 target = ".config/sketchybar/items/spaces.sh";205 script="$PLUGIN_DIR/front_app.sh" \
213 # label.background.color=$BACKGROUND_2206 --subscribe front_app front_app_switched
214 text = ''207 '';
215 ${pkgs.sketchybar}/bin/sketchybar --add event aerospace_workspace_change208 };
216 ${pkgs.sketchybar}/bin/sketchybar --add event aerospace_mode_change209 items_spaces = {
217 for sid in $(${pkgs.aerospace}/bin/aerospace list-workspaces --all); do210 executable = true;
218 ${pkgs.sketchybar}/bin/sketchybar --add item space.$sid left \211 target = ".config/sketchybar/items/spaces.sh";
219 --subscribe space.$sid aerospace_workspace_change \212 text = ''
220 --subscribe space.$sid aerospace_mode_change \213 sketchybar --add event aerospace_workspace_change
221 --set space.$sid \214
222 icon=$sid \215 sketchybar --add item aerospace_dummy left \
223 icon.padding_left=22 \216 --set aerospace_dummy display=0 \
224 icon.padding_right=22 \217 script="$PLUGIN_DIR/spaces.sh" \
225 icon.highlight_color=$WHITE \218 --subscribe aerospace_dummy aerospace_workspace_change
226 icon.highlight=off \219
227 icon.color=0xff4c566a \220 for m in $(aerospace list-monitors | awk '{print $1}'); do
228 background.padding_left=-8 \221 for sid in $(aerospace list-workspaces --monitor $m); do
229 background.padding_right=-8 \222 sketchybar --add space space.$sid left \
230 background.color=$BACKGROUND_1 \223 --set space.$sid space=$sid \
231 background.drawing=on \224 icon=$sid \
232 script="$PLUGIN_DIR/aerospace.sh $sid" \225 background.color=$TRANSPARENT \
233 click_script="aerospace workspace $sid" \226 label.color=$ACCENT_COLOR \
234 label.font="Iosevka Nerd Font:Regular:16.0" \227 icon.color=$ACCENT_COLOR \
235 label.padding_right=33 \228 display=$m \
236 label.background.height=26 \229 label.font="sketchybar-app-font:Regular:12.0" \
237 label.background.drawing=on \230 icon.font="SF Pro:Semibold:12.0" \
238 label.background.corner_radius=9 \231 label.padding_right=10 \
239 label.drawing=off232 label.y_offset=-1 \
233 click_script="$PLUGIN_DIR/space_click.sh $sid"
234
235 apps=$(aerospace list-windows --monitor "$m" --workspace "$sid" |
236 awk -F '|' '{gsub(/^ *| *$/, "", $2); if (!seen[$2]++) print $2}')
237
238 icon_strip=""
239 if [ "''${apps}" != "" ]; then
240 while read -r app; do
241 icon_strip+=" $($PLUGIN_DIR/icons.sh "$app")"
242 done <<<"''${apps}"
243 else
244 icon_strip=" —"
245 fi
246
247 sketchybar --set space.$sid label="$icon_strip"
248
240 done249 done
241 ${pkgs.sketchybar}/bin/sketchybar --add item separator left \250
242 --set separator icon= \251 for empty_space in $(aerospace list-workspaces --monitor $m --empty); do
243 icon.font="Iosevka Nerd Font:Regular:16.0" \252 sketchybar --set space.$empty_space display=0
244 background.padding_left=26 \253 done
245 background.padding_right=15 \254 for focus in $(aerospace list-workspaces --focused); do
246 label.drawing=off \255 sketchybar --set space.$focus background.drawing=on \
247 display=active \256 background.color=$ACCENT_COLOR \
248 icon.color=$GREEN257 label.color=$ITEM_COLOR \
249 '';258 icon.color=$ITEM_COLOR
250 };259 done
251 items_spotify = {260 done
252 executable = true;261 '';
253 target = ".config/sketchybar/items/spotify.sh";262 };
254 source = folder + /items/executable_spotify.sh;263
255 };264 items_volume = {
256 items_volume = {265 executable = true;
257 executable = true;266 target = ".config/sketchybar/items/volume.sh";
258 target = ".config/sketchybar/items/volume.sh";267 text = ''
259 text = ''268 #/usr/bin/env sh
260 INITIAL_WIDTH=$(osascript -e 'set ovol to output volume of (get volume settings)')269
261 ${pkgs.sketchybar}/bin/sketchybar --add item volume right \270 sketchybar --add item volume right \
262 --subscribe volume volume_change \271 --set volume script="$PLUGIN_DIR/volume.sh" \
263 --set volume script="$PLUGIN_DIR/volume.sh" \272 --subscribe volume volume_change
264 updates=on \273 '';
265 icon.background.drawing=on \274 };
266 icon.background.color=$FLAMINGO \275 plugins_wifi = {
267 icon.background.height=8 \276 executable = true;
268 icon.background.corner_radius=3 \277 target = ".config/sketchybar/plugins/wifi.sh";
269 icon.width=$INITIAL_WIDTH \278 text = ''
270 width=100 \279 #/usr/bin/env sh
271 icon.align=right \280
272 label.drawing=off \281 SSID=$(system_profiler SPAirPortDataType | awk '/Current Network Information:/ { getline; print substr($0, 13, (length($0) - 13)); exit }')
273 background.drawing=on \282
274 background.color=$BACKGROUND_2 \283 if [ "$SSID" = "" ]; then
275 background.height=8 \284 sketchybar --set $NAME icon="􀙈" label="Disconnected"
276 background.corner_radius=3 \285 else
277 align=left286 sketchybar --set $NAME icon="􀙇" label="$SSID"
278287 fi
279 ${pkgs.sketchybar}/bin/sketchybar --add alias "Control Center,Sound" right \288
280 --rename "Control Center,Sound" volume_alias \289 '';
281 --set volume_alias icon.drawing=off \290 };
282 label.drawing=off \291 plugins_calendar = {
283 alias.color=$BLUE2 \292 executable = true;
284 background.padding_right=0 \293 target = ".config/sketchybar/plugins/calendar.sh";
285 background.padding_left=5 \294
286 width=50 \295 text = ''
287 align=right \296 #/usr/bin/env sh
288 click_script="$PLUGIN_DIR/volume_click.sh"297
289298 sketchybar --set $NAME label="$(date +'%a %d %b %I:%M %p')"
290 '';299 '';
291 };300 };
292 plugins_brew = {301 plugins_spaces = {
293 executable = true;302 executable = true;
294 target = ".config/sketchybar/plugins/brew.sh";303 target = ".config/sketchybar/plugins/spaces.sh";
295 source = folder + /plugins/executable_brew.sh;304 text = ''
296 };305 #!/usr/bin/env sh
297 plugins_calendar = {306
298 executable = true;307 source "$CONFIG_DIR/colors.sh"
299 target = ".config/sketchybar/plugins/calendar.sh";308
300 source = folder + /plugins/executable_calendar.sh;309 update_workspace_appearance() {
301 };310 local sid=$1
302 plugins_github = {311 local is_focused=$2
303 executable = true;312
304 target = ".config/sketchybar/plugins/github.sh";313 if [ "$is_focused" = "true" ]; then
305 source = folder + /plugins/executable_github.sh;314 sketchybar --set space.$sid background.drawing=on \
306 };315 background.color=$ACCENT_COLOR \
307 plugins_icon_map = {316 label.color=$ITEM_COLOR \
308 executable = true;317 icon.color=$ITEM_COLOR
309 target = ".config/sketchybar/plugins/icon_map.sh";
310 source = folder + /plugins/executable_icon_map.sh;
311 };
312 plugins_space = {
313 executable = true;
314 target = ".config/sketchybar/plugins/space.sh";
315 source = folder + /plugins/executable_space.sh;
316 };
317 plugins_spotify = {
318 executable = true;
319 target = ".config/sketchybar/plugins/spotify.sh";
320 source = folder + /plugins/executable_spotify.sh;
321 };
322 plugins_volume = {
323 executable = true;
324 target = ".config/sketchybar/plugins/volume.sh";
325 text = ''
326 #!/usr/bin/env sh
327 WIDTH=100
328
329 volume_change() {
330 # INITIAL_WIDTH=$(${pkgs.sketchybar}/bin/sketchybar --query $NAME | ${pkgs.jq}/bin/jq ".icon.width")
331 # if [ "$INITIAL_WIDTH" -eq "0" ]; then
332 # ${pkgs.sketchybar}/bin/sketchybar --animate tanh 30 --set $NAME width=$WIDTH icon.width=$INFO
333 # else
334 # ${pkgs.sketchybar}/bin/sketchybar --set $NAME icon.width=$INFO width=$WIDTH
335 # fi
336 ${pkgs.sketchybar}/bin/sketchybar --set $NAME icon.width=$INFO
337
338
339 # sleep 5
340 # FINAL_WIDTH=$(${pkgs.sketchybar}/bin/sketchybar --query $NAME | ${pkgs.jq}/bin/jq ".icon.width")
341 # if [ "$FINAL_WIDTH" -eq "$INFO" ]; then
342 # ${pkgs.sketchybar}/bin/sketchybar --animate tanh 30 --set $NAME width=0 icon.width=0
343 # fi
344 }
345
346 case "$SENDER" in
347 "volume_change") volume_change
348 ;;
349 esac
350 '';
351 };
352 plugins_volume_click = {
353 executable = true;
354 target = ".config/sketchybar/plugins/volume_click.sh";
355 text = ''
356 #!/usr/bin/env sh
357 MUTED=$(osascript -e 'output muted of (get volume settings)')
358 if [ "$MUTED" = "false" ]; then
359 osascript -e 'set volume output muted true'
360 else318 else
361 osascript -e 'set volume output muted false'319 sketchybar --set space.$sid background.drawing=off \
320 label.color=$ACCENT_COLOR \
321 icon.color=$ACCENT_COLOR
362 fi322 fi
363 '';323 }
364 };324
365 plugins_zen = {325 update_icons() {
366 executable = true;326 m=$1
367 target = ".config/sketchybar/plugins/zen.sh";327 sid=$2
368 source = folder + /plugins/executable_zen.sh;328
369 };329 apps=$(aerospace list-windows --monitor "$m" --workspace "$sid" \
370 plugins_aerospace = {330 | awk -F '|' '{gsub(/^ *| *$/, "", $2); if (!seen[$2]++) print $2}' \
371 executable = true;331 | sort)
372 target = ".config/sketchybar/plugins/aerospace.sh";332
373 text = ''333 icon_strip=""
374 #!/usr/bin/env bash334 if [ "''${apps}" != "" ]; then
375 source "$HOME/.config/sketchybar/colors.sh" # Loads all defined colors335 while read -r app; do
376336 icon_strip+=" $($CONFIG_DIR/plugins/icons.sh "$app")"
377 highlight_focused_workspace() {337 done <<<"''${apps}"
378 if [[ "$1" = "$FOCUSED_WORKSPACE" ]]338 else
379 then339 icon_strip=" —"
380 ${pkgs.sketchybar}/bin/sketchybar --animate tanh 20 --set $NAME icon.highlight=on label.width=0340 fi
381 else341
382 ${pkgs.sketchybar}/bin/sketchybar --animate tanh 20 --set $NAME icon.highlight=off label.width=dynamic342 sketchybar --animate sin 10 --set space.$sid label="$icon_strip"
383 fi343 }
384 }344
385345 update_workspace_appearance "$PREV_WORKSPACE" "false"
386 illuminate_mode() {346 update_workspace_appearance "$FOCUSED_WORKSPACE" "true"
387 if [[ "$mode" = "service" ]]347
388 then348 for m in $(aerospace list-monitors | awk '{print $1}'); do
389 ${pkgs.sketchybar}/bin/sketchybar --animate tanh 20 --set $NAME background.color=$ORANGE349 for sid in $(aerospace list-workspaces --monitor $m --visible); do
390 elif [[ "$mode" = "resize" ]]350 sketchybar --set space.$sid display=$m
391 then351
392 ${pkgs.sketchybar}/bin/sketchybar --animate tanh 20 --set $NAME background.color=$GREEN352 update_icons "$m" "$sid"
393 else353
394 ${pkgs.sketchybar}/bin/sketchybar --animate tanh 20 --set $NAME background.color=$BACKGROUND_1354 update_icons "$m" "$PREV_WORKSPACE"
355
356 apps=$(aerospace list-windows --monitor "$m" --workspace "$sid" | wc -l)
357 if [ "''${apps}" -eq 0 ]; then
358 sketchybar --set space.$sid display=0
395 fi359 fi
396 }360 done
397 case "$SENDER" in361 done
398 "aerospace_workspace_change")362 '';
399 highlight_focused_workspace $1363 };
400 ;;364
401 "aerospace_mode_change")365 plugins_space_click = {
402 illuminate_mode366 executable = true;
403 ;;367 target = ".config/sketchybar/plugins/space_click.sh";
368 text = ''
369 #/usr/bin/env/ sh
370
371 apps=$(aerospace list-windows --workspace $1 | awk -F '|' '{gsub(/^ *| *$/, "", $2); print $2}')
372 focused=$(aerospace list-workspaces --focused)
373
374 if [ "''${apps}" = "" ] && [ "''${focused}" != "$1" ]; then
375 sketchybar --set space.$1 display=0
376 else
377 aerospace workspace $1
378 fi
379 '';
380 };
381 plugins_volume = {
382 executable = true;
383 target = ".config/sketchybar/plugins/volume.sh";
384 text = ''
385 #!/usr/bin/env sh
386
387 # The volume_change event supplies a $INFO variable in which the current volume
388 # percentage is passed to the script.
389
390 if [ "$SENDER" = "volume_change" ]; then
391
392 VOLUME=$INFO
393
394 case $VOLUME in
395 [6-9][0-9] | 100)
396 ICON="􀊩"
397 ;;
398 [3-5][0-9])
399 ICON="􀊥"
400 ;;
401 [1-9] | [1-2][0-9])
402 ICON="􀊡"
403 ;;
404 *) ICON="􀊣" ;;
404 esac405 esac
405 '';406
406 };407 sketchybar --set $NAME icon="$ICON" label="$VOLUME%"
408 fi
409 '';
410 };
411 plugins_front_app = {
412 executable = true;
413 target = ".config/sketchybar/plugins/front_app.sh";
414 text = ''
415 # Some events send additional information specific to the event in the $INFO
416 # variable. E.g. the front_app_switched event sends the name of the newly
417 # focused application in the $INFO variable:
418 # https://felixkratz.github.io/SketchyBar/config/events#events-and-scripting
419
420 app_switched() {
421 for m in $(aerospace list-monitors | awk '{print $1}'); do
422 for sid in $(aerospace list-workspaces --monitor $m --visible); do
423
424 apps=$( (echo "$INFO"; aerospace list-windows --monitor "$m" --workspace "$sid" \
425 | awk -F '|' '{gsub(/^ *| *$/, "", $2); print $2}') \
426 | awk '!seen[$0]++' | sort)
427
428 icon_strip=""
429 if [ "''${apps}" != "" ]; then
430 while read -r app; do
431 icon_strip+=" $($CONFIG_DIR/plugins/icons.sh "$app")"
432 done <<<"''${apps}"
433 else
434 icon_strip=" —"
435 fi
436
437 sketchybar --animate sin 10 --set space.$sid label="$icon_strip"
438 done
439 done
440 }
441
442 if [ "$SENDER" = "front_app_switched" ]; then
443
444 sketchybar --set $NAME label="$INFO" icon="$($CONFIG_DIR/plugins/icons.sh "$INFO")"
445
446 app_switched
447 fi
448 '';
449 };
450 plugins_battery = {
451 executable = true;
452 target = ".config/sketchybar/plugins/battery.sh";
453 text = ''
454 #!/usr/bin/env sh
455 source "$CONFIG_DIR/colors.sh"
456
457 PERCENTAGE=$(pmset -g batt | grep -Eo "\d+%" | cut -d% -f1)
458 CHARGING=$(pmset -g batt | grep 'AC Power')
459
460 if [ $PERCENTAGE = "" ]; then
461 exit 0
462 fi
463
464 case ''${PERCENTAGE} in
465 9[0-9] | 100)
466 ICON="􀛨"
467 COLOR=$ITEM_COLOR
468 ;;
469 [6-8][0-9])
470 ICON="􀺸"
471 COLOR=$ITEM_COLOR
472 ;;
473 [3-5][0-9])
474 ICON="􀺶"
475 COLOR="0xFFd97706"
476 ;;
477 [1-2][0-9])
478 ICON="􀛩"
479 COLOR="0xFFf97316"
480 ;;
481 *)
482 ICON="􀛪"
483 COLOR="0xFFef4444"
484 ;;
485 esac
486
487 if [[ $CHARGING != "" ]]; then
488 ICON="􀢋"
489 COLOR=$ITEM_COLOR
490 fi
491
492 # The item invoking this script (name $NAME) will get its icon and label
493 # updated with the current battery status
494 sketchybar --set $NAME icon="$ICON" label="''${PERCENTAGE}%" icon.color="$COLOR"
495 '';
496 };
497 plugins_aerospace = {
498 executable = true;
499 target = ".config/sketchybar/plugins/aerospace.sh";
500 text = ''
501 #!/usr/bin/env bash
502 source "$HOME/.config/sketchybar/colors.sh" # Loads all defined colors
503
504 highlight_focused_workspace() {
505 if [[ "$1" = "$FOCUSED_WORKSPACE" ]]
506 then
507 ${pkgs.sketchybar}/bin/sketchybar --animate tanh 20 --set $NAME icon.highlight=on label.width=0
508 else
509 ${pkgs.sketchybar}/bin/sketchybar --animate tanh 20 --set $NAME icon.highlight=off label.width=dynamic
510 fi
511 }
512
513 illuminate_mode() {
514 if [[ "$mode" = "service" ]]
515 then
516 ${pkgs.sketchybar}/bin/sketchybar --animate tanh 20 --set $NAME background.color=$ORANGE
517 elif [[ "$mode" = "resize" ]]
518 then
519 ${pkgs.sketchybar}/bin/sketchybar --animate tanh 20 --set $NAME background.color=$GREEN
520 else
521 ${pkgs.sketchybar}/bin/sketchybar --animate tanh 20 --set $NAME background.color=$BACKGROUND_1
522 fi
523 }
524 case "$SENDER" in
525 "aerospace_workspace_change")
526 highlight_focused_workspace $1
527 ;;
528 "aerospace_mode_change")
529 illuminate_mode
530 ;;
531 esac
532 '';
407 };533 };
534 };
408}535}
modules/macos/default.nix+5-4
...@@ -2,7 +2,8 @@...@@ -2,7 +2,8 @@
2 pkgs,2 pkgs,
3 lib,3 lib,
4 ...4 ...
5}: {5}:
6{
6 imports = [7 imports = [
7 # sort-lines: start8 # sort-lines: start
8 ./mac-app-store.nix9 ./mac-app-store.nix
...@@ -13,8 +14,8 @@...@@ -13,8 +14,8 @@
13 ];14 ];
14 # make 'shared.linux' not an error to define.15 # make 'shared.linux' not an error to define.
15 options.shared.linux = lib.mkOption {16 options.shared.linux = lib.mkOption {
16 type = lib.types.anything;17 type = lib.types.anything;
17 default = {};18 default = { };
18 description = "no-op on darwin";19 description = "no-op on darwin";
19 };20 };
20}21}
modules/macos/services/sketchybar/default.nix deleted-95
...@@ -1,95 +0,0 @@
1{
2 config,
3 pkgs,
4 colors,
5}: let
6 template = pkgs.substituteAllFiles {
7 src = ./config;
8 files = [
9 "colors.lua"
10 "settings.lua"
11 "items/cpu.lua"
12 "items/spaces.lua"
13 ];
14 timeout = "${pkgs.coreutils}/bin/timeout";
15 ping = "${pkgs.inetutils}/bin/ping";
16 sketchybar_cpu = "${pkgs.sketchybar-helpers}/bin/sketchybar-cpu";
17 colors_blue = colors.nominal.blue;
18 colors_red = colors.nominal.red;
19 colors_unifying = colors.semantic.unifying;
20 colors_good = colors.semantic.good;
21 colors_info = colors.semantic.info;
22 colors_warning = colors.semantic.warning;
23 colors_urgent = colors.semantic.urgent;
24 colors_primary_bg = colors.semantic.background;
25 colors_primary_fg = colors.semantic.foreground;
26 colors_secondary_bg = colors.semantic.background_highlighted;
27 colors_secondary_fg = colors.semantic.foreground;
28 colors_unselected_bg = colors.window.unselected.background;
29 colors_unselected_fg = colors.window.unselected.text;
30 colors_selected_focused_bg = colors.window.selected.focused.background;
31 colors_selected_focused_fg = colors.window.selected.focused.text;
32 colors_selected_unfocused_bg = colors.window.selected.unfocused.background;
33 colors_selected_unfocused_fg = colors.window.selected.unfocused.text;
34 font_family = config.theme.fonts.proportional.name;
35 };
36
37 appIconNames = pkgs.runCommand "sketchybar-app-icon-names" {} ''
38 mkdir -p "$out"
39 {
40 echo "return {"
41 "${pkgs.findutils}/bin/find" \
42 "${pkgs.sources.sketchybar-font-src}/mappings" \
43 -type f \
44 -mindepth 1 \
45 -maxdepth 1 | while read -r f
46 do cat $f | sed 's/ *| */\n/g;s/[*]//g' | while read -r s
47 do echo " [$s]" = \"''${f##*/}\",
48 done
49 done
50 echo ' [".kitty-wrapped"] = ":kitty:",'
51 echo ' ["iTerm2"] = ":iterm:",'
52 echo ' ["Google Chrome Beta"] = ":google_chrome:",'
53 echo ' ["Microsoft Edge Beta"] = ":microsoft_edge:",'
54 echo "}"
55 } > "$out/app_icon_names.lua"
56 '';
57
58 combined = pkgs.symlinkJoin {
59 name = "sketchybar-config";
60 paths = [template appIconNames ./config];
61 };
62
63 luaposix = pkgs.lua5_4.pkgs.buildLuarocksPackage {
64 pname = "luaposix";
65 version = "36.3-1";
66 src = pkgs.sources.luaposix;
67 };
68
69 lua = pkgs.lua5_4.withPackages (ps: [
70 ps.lua-cjson
71 luaposix
72 ]);
73in {
74 enable = true;
75 package = pkgs.sketchybar;
76 config = ''
77 #!${lua}/bin/lua
78
79 package.cpath = package.cpath .. ";${pkgs.sketchybar-lua}/?.so"
80 package.path = package.path .. ";${combined}/?.lua;${combined}/?/init.lua"
81
82 local Aerospace = require("aerospace")
83 local aerospace = Aerospace.new()
84 while not aerospace:is_initialized() do
85 os.execute("sleep 0.1")
86 end
87 sbar = require("sketchybar")
88 sbar.aerospace = aerospace
89 sbar.begin_config()
90 require("init")
91 sbar.hotload(false)
92 sbar.end_config()
93 sbar.event_loop()
94 '';
95}
modules/macos/tiling/sketchybar-home.nix deleted-539
...@@ -1,539 +0,0 @@
1{
2 pkgs,
3 lib,
4 config,
5 ...
6}: let
7 # folder = "${config.home.homeDirectory}.dotfiles/files/sketchybar";
8 # folder = "~/.dotfiles/files/sketchybar";
9 folder = ../../../files/sketchybar;
10in {
11 home.file =
12 lib.attrsets.mapAttrs (file: value: (
13 lib.attrsets.overrideExisting value {enable = config.shared.darwin.tiling.enable;}
14 )) {
15 sketchybarrc = {
16 executable = true;
17 target = ".config/sketchybar/sketchybarrc";
18 text = ''
19 #!/usr/bin/env sh
20
21 source "$HOME/.config/sketchybar/colors.sh" # Loads all defined colors
22
23 ITEM_DIR="$HOME/.config/sketchybar/items" # Directory where the items are configured
24 PLUGIN_DIR="$HOME/.config/sketchybar/plugins" # Directory where all the plugin scripts are stored
25
26 FONT="SF Pro" # Needs to have Regular, Bold, Semibold, Heavy and Black variants
27 PADDINGS=3 # All paddings use this value (icon, label, background)
28
29
30 # Setting up the general bar appearance and default values
31 ${pkgs.sketchybar}/bin/sketchybar --bar height=40 \
32 blur_radius=30 \
33 position=top \
34 sticky=on \
35 padding_left=10 \
36 padding_right=10
37
38
39 ${pkgs.sketchybar}/bin/sketchybar --default icon.font="SF Pro:Semibold:12.0" \
40 icon.color=$ITEM_COLOR \
41 label.font="SF Pro:Semibold:12.0" \
42 label.color=$ITEM_COLOR \
43 background.color=$ACCENT_COLOR \
44 background.corner_radius=10 \
45 background.height=20 \
46 padding_left=4 \
47 padding_right=4 \
48 icon.padding_left=6 \
49 icon.padding_right=3 \
50 label.padding_left=3 \
51 label.padding_right=6
52
53
54 # Left
55 # source "$ITEM_DIR/apple.sh"
56 source "$ITEM_DIR/spaces.sh"
57 source "$ITEM_DIR/front_app.sh"
58
59 # Center
60 # source "$ITEM_DIR/spotify.sh"
61 source "$ITEM_DIR/calendar.sh"
62
63 # Right
64 source $ITEM_DIR/calendar.sh
65 source $ITEM_DIR/wifi.sh
66 source $ITEM_DIR/battery.sh
67 source $ITEM_DIR/volume.sh
68
69 # Forcing all item scripts to run (never do this outside of sketchybarrc)
70 ${pkgs.sketchybar}/bin/sketchybar --update
71
72 echo "sketchybar configuation loaded.."
73 '';
74 };
75 icons = {
76 executable = true;
77 target = ".config/sketchybar/plugins/icons.sh";
78 text = ''
79 #!/usr/bin/env sh
80
81 # Source the icon map with all the application icons
82 source ${pkgs.sketchybar-app-font}/bin/icon_map.sh
83
84 # Create a cache directory if it doesn't exist
85 CACHE_DIR="$HOME/.cache/sketchybar"
86 mkdir -p "$CACHE_DIR"
87
88 # Cache file for icon mappings
89 ICON_CACHE="$CACHE_DIR/icon_cache.txt"
90
91 # Create the cache file if it doesn't exist
92 if [ ! -f "$ICON_CACHE" ]; then
93 touch "$ICON_CACHE"
94 fi
95
96 # Check if the app is already in cache
97 APP_NAME=$(if [ "$1" = "Zen" ]; then echo "Zen Browser"; else echo "$1"; fi)
98
99 CACHED_ICON=$(grep "^$APP_NAME|" "$ICON_CACHE" | cut -d '|' -f2)
100
101 if [ -n "$CACHED_ICON" ]; then
102 # Cache hit, return the icon
103 echo "$CACHED_ICON"
104 exit 0
105 fi
106
107 # Get icon from the mapping function
108 __icon_map "$APP_NAME"
109
110 if [ -n "$icon_result" ]; then
111 echo "$APP_NAME|$icon_result" >>"$ICON_CACHE"
112 fi
113
114 echo "$icon_result"
115 '';
116 };
117 colors = {
118 executable = true;
119 target = ".config/sketchybar/colors.sh";
120 text = ''
121
122 export TRANSPARENT=0x00ffffff
123
124 # -- Gray Scheme --
125 export ITEM_COLOR=0xff000000
126 export ACCENT_COLOR=0xffc3c6cb
127
128 # -- White Scheme --
129 # export ITEM_COLOR=0xff000000
130 # export ACCENT_COLOR=0xffffffff
131
132 # -- Teal Scheme --
133 # export ITEM_COLOR=0xff000000
134 # export ACCENT_COLOR=0xff2cf9ed
135
136 # -- Purple Scheme --
137 # export ITEM_COLOR=0xff000000
138 # export ACCENT_COLOR=0xffeb46f9
139
140 # -- Red Scheme ---
141 # export ITEM_COLOR=0xff000000
142 # export ACCENT_COLOR=0xffff2453
143
144 # -- Blue Scheme ---
145 # export ITEM_COLOR=0xff000000
146 # export ACCENT_COLOR=0xff15bdf9
147
148 # -- Green Scheme --
149 # export ITEM_COLOR=0xff000000
150 # export ACCENT_COLOR=0xff1dfca1
151
152 # -- Orange Scheme --
153 # export ITEM_COLOR=0xffffffff
154 # export ACCENT_COLOR=0xfff97716
155
156 # -- Yellow Scheme --
157 # export ITEM_COLOR=0xff000000
158 # export ACCENT_COLOR=0xfff7fc17
159 '';
160 };
161 items_wifi = {
162 executable = true;
163 target = ".config/sketchybar/items/wifi.sh";
164 text = ''
165 #!/usr/bin/env/ sh
166
167 sketchybar --add item wifi right \
168 --set wifi \
169 icon="􀙥" \
170 label="Updating..." \
171 script="$PLUGIN_DIR/wifi.sh" \
172 --subscribe wifi wifi_change
173 '';
174 };
175 items_battery = {
176 executable = true;
177 target = ".config/sketchybar/items/battery.sh";
178 text = ''
179 #!/usr/bin/env/ sh
180 sketchybar --add item battery right \
181 --set battery update_freq=180 \
182 script="$PLUGIN_DIR/battery.sh" \
183 --subscribe battery system_woke power_source_change
184 '';
185 };
186 items_calendar = {
187 executable = true;
188 target = ".config/sketchybar/items/calendar.sh";
189 text = ''
190 #!/usr/bin/env sh
191 sketchybar --add item calendar right \
192 --set calendar icon=􀧞 \
193 update_freq=15 \
194 script="$PLUGIN_DIR/calendar.sh"
195 '';
196 };
197 items_front_app = {
198 executable = true;
199 target = ".config/sketchybar/items/front_app.sh";
200 text = ''
201 #!/usr/bin/env sh
202
203 sketchybar --add item front_app left \
204 --set front_app background.color=$ACCENT_COLOR \
205 icon.color=$ITEM_COLOR \
206 label.color=$ITEM_COLOR \
207 icon.font="sketchybar-app-font:Regular:12.0" \
208 label.font="SF Pro:Semibold:12.0" \
209 script="$PLUGIN_DIR/front_app.sh" \
210 --subscribe front_app front_app_switched
211 '';
212 };
213 items_spaces = {
214 executable = true;
215 target = ".config/sketchybar/items/spaces.sh";
216 text = ''
217 sketchybar --add event aerospace_workspace_change
218
219 sketchybar --add item aerospace_dummy left \
220 --set aerospace_dummy display=0 \
221 script="$PLUGIN_DIR/spaces.sh" \
222 --subscribe aerospace_dummy aerospace_workspace_change
223
224 for m in $(aerospace list-monitors | awk '{print $1}'); do
225 for sid in $(aerospace list-workspaces --monitor $m); do
226 sketchybar --add space space.$sid left \
227 --set space.$sid space=$sid \
228 icon=$sid \
229 background.color=$TRANSPARENT \
230 label.color=$ACCENT_COLOR \
231 icon.color=$ACCENT_COLOR \
232 display=$m \
233 label.font="sketchybar-app-font:Regular:12.0" \
234 icon.font="SF Pro:Semibold:12.0" \
235 label.padding_right=10 \
236 label.y_offset=-1 \
237 click_script="$PLUGIN_DIR/space_click.sh $sid"
238
239 apps=$(aerospace list-windows --monitor "$m" --workspace "$sid" |
240 awk -F '|' '{gsub(/^ *| *$/, "", $2); if (!seen[$2]++) print $2}')
241
242 icon_strip=""
243 if [ "''${apps}" != "" ]; then
244 while read -r app; do
245 icon_strip+=" $($PLUGIN_DIR/icons.sh "$app")"
246 done <<<"''${apps}"
247 else
248 icon_strip=" —"
249 fi
250
251 sketchybar --set space.$sid label="$icon_strip"
252
253 done
254
255 for empty_space in $(aerospace list-workspaces --monitor $m --empty); do
256 sketchybar --set space.$empty_space display=0
257 done
258 for focus in $(aerospace list-workspaces --focused); do
259 sketchybar --set space.$focus background.drawing=on \
260 background.color=$ACCENT_COLOR \
261 label.color=$ITEM_COLOR \
262 icon.color=$ITEM_COLOR
263 done
264 done
265 '';
266 };
267
268 items_volume = {
269 executable = true;
270 target = ".config/sketchybar/items/volume.sh";
271 text = ''
272 #/usr/bin/env sh
273
274 sketchybar --add item volume right \
275 --set volume script="$PLUGIN_DIR/volume.sh" \
276 --subscribe volume volume_change
277 '';
278 };
279 plugins_wifi = {
280 executable = true;
281 target = ".config/sketchybar/plugins/wifi.sh";
282 text = ''
283 #/usr/bin/env sh
284
285 SSID=$(system_profiler SPAirPortDataType | awk '/Current Network Information:/ { getline; print substr($0, 13, (length($0) - 13)); exit }')
286
287 if [ "$SSID" = "" ]; then
288 sketchybar --set $NAME icon="􀙈" label="Disconnected"
289 else
290 sketchybar --set $NAME icon="􀙇" label="$SSID"
291 fi
292
293 '';
294 };
295 plugins_calendar = {
296 executable = true;
297 target = ".config/sketchybar/plugins/calendar.sh";
298
299 text = ''
300 #/usr/bin/env sh
301
302 sketchybar --set $NAME label="$(date +'%a %d %b %I:%M %p')"
303 '';
304 };
305 plugins_spaces = {
306 executable = true;
307 target = ".config/sketchybar/plugins/spaces.sh";
308 text = ''
309 #!/usr/bin/env sh
310
311 source "$CONFIG_DIR/colors.sh"
312
313 update_workspace_appearance() {
314 local sid=$1
315 local is_focused=$2
316
317 if [ "$is_focused" = "true" ]; then
318 sketchybar --set space.$sid background.drawing=on \
319 background.color=$ACCENT_COLOR \
320 label.color=$ITEM_COLOR \
321 icon.color=$ITEM_COLOR
322 else
323 sketchybar --set space.$sid background.drawing=off \
324 label.color=$ACCENT_COLOR \
325 icon.color=$ACCENT_COLOR
326 fi
327 }
328
329 update_icons() {
330 m=$1
331 sid=$2
332
333 apps=$(aerospace list-windows --monitor "$m" --workspace "$sid" \
334 | awk -F '|' '{gsub(/^ *| *$/, "", $2); if (!seen[$2]++) print $2}' \
335 | sort)
336
337 icon_strip=""
338 if [ "''${apps}" != "" ]; then
339 while read -r app; do
340 icon_strip+=" $($CONFIG_DIR/plugins/icons.sh "$app")"
341 done <<<"''${apps}"
342 else
343 icon_strip=" —"
344 fi
345
346 sketchybar --animate sin 10 --set space.$sid label="$icon_strip"
347 }
348
349 update_workspace_appearance "$PREV_WORKSPACE" "false"
350 update_workspace_appearance "$FOCUSED_WORKSPACE" "true"
351
352 for m in $(aerospace list-monitors | awk '{print $1}'); do
353 for sid in $(aerospace list-workspaces --monitor $m --visible); do
354 sketchybar --set space.$sid display=$m
355
356 update_icons "$m" "$sid"
357
358 update_icons "$m" "$PREV_WORKSPACE"
359
360 apps=$(aerospace list-windows --monitor "$m" --workspace "$sid" | wc -l)
361 if [ "''${apps}" -eq 0 ]; then
362 sketchybar --set space.$sid display=0
363 fi
364 done
365 done
366 '';
367 };
368
369 plugins_space_click = {
370 executable = true;
371 target = ".config/sketchybar/plugins/space_click.sh";
372 text = ''
373 #/usr/bin/env/ sh
374
375 apps=$(aerospace list-windows --workspace $1 | awk -F '|' '{gsub(/^ *| *$/, "", $2); print $2}')
376 focused=$(aerospace list-workspaces --focused)
377
378 if [ "''${apps}" = "" ] && [ "''${focused}" != "$1" ]; then
379 sketchybar --set space.$1 display=0
380 else
381 aerospace workspace $1
382 fi
383 '';
384 ;
385 plugins_volume = {
386 executable = true;
387 target = ".config/sketchybar/plugins/volume.sh";
388 text = ''
389 #!/usr/bin/env sh
390
391 # The volume_change event supplies a $INFO variable in which the current volume
392 # percentage is passed to the script.
393
394 if [ "$SENDER" = "volume_change" ]; then
395
396 VOLUME=$INFO
397
398 case $VOLUME in
399 [6-9][0-9] | 100)
400 ICON="􀊩"
401 ;;
402 [3-5][0-9])
403 ICON="􀊥"
404 ;;
405 [1-9] | [1-2][0-9])
406 ICON="􀊡"
407 ;;
408 *) ICON="􀊣" ;;
409 esac
410
411 sketchybar --set $NAME icon="$ICON" label="$VOLUME%"
412 fi
413 '';
414 };
415 plugins_front_app = {
416 executable = true;
417 target = ".config/sketchybar/plugins/front_app.sh";
418 text = ''
419 # Some events send additional information specific to the event in the $INFO
420 # variable. E.g. the front_app_switched event sends the name of the newly
421 # focused application in the $INFO variable:
422 # https://felixkratz.github.io/SketchyBar/config/events#events-and-scripting
423
424 app_switched() {
425 for m in $(aerospace list-monitors | awk '{print $1}'); do
426 for sid in $(aerospace list-workspaces --monitor $m --visible); do
427
428 apps=$( (echo "$INFO"; aerospace list-windows --monitor "$m" --workspace "$sid" \
429 | awk -F '|' '{gsub(/^ *| *$/, "", $2); print $2}') \
430 | awk '!seen[$0]++' | sort)
431
432 icon_strip=""
433 if [ "''${apps}" != "" ]; then
434 while read -r app; do
435 icon_strip+=" $($CONFIG_DIR/plugins/icons.sh "$app")"
436 done <<<"''${apps}"
437 else
438 icon_strip=" —"
439 fi
440
441 sketchybar --animate sin 10 --set space.$sid label="$icon_strip"
442 done
443 done
444 }
445
446 if [ "$SENDER" = "front_app_switched" ]; then
447
448 sketchybar --set $NAME label="$INFO" icon="$($CONFIG_DIR/plugins/icons.sh "$INFO")"
449
450 app_switched
451 fi
452 '';
453 };
454 plugins_battery = {
455 executable = true;
456 target = ".config/sketchybar/plugins/battery.sh";
457 text = ''
458 #!/usr/bin/env sh
459 source "$CONFIG_DIR/colors.sh"
460
461 PERCENTAGE=$(pmset -g batt | grep -Eo "\d+%" | cut -d% -f1)
462 CHARGING=$(pmset -g batt | grep 'AC Power')
463
464 if [ $PERCENTAGE = "" ]; then
465 exit 0
466 fi
467
468 case ''${PERCENTAGE} in
469 9[0-9] | 100)
470 ICON="􀛨"
471 COLOR=$ITEM_COLOR
472 ;;
473 [6-8][0-9])
474 ICON="􀺸"
475 COLOR=$ITEM_COLOR
476 ;;
477 [3-5][0-9])
478 ICON="􀺶"
479 COLOR="0xFFd97706"
480 ;;
481 [1-2][0-9])
482 ICON="􀛩"
483 COLOR="0xFFf97316"
484 ;;
485 *)
486 ICON="􀛪"
487 COLOR="0xFFef4444"
488 ;;
489 esac
490
491 if [[ $CHARGING != "" ]]; then
492 ICON="􀢋"
493 COLOR=$ITEM_COLOR
494 fi
495
496 # The item invoking this script (name $NAME) will get its icon and label
497 # updated with the current battery status
498 sketchybar --set $NAME icon="$ICON" label="''${PERCENTAGE}%" icon.color="$COLOR"
499 '';
500 };
501 plugins_aerospace = {
502 executable = true;
503 target = ".config/sketchybar/plugins/aerospace.sh";
504 text = ''
505 #!/usr/bin/env bash
506 source "$HOME/.config/sketchybar/colors.sh" # Loads all defined colors
507
508 highlight_focused_workspace() {
509 if [[ "$1" = "$FOCUSED_WORKSPACE" ]]
510 then
511 ${pkgs.sketchybar}/bin/sketchybar --animate tanh 20 --set $NAME icon.highlight=on label.width=0
512 else
513 ${pkgs.sketchybar}/bin/sketchybar --animate tanh 20 --set $NAME icon.highlight=off label.width=dynamic
514 fi
515 }
516
517 illuminate_mode() {
518 if [[ "$mode" = "service" ]]
519 then
520 ${pkgs.sketchybar}/bin/sketchybar --animate tanh 20 --set $NAME background.color=$ORANGE
521 elif [[ "$mode" = "resize" ]]
522 then
523 ${pkgs.sketchybar}/bin/sketchybar --animate tanh 20 --set $NAME background.color=$GREEN
524 else
525 ${pkgs.sketchybar}/bin/sketchybar --animate tanh 20 --set $NAME background.color=$BACKGROUND_1
526 fi
527 }
528 case "$SENDER" in
529 "aerospace_workspace_change")
530 highlight_focused_workspace $1
531 ;;
532 "aerospace_mode_change")
533 illuminate_mode
534 ;;
535 esac
536 '';
537 };
538 };
539}
modules/neovim/default.nix+58-3
...@@ -3,8 +3,7 @@...@@ -3,8 +3,7 @@
3 lib,3 lib,
4 host,4 host,
5 ...5 ...
6}:6}: {
7{
8 # based on default options from upstream:7 # based on default options from upstream:
9 # https://github.com/NotAShelf/nvf/blob/main/configuration.nix8 # https://github.com/NotAShelf/nvf/blob/main/configuration.nix
10 #9 #
...@@ -68,6 +67,7 @@...@@ -68,6 +67,7 @@
68 rust.enable = true;67 rust.enable = true;
69 ts.enable = true;68 ts.enable = true;
70 zig.enable = true;69 zig.enable = true;
70 markdown.enable = true;
71 # sort-lines: off71 # sort-lines: off
7272
73 nix.format.type = "nixfmt"; # looks so much nicer73 nix.format.type = "nixfmt"; # looks so much nicer
...@@ -81,7 +81,16 @@...@@ -81,7 +81,16 @@
81 nvimBufferline.enable = true;81 nvimBufferline.enable = true;
82 };82 };
83 autocomplete = {83 autocomplete = {
84 blink-cmp.enable = true;84 blink-cmp = {
85 enable = true;
86 sourcePlugins = {
87 ripgrep.enable = true;
88 };
89 friendly-snippets.enable = true;
90 setupOpts = {
91 keymap.preset = "super-tab";
92 };
93 };
85 };94 };
86 statusline = {95 statusline = {
87 lualine = {96 lualine = {
...@@ -93,6 +102,52 @@...@@ -93,6 +102,52 @@
93 };102 };
94 };103 };
95 };104 };
105
106 utility = {
107 snacks-nvim = {
108 enable = true;
109 setupOpts = {
110 bigfile.enable = true;
111 explorer.replace_netrw = true;
112 dashboard = {
113 sections = [
114 {section = "header";}
115 {
116 icon = " ";
117 title = "Keymaps";
118 section = "keys";
119 indent = 2;
120 padding = 1;
121 }
122 {
123 icon = " ";
124 title = "Recent Files";
125 section = "recent_files";
126 indent = 2;
127 padding = 1;
128 }
129 {
130 icon = " ";
131 title = "Projects";
132 section = "projects";
133 indent = 2;
134 padding = 1;
135 }
136 {section = "startup";}
137 ];
138 };
139 image.enable = true;
140 notifier.timeout = 3000;
141 picker = {
142 enable = true;
143 sources = {
144 explorer = {};
145 };
146 };
147 };
148 };
149 };
150
96 binds = {151 binds = {
97 whichKey.enable = true;152 whichKey.enable = true;
98 cheatsheet.enable = true;153 cheatsheet.enable = true;
users/natalie/vim.nix+4-2
...@@ -1,5 +1,7 @@...@@ -1,5 +1,7 @@
1{ ... }:1{...}: {
2{2 imports = [
3 ./vim/default.nix
4 ];
3 vim = {5 vim = {
4 theme = {6 theme = {
5 name = "catppuccin";7 name = "catppuccin";
users/natalie/vim/default.nix created+6
...@@ -0,0 +1,6 @@
1{...}: {
2 imports = [
3 ./keybinds.nix
4 ./languages.nix
5 ];
6}
users/natalie/vim/keybinds.nix created+34
...@@ -0,0 +1,34 @@
1{...}: let
2 mkKeymap = mode: key: action: desc: {
3 inherit
4 mode
5 key
6 action
7 desc
8 ;
9 };
10in {
11 vim = {
12 keymaps = [
13 (mkKeymap "n" "<leader>e" "<cmd>lua require('snacks').explorer()<cr>" "File Explorer")
14
15 # Snacks Picker Replaces Telescope!?
16 (mkKeymap "n" "<leader><space>" "<cmd>lua require('snacks').picker.smart()" "Smart Find Files")
17 (mkKeymap "n" "<leader>ff" "<cmd>lua require('snacks').picker.files()<cr>" "Find File")
18 # (mkKeymap "n" "<leader>fr" "<cmd>lua require('snacks').picker.recent()<cr>" "Open Recent File")
19 (mkKeymap "n" "<leader>fg" "<cmd>lua require('snacks').picker.grep()<cr>" "Grep Files")
20 # (mkKeymap "n" "<leader>fb" "<cmd>lua require('snacks').picker.buffers()<cr>" "Grep Buffers")
21 # (mkKeymap "n" "<leader>fh" "<cmd>lua require('snacks').picker.help()<cr>" "Grep Help Tags")
22 # (mkKeymap "n" "<leader>fg" "<cmd>lua require('snacks').picker.git_files()<cr>" "Grep Git Files")
23 # (mkKeymap "n" "<leader>fd" "<cmd>lua require('snacks').picker.diagnostics()<cr>" "Grep Diagnostics")
24 # (mkKeymap "n" "<leader>fc" "<cmd>lua require('aerial').snacks_picker()<cr>" "Code Outline")
25
26 # Lsp
27 (mkKeymap "n" "gd" "<cmd>lua require('snacks').picker.lsp_definitions<cr>" "Goto Definition")
28 (mkKeymap "n" "gD" "<cmd>lua require('snacks').picker.lsp_declarations<cr>" "Goto Declarations")
29 (mkKeymap "n" "gI" "<cmd>lua require('snacks').picker.lsp_implementations<cr>" "Goto Implementation")
30 (mkKeymap "n" "gr" "<cmd>lua require('snacks').picker.lsp_references<cr>" "Goto References")
31 (mkKeymap "n" "gy" "<cmd>lua require('snacks').picker.lsp_type_definitions<cr>" "Goto T[y]pe Definition")
32 ];
33 };
34}
users/natalie/vim/languages.nix created+73
...@@ -0,0 +1,73 @@
1{flake, ...}: {
2 vim = {
3 lsp.servers.nixd.settings = {
4 nixd.nixpkgs.expr = "import '${flake.inputs.nixpkgs}' { }";
5 };
6 languages = {
7 enableDAP = true;
8 haskell.enable = true;
9 lua.enable = true;
10 python.enable = true;
11 python.format.type = "ruff";
12 # markdown.extensions.markview-nvim = {
13 # enable = true;
14 # setupOpts = {
15 # };
16 # };
17 nix = {
18 lsp = {
19 server = "nixd";
20 options = {
21 nixos = {
22 expr = "(let
23 pkgs = import '${flake.inputs.nixpkgs}' {};
24 inherit (pkgs) lib;
25 in (lib.evalModules {
26 modules = import '${flake.inputs.nixpkgs}/nixos/modules/module-list.nix';
27 check = false;
28 })).options";
29 };
30 nix_darwin = {
31 expr = "(let
32 pkgs = import ''${flake.inputs.nixpkgs}' {};
33 inherit (pkgs) lib;
34 in (lib.evalModules {
35 modules = import '${flake.inputs.darwin}/modules/module-list.nix';
36 check = false;
37 })).options";
38 };
39 home_manager = {
40 expr = "(let
41 pkgs = import '${flake.inputs.nixpkgs}' {};
42 lib = import '${flake.inputs.home-manager}/modules/lib/stdlib-extended.nix' pkgs.lib;
43 in (lib.evalModules {
44 modules = (import '${flake.inputs.home-manager}/modules/modules.nix') {
45 inherit lib pkgs;
46 check = false;
47 };
48 })).options";
49 };
50 };
51 };
52 };
53 };
54 formatter.conform-nvim = {
55 enable = true;
56 setupOpts = {
57 formatters_by_ft = {
58 fish = ["fish_indent"];
59 tex = ["latexindent"];
60 };
61 };
62 };
63
64 diagnostics.nvim-lint = {
65 enable = true;
66 linters_by_ft = {
67 nix = ["statix"];
68 tex = ["chktex"];
69 haskell = ["hlint"];
70 };
71 };
72 };
73}