From 01d4cf8273d78a18169d9ca95be2295a8c2b6629 Mon Sep 17 00:00:00 2001 From: Ahmad Ansori Palembani Date: Wed, 6 Nov 2024 10:31:11 +0700 Subject: [PATCH] chore(nix/deps): Manage (Spiced) Spotify with Nix --- nix/flake.lock | 40 +++++++++++++++++++++++++++- nix/flake.nix | 22 ++++++++++----- nix/systems/darwin/configuration.nix | 10 ++++++- nix/systems/darwin/default.nix | 8 ++++-- nix/users/default.nix | 2 +- 5 files changed, 70 insertions(+), 12 deletions(-) diff --git a/nix/flake.lock b/nix/flake.lock index d369b13..947667f 100644 --- a/nix/flake.lock +++ b/nix/flake.lock @@ -88,6 +88,22 @@ "type": "github" } }, + "flake-compat_2": { + "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" + } + }, "flake-utils": { "inputs": { "systems": "systems" @@ -274,7 +290,7 @@ }, "pre-commit-hooks": { "inputs": { - "flake-compat": "flake-compat", + "flake-compat": "flake-compat_2", "gitignore": "gitignore", "nixpkgs": [ "system-manager", @@ -306,6 +322,7 @@ "nixpkgs-stable": "nixpkgs-stable", "nixpkgs-unstable": "nixpkgs-unstable", "nur": "nur", + "spicetify-nix": "spicetify-nix", "system-manager": "system-manager" } }, @@ -330,6 +347,27 @@ "type": "github" } }, + "spicetify-nix": { + "inputs": { + "flake-compat": "flake-compat", + "nixpkgs": [ + "nixpkgs-unstable" + ] + }, + "locked": { + "lastModified": 1730780158, + "narHash": "sha256-ZJkCFn4PL49rINz7xrjlBqw9nF8wWJE7fSVqbHlCWSA=", + "owner": "Gerg-L", + "repo": "spicetify-nix", + "rev": "2791c6662002731d3dfc00312307aef547e1c8be", + "type": "github" + }, + "original": { + "owner": "Gerg-L", + "repo": "spicetify-nix", + "type": "github" + } + }, "system-manager": { "inputs": { "crane": "crane", diff --git a/nix/flake.nix b/nix/flake.nix index 407201c..1f54a2e 100644 --- a/nix/flake.nix +++ b/nix/flake.nix @@ -3,10 +3,13 @@ outputs = inputs@{ self, nix-darwin, brew-api, nixpkgs-stable, nixpkgs-unstable, home-manager, system-manager, nur, ... }: let + utils = inputs.flake-utils.lib; + vars = { floorp = { verticalTabHoverWidthInEm = 18; }; + rev = self.rev or self.dirtyRev or null; }; in @@ -36,8 +39,20 @@ inputs = { nixpkgs-stable.url = "github:NixOS/nixpkgs/release-24.05"; nixpkgs-unstable.url = "github:NixOS/nixpkgs/2d2a9ddbe3f2c00747398f3dc9b05f7f2ebb0f53"; + nur.url = "github:nix-community/NUR"; + flake-utils.url = "github:numtide/flake-utils"; + spicetify-nix = { + url = "github:Gerg-L/spicetify-nix"; + inputs.nixpkgs.follows = "nixpkgs-unstable"; + }; + + home-manager = { + url = "github:nix-community/home-manager/64c6325b28ebd708653dd41d88f306023f296184"; + inputs.nixpkgs.follows = "nixpkgs-unstable"; # we need unstable (24.11) for programs.floorp. FIXME: switch to stable once 24.11 become stable + }; + nix-darwin = { url = "github:LnL7/nix-darwin/189d2d422c773fa065cc9c72e6806f007ebb9be0"; inputs.nixpkgs.follows = "nixpkgs-stable"; @@ -51,16 +66,9 @@ flake = false; }; - home-manager = { - url = "github:nix-community/home-manager/64c6325b28ebd708653dd41d88f306023f296184"; - inputs.nixpkgs.follows = "nixpkgs-unstable"; # we need unstable (24.11) for programs.floorp. FIXME: switch to stable once 24.11 become stable - }; - system-manager = { url = "github:numtide/system-manager/c93e62f2e962b54fd961798731d25eaa5778dbe2"; inputs.nixpkgs.follows = "nixpkgs-stable"; }; - - nur.url = "github:nix-community/NUR"; }; } diff --git a/nix/systems/darwin/configuration.nix b/nix/systems/darwin/configuration.nix index a388ef8..f7929ca 100644 --- a/nix/systems/darwin/configuration.nix +++ b/nix/systems/darwin/configuration.nix @@ -1,4 +1,4 @@ -{ pkgs, pkgs-unstable, config, vars, common, inputs, ... }: +{ pkgs, pkgs-unstable, spicePkgs, config, vars, common, inputs, ... }: let libFixup = import ../../lib/darwin/libFixup.nix; @@ -74,6 +74,14 @@ in { # Create /etc/zshrc that loads the nix-darwin environment. programs.zsh.enableCompletion = false; # causing "insecure directories and files" error if user doesn't have configured zsh + programs.spicetify = { + enable = true; + enabledExtensions = with spicePkgs.extensions; [ + adblock + shuffle + ]; + }; + # Set Git commit hash for darwin-version. system.configurationRevision = vars.rev or null; diff --git a/nix/systems/darwin/default.nix b/nix/systems/darwin/default.nix index 760e6ae..4e04fd1 100644 --- a/nix/systems/darwin/default.nix +++ b/nix/systems/darwin/default.nix @@ -30,11 +30,13 @@ in } ) pkgs pkgs-unstable; common = (mkCommon { inherit pkgs pkgs-unstable; }); + spicePkgs = inputs.spicetify-nix.legacyPackages.${system}; in nix-darwin.lib.darwinSystem { inherit system; - specialArgs = { inherit inputs pkgs pkgs-unstable vars common; }; + specialArgs = { inherit inputs pkgs pkgs-unstable spicePkgs vars common; }; modules = [ + inputs.spicetify-nix.nixosModules.default # Also works on nix-darwin thanks to it being nixosConfiguration replacement for macOS ./configuration.nix ]; }; @@ -57,11 +59,13 @@ in } ) pkgs pkgs-unstable; common = (mkCommon { inherit pkgs pkgs-unstable; }); + spicePkgs = inputs.spicetify-nix.legacyPackages.${system}; in nix-darwin.lib.darwinSystem { inherit system; - specialArgs = { inherit inputs pkgs pkgs-unstable vars common; }; + specialArgs = { inherit inputs pkgs pkgs-unstable spicePkgs vars common; }; modules = [ + inputs.spicetify-nix.nixosModules.default ./configuration.nix ]; }; diff --git a/nix/users/default.nix b/nix/users/default.nix index 6e8d00f..1c17a27 100644 --- a/nix/users/default.nix +++ b/nix/users/default.nix @@ -27,7 +27,7 @@ in unstable = nixpkgs-unstable; extraOverlays = [ inputs.firefox-darwin.overlay - (mkBrew { inherit system; brew-api = inputs.brew-api; nixpkgs = nixpkgs-stable; }) + (mkBrew { inherit system; inherit (inputs) brew-api; nixpkgs = nixpkgs-stable; }) ]; nur = nur; }