Spicetify-Nix

From NixOS Wiki
This guide requires an understanding of flakes.

Spicetify-Nix is a comprehensive repository designed to integrate Spicetify with the Nix package manager and NixOS. This repository offers a Nix package and NixOS module for Spicetify, simplifying the installation and configuration process on NixOS systems. It supports various themes, extensions, and customizations to improve the Spotify user experience. The NixOS module provides predefined options and parameters, ensuring a straightforward setup.

Installation

Using flakes

Include the following input in your flake.nix file.

spicetify-nix.url = "github:Gerg-L/spicetify-nix";
spicetify-nix.inputs.nixpkgs.follows = "nixpkgs";

Afterwards, import the module depending on your use of global or home configuration.

imports = [
  # For NixOS
  inputs.spicetify-nix.nixosModules.default
  # For home-manager
  inputs.spicetify-nix.homeManagerModules.default
];

Configuration

Basic

programs.spicetify =
let
  spicePkgs = inputs.spicetify-nix.legacyPackages.${pkgs.system};
in
{
  enable = true;
  theme = spicePkgs.themes.catppuccin;
}

Advanced

programs.spicetify =
let
  spicePkgs = inputs.spicetify-nix.legacyPackages.${pkgs.system};
in
{
  enable = true;

  enabledExtensions = with spicePkgs.extensions; [
    adblock
    hidePodcasts
    shuffle # shuffle+ (special characters are sanitized out of extension names)
  ];
  enabledCustomApps = with spicePkgs.apps; [
    newReleases
    ncsVisualizer
  ];
  enabledSnippets = with spicePkgs.snippets; [
    rotating-coverart
    pointer
  ];

  theme = spicePkgs.themes.catppuccin;
  colorScheme = "mocha";
}

Tips and Tricks

Location of Options

The options are found in the module: module.nix.

The extensions, customApps, and themes are found in the following files: EXTENSIONS.md, CUSTOMAPPS.md, THEMES.md.

Unpackaged Parameters

Below are instructions on how to package customApps that are not in the module by default.

programs.spicetify.enabledCustomApps= [
  ({
      # The source of the customApp
      src = pkgs.fetchFromGitHub {
        owner = "";
        repo = "";
        rev = "";
        hash = "";
      };
      # The actual file name of the customApp usually ends with .js
      name = "";
  })
];

Keep in mind that this can be applied to the other parameters as well. A custom theme allows for more options to be applied.

programs.spicetify.theme = {
  # Name of the theme
  name = "";
  # The source of the theme
  src = pkgs.fetchFromGitHub {
    owner = "";
    repo = "";
    rev = "";
    hash = "";
  };
  
  # Additional theme options all set to defaults
  # the docs of the theme should say which of these 
  # if any you have to change
  injectCss = true;
  injectThemeJs = true;
  replaceColors = true;
  sidebarConfig = true;
  homeConfig = true;
  overwriteAssets = false;
  additonalCss = "";
};

Troubleshooting

References

  1. https://spotify.com
  2. https://github.com/Gerg-L/spicetify-nix
  3. https://www.spotify.com/legal/end-user-agreement
  4. https://github.com/Gerg-L/spicetify-nix/blob/master/module.nix
  5. https://github.com/Gerg-L/spicetify-nix/blob/master/docs/EXTENSIONS.md
  6. https://github.com/Gerg-L/spicetify-nix/blob/master/docs/CUSTOMAPPS.md
  7. https://github.com/Gerg-L/spicetify-nix/blob/master/docs/THEMES.md