Add spicetify

Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
2024-07-28 10:22:34 +01:00
parent 922eb479a0
commit 4e041d1587
6 changed files with 193 additions and 1 deletions

40
flake.lock generated
View File

@@ -41,6 +41,22 @@
"type": "github"
}
},
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1696426674,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"home-manager": {
"inputs": {
"nixpkgs": [
@@ -133,7 +149,8 @@
"impermanence": "impermanence",
"nixpkgs": "nixpkgs",
"nur": "nur",
"sops-nix": "sops-nix"
"sops-nix": "sops-nix",
"spicetify-nix": "spicetify-nix"
}
},
"sops-nix": {
@@ -157,6 +174,27 @@
"type": "github"
}
},
"spicetify-nix": {
"inputs": {
"flake-compat": "flake-compat",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1722053480,
"narHash": "sha256-DG1jdoSIcRLkQvCs63MSMJmssHTwm4zGOmP3hUtAzSY=",
"owner": "Gerg-L",
"repo": "spicetify-nix",
"rev": "e954f700aeaeb1b4df261c68c2391089f655fac8",
"type": "github"
},
"original": {
"owner": "Gerg-L",
"repo": "spicetify-nix",
"type": "github"
}
},
"systems": {
"locked": {
"lastModified": 1689347949,

View File

@@ -63,6 +63,11 @@
url = "github:Aylur/ags";
inputs.nixpkgs.follows = "nixpkgs";
};
spicetify-nix = {
url = "github:Gerg-L/spicetify-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =

View File

@@ -0,0 +1,51 @@
:root {
--spice-text: {{colors.primary.default.hex}};
--spice-subtext: {{colors.on_surface_variant.default.hex}};
--spice-nav-active: {{colors.primary.default.hex}};
--spice-nav-active-text: {{colors.surface.default.hex}};
--spice-main: {{colors.surface.default.hex}};
--spice-main-secondary: {{colors.surface_container.default.hex}};
--spice-main-elevated: {{colors.surface_container_high.default.hex}};
--spice-sidebar: {{colors.surface.default.hex}};
--spice-card: {{colors.surface_container_high.default.hex}};
--spice-shadow: {{colors.shadow.default.hex}};
--spice-button: {{colors.primary.default.hex}};
--spice-button-active: {{colors.primary.default.hex}};
--spice-button-secondary: {{colors.on_surface_variant.default.hex}};
--spice-button-disabled: {{colors.outline_variant.default.hex}};
--spice-player: {{colors.surface_container_high.default.hex}};
--spice-play-button: {{colors.primary.default.hex}};
--spice-playback-bar: {{colors.primary.default.hex}};
--spice-tab-active: {{colors.surface_container.default.hex}};
--spice-selected-row: {{colors.on_surface.default.hex}};
--spice-highlight: {{colors.surface_container.default.hex}};
--spice-highlight-elevated: {{colors.surface_container_high.default.hex}};
--spice-notification: {{colors.surface_container_high.default.hex}};
--spice-notification-error: {{colors.error_container.default.hex}};
--spice-misc: {{colors.on_surface.default.hex}};
--spice-rgb-text: {{colors.primary.default.red}}, {{colors.primary.default.green}}, {{colors.primary.default.blue}};
--spice-rgb-subtext: {{colors.on_surface_variant.default.red}}, {{colors.on_surface_variant.default.green}}, {{colors.on_surface_variant.default.blue}};
--spice-rgb-nav-active: {{colors.primary.default.red}}, {{colors.primary.default.green}}, {{colors.primary.default.blue}};
--spice-rgb-nav-active-text: {{colors.surface.default.red}}, {{colors.surface.default.green}}, {{colors.surface.default.blue}};
--spice-rgb-main: {{colors.surface.default.red}}, {{colors.surface.default.green}}, {{colors.surface.default.blue}};
--spice-rgb-main-secondary: {{colors.surface_container.default.red}}, {{colors.surface_container.default.green}}, {{colors.surface_container.default.blue}};
--spice-rgb-main-elevated: {{colors.surface_container_high.default.red}}, {{colors.surface_container_high.default.green}}, {{colors.surface_container_high.default.blue}};
--spice-rgb-sidebar: {{colors.surface.default.red}}, {{colors.surface.default.green}}, {{colors.surface.default.blue}};
--spice-rgb-card: {{colors.surface_container_high.default.red}}, {{colors.surface_container_high.default.green}}, {{colors.surface_container_high.default.blue}};
--spice-rgb-shadow: {{colors.shadow.default.red}}, {{colors.shadow.default.green}}, {{colors.shadow.default.blue}};
--spice-rgb-button: {{colors.primary.default.red}}, {{colors.primary.default.green}}, {{colors.primary.default.blue}};
--spice-rgb-button-active: {{colors.primary.default.red}}, {{colors.primary.default.green}}, {{colors.primary.default.blue}};
--spice-rgb-button-secondary: {{colors.primary_container.default.red}}, {{colors.primary_container.default.green}}, {{colors.primary_container.default.blue}};
--spice-rgb-button-disabled: {{colors.outline_variant.default.red}}, {{colors.outline_variant.default.green}}, {{colors.outline_variant.default.blue}};
--spice-rgb-player: {{colors.surface_container_high.default.red}}, {{colors.surface_container_high.default.green}}, {{colors.surface_container_high.default.blue}};
--spice-rgb-play-button: {{colors.primary.default.red}}, {{colors.primary.default.green}}, {{colors.primary.default.blue}};
--spice-rgb-playback-bar: {{colors.primary.default.red}}, {{colors.primary.default.green}}, {{colors.primary.default.blue}};
--spice-rgb-tab-active: {{colors.surface_container.default.red}}, {{colors.surface_container.default.green}}, {{colors.surface_container.default.blue}};
--spice-rgb-selected-row: {{colors.on_surface.default.red}}, {{colors.on_surface.default.green}}, {{colors.on_surface.default.blue}};
--spice-rgb-highlight: {{colors.surface_container.default.red}}, {{colors.surface_container.default.green}}, {{colors.surface_container.default.blue}};
--spice-rgb-highlight-elevated: {{colors.surface_container_high.default.red}}, {{colors.surface_container_high.default.green}}, {{colors.surface_container_high.default.blue}};
--spice-rgb-notification: {{colors.surface_container_high.default.red}}, {{colors.surface_container_high.default.green}}, {{colors.surface_container_high.default.blue}};
--spice-rgb-notification-error: {{colors.error_container.default.red}}, {{colors.error_container.default.green}}, {{colors.error_container.default.blue}};
--spice-rgb-misc: {{colors.on_surface.default.red}}, {{colors.on_surface.default.green}}, {{colors.on_surface.default.blue}};
}

View File

@@ -0,0 +1,66 @@
{
username ? throw "username argument is required",
}:
{
config,
inputs,
pkgs,
...
}:
let
userConfig = config.users.users.${username};
hmConfig = config.home-manager.users.${username};
in
{
networking.firewall = {
allowedTCPPorts = [ 57621 ];
allowedUDPPorts = [ 5353 ];
};
home-manager.users.${username} = {
imports = [ inputs.spicetify-nix.homeManagerModules.default ];
programs.spicetify =
let
spicePkgs = inputs.spicetify-nix.legacyPackages.${pkgs.system};
in
{
enable = true;
spicetifyPackage = pkgs.spicetify-cli.overrideAttrs (oldAttrs: {
patches = oldAttrs.patches or [ ] ++ [ ./user-colors.patch ];
});
theme = spicePkgs.themes.sleek // {
extraCommands = ''
export COLORS_CSS_PATH="${hmConfig.xdg.configHome}/spotify/colors.css"
'';
additionalCss = ''
.main-topBar-topbarContentRight button {
background-color: unset !important;
}
'';
};
enabledExtensions = with spicePkgs.extensions; [
loopyLoop
trashbin
fullAlbumDate
phraseToPlaylist
songStats
copyToClipboard
betterGenres
adblock
autoSkip
];
};
theme.templates."${hmConfig.xdg.configHome}/spotify/colors.css".source = ./colors.css;
home.persistence = {
"/persist${userConfig.home}".directories = [ "${hmConfig.xdg.relativeConfigHome}/spotify" ];
"/cache${userConfig.home}".directories = [ "${hmConfig.xdg.relativeCacheHome}/spotify" ];
};
};
}

View File

@@ -0,0 +1,31 @@
diff --git a/src/apply/apply.go b/src/apply/apply.go
index 47f1346..47badab 100644
--- a/src/apply/apply.go
+++ b/src/apply/apply.go
@@ -2,6 +2,7 @@ package apply
import (
"fmt"
+ "errors"
"os"
"path/filepath"
"strings"
@@ -65,10 +66,17 @@ func AdditionalOptions(appsFolderPath string, flags Flag) {
// To not use custom css, set `themeFolder` to blank string
// To use default color scheme, set `scheme` to `nil`
func UserCSS(appsFolderPath, themeFolder string, scheme map[string]string) {
+ colorsSrc := os.Getenv("COLORS_CSS_PATH")
colorsDest := filepath.Join(appsFolderPath, "xpui", "colors.css")
- if err := os.WriteFile(colorsDest, []byte(getColorCSS(scheme)), 0700); err != nil {
+
+ if len(colorsSrc) == 0 {
+ utils.Fatal(errors.New("COLORS_CSS_PATH environment variable is not set"))
+ }
+
+ if err := os.Symlink(colorsSrc, colorsDest); err != nil {
utils.Fatal(err)
}
+
cssDest := filepath.Join(appsFolderPath, "xpui", "user.css")
if err := os.WriteFile(cssDest, []byte(getUserCSS(themeFolder)), 0700); err != nil {
utils.Fatal(err)

View File

@@ -42,6 +42,7 @@ in
(import ../common/user/configs/gui/qalculate { inherit username; })
(import ../common/user/configs/gui/qt { inherit username; })
(import ../common/user/configs/gui/rofi { inherit username; })
(import ../common/user/configs/gui/spicetify { inherit username; })
(import ../common/user/configs/gui/swww { inherit username; })
(import ../common/user/configs/gui/theme { inherit username; })
(import ../common/user/configs/gui/vscode { inherit username; })