From ab8626e3b19fc557a6fa0a8afa8f9c319c9acd97 Mon Sep 17 00:00:00 2001 From: matt1432 Date: Thu, 31 Oct 2024 15:35:03 -0400 Subject: [PATCH] feat(sass): switch to @use and setup lsp server --- apps/update/src/app.ts | 11 ++-- apps/update/src/misc.ts | 4 +- common/home/neovim/langs/web.nix | 18 +++++++ nixosModules/ags-v2/config/app.ts | 2 +- nixosModules/ags-v2/config/style.scss | 51 ------------------ .../ags-v2/config/{ => style}/colors.scss | 1 + nixosModules/ags-v2/config/style/common.scss | 39 ++++++++++++++ .../applauncher/{style.scss => _index.scss} | 0 .../widgets/bar/{style.scss => _index.scss} | 14 ++--- .../clipboard/{style.scss => _index.scss} | 0 .../widgets/date/{style.scss => _index.scss} | 14 ++--- .../icon-browser/{style.scss => _index.scss} | 0 .../lockscreen/{style.scss => _index.scss} | 0 .../widgets/misc/{style.scss => _index.scss} | 6 ++- .../notifs/{style.scss => _index.scss} | 8 +-- .../widgets/osd/{style.scss => _index.scss} | 0 .../powermenu/{style.scss => _index.scss} | 10 ++-- .../screenshot/{style.scss => _index.scss} | 4 +- nixosModules/ags-v2/default.nix | 1 - nixosModules/ags-v2/packages.nix | 7 +-- packages/default.nix | 2 + .../some-sass-language-server/default.nix | 38 +++++++++++++ .../package-lock.json | Bin 0 -> 678 bytes .../some-sass-language-server/package.json | 5 ++ packages/some-sass-language-server/update.nix | 16 ++++++ 25 files changed, 168 insertions(+), 83 deletions(-) delete mode 100644 nixosModules/ags-v2/config/style.scss rename nixosModules/ags-v2/config/{ => style}/colors.scss (99%) create mode 100644 nixosModules/ags-v2/config/style/common.scss rename nixosModules/ags-v2/config/widgets/applauncher/{style.scss => _index.scss} (100%) rename nixosModules/ags-v2/config/widgets/bar/{style.scss => _index.scss} (78%) rename nixosModules/ags-v2/config/widgets/clipboard/{style.scss => _index.scss} (100%) rename nixosModules/ags-v2/config/widgets/date/{style.scss => _index.scss} (75%) rename nixosModules/ags-v2/config/widgets/icon-browser/{style.scss => _index.scss} (100%) rename nixosModules/ags-v2/config/widgets/lockscreen/{style.scss => _index.scss} (100%) rename nixosModules/ags-v2/config/widgets/misc/{style.scss => _index.scss} (75%) rename nixosModules/ags-v2/config/widgets/notifs/{style.scss => _index.scss} (92%) rename nixosModules/ags-v2/config/widgets/osd/{style.scss => _index.scss} (100%) rename nixosModules/ags-v2/config/widgets/powermenu/{style.scss => _index.scss} (61%) rename nixosModules/ags-v2/config/widgets/screenshot/{style.scss => _index.scss} (79%) create mode 100644 packages/some-sass-language-server/default.nix create mode 100644 packages/some-sass-language-server/package-lock.json create mode 100644 packages/some-sass-language-server/package.json create mode 100644 packages/some-sass-language-server/update.nix diff --git a/apps/update/src/app.ts b/apps/update/src/app.ts index c54ce31d..9f107cfb 100644 --- a/apps/update/src/app.ts +++ b/apps/update/src/app.ts @@ -5,7 +5,7 @@ import { parseArgs } from './lib.ts'; import { updateFirefoxAddons } from '././firefox.ts'; import { - updateCustomSidebarDeps, + updateCustomPackage, updateDocker, updateFlakeInputs, updateVuetorrent, @@ -39,7 +39,11 @@ if (args['v'] || args['vuetorrent']) { } if (args['c'] || args['custom-sidebar']) { - console.log(updateCustomSidebarDeps()); + console.log(updateCustomPackage('lovelace-components.custom-sidebar')); +} + +if (args['s'] || args['some-sass-language-server']) { + console.log(updateCustomPackage('some-sass-language-server')); } if (args['a'] || args['all']) { @@ -64,7 +68,8 @@ if (args['a'] || args['all']) { console.log(vuetorrentOutput); // This doesn't need to be added to commit msgs - console.log(updateCustomSidebarDeps()); + console.log(updateCustomPackage('lovelace-components.custom-sidebar')); + console.log(updateCustomPackage('some-sass-language-server')); spawnSync('nix-fast-build', ['-f', `${FLAKE}#nixFastChecks`], { diff --git a/apps/update/src/misc.ts b/apps/update/src/misc.ts index bb9fe1f5..7f1eb896 100644 --- a/apps/update/src/misc.ts +++ b/apps/update/src/misc.ts @@ -96,8 +96,8 @@ export const updateVuetorrent = () => { return OLD_VERSION !== VERSION ? `Vuetorrent: ${OLD_VERSION} -> ${VERSION}` : ''; }; -export const updateCustomSidebarDeps = () => spawnSync( - `nix run ${FLAKE}#lovelace-components.custom-sidebar.update`, +export const updateCustomPackage = (pkg: string) => spawnSync( + `nix run ${FLAKE}#${pkg}.update`, [], { shell: true }, ).stderr.toString(); diff --git a/common/home/neovim/langs/web.nix b/common/home/neovim/langs/web.nix index ecc71f93..786bafcc 100644 --- a/common/home/neovim/langs/web.nix +++ b/common/home/neovim/langs/web.nix @@ -28,6 +28,11 @@ in npm neovim ; + + inherit + (self.packages.${pkgs.system}) + some-sass-language-server + ; }; extraLuaConfig = @@ -130,6 +135,19 @@ in }, }); + lsp.somesass_ls.setup({ + capabilities = default_capabilities, + }); + lsp.somesass_ls.manager.config.settings = { + somesass = { + scss = { + completion = { + suggestFromUseOnly = true, + }, + }, + }, + }; + local html_caps = default_capabilities; html_caps.textDocument.completion.completionItem.snippetSupport = true; diff --git a/nixosModules/ags-v2/config/app.ts b/nixosModules/ags-v2/config/app.ts index 70bd0493..e0b43005 100644 --- a/nixosModules/ags-v2/config/app.ts +++ b/nixosModules/ags-v2/config/app.ts @@ -3,7 +3,7 @@ import { App } from 'astal/gtk3'; import GLib from 'gi://GLib'; -import style from './style.scss'; +import style from './style/main.scss'; import AppLauncher from './widgets/applauncher/main'; import Bar from './widgets/bar/wim'; diff --git a/nixosModules/ags-v2/config/style.scss b/nixosModules/ags-v2/config/style.scss deleted file mode 100644 index af07abc2..00000000 --- a/nixosModules/ags-v2/config/style.scss +++ /dev/null @@ -1,51 +0,0 @@ -@import 'colors.scss'; - -window, -viewport, -stack { - all: unset; -} - -progressbar { - border-radius: 999px; - background: transparent; - border: none; - - trough { - background: #363847; - min-height: inherit; - border-radius: inherit; - border: none; - } - - progress { - background: #79659f; - min-height: inherit; - border-radius: inherit; - border: none; - } - - &:disabled { - opacity: 0.5; - } -} - -.widget { - margin: 10px; - padding: 5px; - border-radius: 7px; - background-color: rgba($window_bg_color, 1); - box-shadow: 8px 8px rgba($accent_color, 1); -} - -@import 'widgets/applauncher/style.scss'; -@import 'widgets/bar/style.scss'; -@import 'widgets/clipboard/style.scss'; -@import 'widgets/date/style.scss'; -@import 'widgets/icon-browser/style.scss'; -@import 'widgets/lockscreen/style.scss'; -@import 'widgets/misc/style.scss'; -@import 'widgets/notifs/style.scss'; -@import 'widgets/osd/style.scss'; -@import 'widgets/powermenu/style.scss'; -@import 'widgets/screenshot/style.scss'; diff --git a/nixosModules/ags-v2/config/colors.scss b/nixosModules/ags-v2/config/style/colors.scss similarity index 99% rename from nixosModules/ags-v2/config/colors.scss rename to nixosModules/ags-v2/config/style/colors.scss index a6825f2a..603a0f30 100644 --- a/nixosModules/ags-v2/config/colors.scss +++ b/nixosModules/ags-v2/config/style/colors.scss @@ -78,6 +78,7 @@ $blue_3: #3584e4; $blue_4: #1c71d8; $blue_5: #1a5fb4; +// Other colors $black: #151720; $dimblack: #1a1c25; $lightblack: #262831; diff --git a/nixosModules/ags-v2/config/style/common.scss b/nixosModules/ags-v2/config/style/common.scss new file mode 100644 index 00000000..3208803c --- /dev/null +++ b/nixosModules/ags-v2/config/style/common.scss @@ -0,0 +1,39 @@ +@use 'colors'; + +window, +viewport, +stack { + all: unset; +} + +progressbar { + border-radius: 999px; + background: transparent; + border: none; + + trough { + background: #363847; + min-height: inherit; + border-radius: inherit; + border: none; + } + + progress { + background: #79659f; + min-height: inherit; + border-radius: inherit; + border: none; + } + + &:disabled { + opacity: 0.5; + } +} + +.widget { + margin: 10px; + padding: 5px; + border-radius: 7px; + background-color: colors.$window_bg_color; + box-shadow: 8px 8px colors.$accent_color; +} diff --git a/nixosModules/ags-v2/config/widgets/applauncher/style.scss b/nixosModules/ags-v2/config/widgets/applauncher/_index.scss similarity index 100% rename from nixosModules/ags-v2/config/widgets/applauncher/style.scss rename to nixosModules/ags-v2/config/widgets/applauncher/_index.scss diff --git a/nixosModules/ags-v2/config/widgets/bar/style.scss b/nixosModules/ags-v2/config/widgets/bar/_index.scss similarity index 78% rename from nixosModules/ags-v2/config/widgets/bar/style.scss rename to nixosModules/ags-v2/config/widgets/bar/_index.scss index 7fe7a600..7d4bc058 100644 --- a/nixosModules/ags-v2/config/widgets/bar/style.scss +++ b/nixosModules/ags-v2/config/widgets/bar/_index.scss @@ -1,3 +1,5 @@ +@use '../../style/colors' as colors; + .bar { margin-left: 5px; margin-right: 15px; @@ -6,14 +8,14 @@ .bar-item { padding: 5px 10px 5px 10px; border-radius: 7px; - background-color: darken($window_bg_color, 3%); + background-color: darken(colors.$window_bg_color, 3%); font-size: 20px; min-height: 35px; transition: background-color 300ms; &:hover { - background-color: lighten($window_bg_color, 3%); + background-color: lighten(colors.$window_bg_color, 3%); } &.battery icon { @@ -36,13 +38,13 @@ } .occupied { - border: 2px solid $window_bg_color; - background: $accent_color; + border: 2px solid colors.$window_bg_color; + background: colors.$accent_color; transition: background-color 0.3s ease-in-out; } .urgent { - border: 2px solid $window_bg_color; + border: 2px solid colors.$window_bg_color; background: red; transition: background-color 0.3s ease-in-out; } @@ -62,7 +64,7 @@ transition: background-color 300ms; &:hover { - background: $window_bg_color; + background: colors.$window_bg_color; } } } diff --git a/nixosModules/ags-v2/config/widgets/clipboard/style.scss b/nixosModules/ags-v2/config/widgets/clipboard/_index.scss similarity index 100% rename from nixosModules/ags-v2/config/widgets/clipboard/style.scss rename to nixosModules/ags-v2/config/widgets/clipboard/_index.scss diff --git a/nixosModules/ags-v2/config/widgets/date/style.scss b/nixosModules/ags-v2/config/widgets/date/_index.scss similarity index 75% rename from nixosModules/ags-v2/config/widgets/date/style.scss rename to nixosModules/ags-v2/config/widgets/date/_index.scss index 3003419d..3b4c7d49 100644 --- a/nixosModules/ags-v2/config/widgets/date/style.scss +++ b/nixosModules/ags-v2/config/widgets/date/_index.scss @@ -1,3 +1,5 @@ +@use '../../style/colors' as colors; + .date { margin-top: 0; } @@ -14,7 +16,7 @@ .divider { margin: 8px 15px; padding: 0 1px; - background: linear-gradient($red, $magenta, $blue, $cyan); + background: linear-gradient(colors.$red, colors.$magenta, colors.$blue, colors.$cyan); } } @@ -44,23 +46,23 @@ } calendar:selected { - color: $cyan; + color: colors.$cyan; } calendar.header { - color: $cyan; + color: colors.$cyan; font-weight: bold; } calendar.button { - color: $cyan; + color: colors.$cyan; } calendar.highlight { - color: $green; + color: colors.$green; font-weight: bold; } calendar:indeterminate { - color: $lightblack; + color: colors.$lightblack; } diff --git a/nixosModules/ags-v2/config/widgets/icon-browser/style.scss b/nixosModules/ags-v2/config/widgets/icon-browser/_index.scss similarity index 100% rename from nixosModules/ags-v2/config/widgets/icon-browser/style.scss rename to nixosModules/ags-v2/config/widgets/icon-browser/_index.scss diff --git a/nixosModules/ags-v2/config/widgets/lockscreen/style.scss b/nixosModules/ags-v2/config/widgets/lockscreen/_index.scss similarity index 100% rename from nixosModules/ags-v2/config/widgets/lockscreen/style.scss rename to nixosModules/ags-v2/config/widgets/lockscreen/_index.scss diff --git a/nixosModules/ags-v2/config/widgets/misc/style.scss b/nixosModules/ags-v2/config/widgets/misc/_index.scss similarity index 75% rename from nixosModules/ags-v2/config/widgets/misc/style.scss rename to nixosModules/ags-v2/config/widgets/misc/_index.scss index 89fabde4..c1f39e09 100644 --- a/nixosModules/ags-v2/config/widgets/misc/style.scss +++ b/nixosModules/ags-v2/config/widgets/misc/_index.scss @@ -1,3 +1,5 @@ +@use '../../style/colors' as colors; + .sorted-list { .search { icon { @@ -6,7 +8,7 @@ min-height: 40px } - entry {} + // entry {} } .list { @@ -15,7 +17,7 @@ &:hover, &:selected { icon { - -gtk-icon-shadow: 2px 2px $accent_color; + -gtk-icon-shadow: 2px 2px colors.$accent_color; } } } diff --git a/nixosModules/ags-v2/config/widgets/notifs/style.scss b/nixosModules/ags-v2/config/widgets/notifs/_index.scss similarity index 92% rename from nixosModules/ags-v2/config/widgets/notifs/style.scss rename to nixosModules/ags-v2/config/widgets/notifs/_index.scss index acb22816..4850fc97 100644 --- a/nixosModules/ags-v2/config/widgets/notifs/style.scss +++ b/nixosModules/ags-v2/config/widgets/notifs/_index.scss @@ -1,3 +1,5 @@ +@use '../../style/colors' as colors; + .notification.widget { // urgencies // &.urgency ... @@ -27,7 +29,7 @@ .actions { margin: 3px; - .action-button {} + // .action-button {} } .smooth-progress { @@ -35,12 +37,12 @@ margin: 3px; .background { - background-color: darken($window_bg_color, 3%); + background-color: darken(colors.$window_bg_color, 3%); border-radius: 3px; } .progress { - background-color: $accent-color; + background-color: colors.$accent-color; border-radius: 3px; } } diff --git a/nixosModules/ags-v2/config/widgets/osd/style.scss b/nixosModules/ags-v2/config/widgets/osd/_index.scss similarity index 100% rename from nixosModules/ags-v2/config/widgets/osd/style.scss rename to nixosModules/ags-v2/config/widgets/osd/_index.scss diff --git a/nixosModules/ags-v2/config/widgets/powermenu/style.scss b/nixosModules/ags-v2/config/widgets/powermenu/_index.scss similarity index 61% rename from nixosModules/ags-v2/config/widgets/powermenu/style.scss rename to nixosModules/ags-v2/config/widgets/powermenu/_index.scss index 8fbef72e..329c9930 100644 --- a/nixosModules/ags-v2/config/widgets/powermenu/style.scss +++ b/nixosModules/ags-v2/config/widgets/powermenu/_index.scss @@ -1,3 +1,5 @@ +@use '../../style/colors' as colors; + .powermenu { font-size: 70px; padding: 10px; @@ -13,17 +15,17 @@ &:hover, &:active { - background-color: lighten($window_bg_color, 3%); + background-color: lighten(colors.$window_bg_color, 3%); } } .shutdown { - color: $red_1; + color: colors.$red_1; } .reboot { - color: $purple_1; + color: colors.$purple_1; } .logout { - color: $yellow_1; + color: colors.$yellow_1; } } diff --git a/nixosModules/ags-v2/config/widgets/screenshot/style.scss b/nixosModules/ags-v2/config/widgets/screenshot/_index.scss similarity index 79% rename from nixosModules/ags-v2/config/widgets/screenshot/style.scss rename to nixosModules/ags-v2/config/widgets/screenshot/_index.scss index 735dcfab..a44ba369 100644 --- a/nixosModules/ags-v2/config/widgets/screenshot/style.scss +++ b/nixosModules/ags-v2/config/widgets/screenshot/_index.scss @@ -1,3 +1,5 @@ +@use '../../style/colors' as colors; + .screenshot { font-size: 30px; @@ -7,7 +9,7 @@ transition: background 400ms; &.active { - background: $window_bg_color; + background: colors.$window_bg_color; } } } diff --git a/nixosModules/ags-v2/default.nix b/nixosModules/ags-v2/default.nix index 08aeea38..9bf5abc2 100644 --- a/nixosModules/ags-v2/default.nix +++ b/nixosModules/ags-v2/default.nix @@ -1,7 +1,6 @@ self: { config, lib, - pkgs, ... }: { config = let diff --git a/nixosModules/ags-v2/packages.nix b/nixosModules/ags-v2/packages.nix index 164f2acb..c25b555d 100644 --- a/nixosModules/ags-v2/packages.nix +++ b/nixosModules/ags-v2/packages.nix @@ -22,6 +22,7 @@ # Cfg info inherit (osConfig.networking) hostName; cfgDesktop = osConfig.roles.desktop; + fullConfPath = "/home/${cfgDesktop.user}/${agsConfigDir}"; # Astal libraries gtkSessionLock = gtk-session-lock.packages.${pkgs.system}.default; @@ -35,7 +36,7 @@ name = "lock"; text = '' export CONF="lock" - exec ${agsFull}/bin/ags --config ${agsConfigDir} "$@" + exec ${agsFull}/bin/ags --config ${fullConfPath} "$@" ''; }; @@ -46,14 +47,14 @@ name = "ags"; text = '' export CONF="${hostName}" - exec ${agsFull}/bin/ags --config ${agsConfigDir} "$@" + exec ${agsFull}/bin/ags --config ${fullConfPath} "$@" ''; }) (pkgs.writeShellApplication { name = "agsConf"; text = '' export CONF="$1" - exec ${agsFull}/bin/ags --config ${agsConfigDir} + exec ${agsFull}/bin/ags --config ${fullConfPath} ''; }) ] diff --git a/packages/default.nix b/packages/default.nix index baa03e27..cbedac85 100644 --- a/packages/default.nix +++ b/packages/default.nix @@ -38,6 +38,8 @@ repl = pkgs.callPackage ./repl {}; + some-sass-language-server = pkgs.callPackage ./some-sass-language-server {}; + trash-d = pkgs.callPackage ./trash-d { inherit (inputs) trash-d-src; }; diff --git a/packages/some-sass-language-server/default.nix b/packages/some-sass-language-server/default.nix new file mode 100644 index 00000000..33f2b2e9 --- /dev/null +++ b/packages/some-sass-language-server/default.nix @@ -0,0 +1,38 @@ +{ + writeShellApplication, + nodejs_latest, + prefetch-npm-deps, + jq, + buildNpmPackage, + makeWrapper, + ... +}: let + package = builtins.fromJSON (builtins.readFile ./package.json); +in + buildNpmPackage { + pname = "some-sass-language-server"; + version = package.dependencies.some-sass-language-server; + + src = ./.; + dontNpmBuild = true; + + nativeBuildInputs = [makeWrapper]; + + installPhase = '' + mkdir -p $out/bin + cp -r node_modules $out + makeWrapper $out/node_modules/.bin/some-sass-language-server $out/bin/some-sass-language-server + ''; + + npmDepsHash = "sha256-4VYm0UDbdOh2jo8/YkVG4mt0nvkHWTllJWxaZvRuxCc="; + + passthru.update = writeShellApplication { + name = "update"; + runtimeInputs = [ + nodejs_latest + prefetch-npm-deps + jq + ]; + text = import ./update.nix; + }; + } diff --git a/packages/some-sass-language-server/package-lock.json b/packages/some-sass-language-server/package-lock.json new file mode 100644 index 0000000000000000000000000000000000000000..4990679df477abf9b46a22e4cf1da7aafd7fdd9e GIT binary patch literal 678 zcmaJ;(Qbk;6n*zA2(KI9Fq&xMlFi}5f{8LW=Ux_sJE)cx+M-dzzpqq>%MyHn_Vk{6 z&$;K=(lng}Dd+=D=QIU_2b>!?AaN1I@&;@ROuwzlFby}~2*W!tjwq3gj=~w_1!BM@ zAXotk%Ytwt`4x7QT*VH$!1Ed39nWd| z&6zHiv)N(iJj2T