From 0f31ad218c3d527cc751b1225004382fa79ee4a9 Mon Sep 17 00:00:00 2001 From: Felix Stupp Date: Thu, 5 Sep 2024 00:36:01 +0000 Subject: [PATCH] add librespot-auth package --- flake.lock | 16 +++++++++++ flake.nix | 2 ++ nix/packages/default.nix | 12 ++++++++- nix/packages/librespot-auth/default.nix | 35 +++++++++++++++++++++++++ 4 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 nix/packages/librespot-auth/default.nix diff --git a/flake.lock b/flake.lock index a2d9526..268d6cc 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,20 @@ { "nodes": { + "crane": { + "locked": { + "lastModified": 1725125250, + "narHash": "sha256-CB20rDD5eHikF6mMTTJdwPP1qvyoiyyw1RDUzwIaIF8=", + "owner": "ipetkov", + "repo": "crane", + "rev": "96fd12c7100e9e05fa1a0a5bd108525600ce282f", + "type": "github" + }, + "original": { + "owner": "ipetkov", + "repo": "crane", + "type": "github" + } + }, "disko": { "inputs": { "nixpkgs": [ @@ -106,6 +121,7 @@ }, "root": { "inputs": { + "crane": "crane", "disko": "disko", "home-manager": "home-manager", "impermanence": "impermanence", diff --git a/flake.nix b/flake.nix index 4723855..b6af58f 100644 --- a/flake.nix +++ b/flake.nix @@ -24,6 +24,8 @@ inputs.nixpkgs.follows = "nixpkgs"; }; + crane.url = "github:ipetkov/crane"; + # required for configs nixos-hardware.url = "github:NixOS/nixos-hardware/master"; diff --git a/nix/packages/default.nix b/nix/packages/default.nix index 3ac47b3..f420b2e 100644 --- a/nix/packages/default.nix +++ b/nix/packages/default.nix @@ -1,7 +1,17 @@ -{ lib, outputs, ... }@flakeArg: +{ + inputs, + lib, + outputs, + ... +}@flakeArg: { pkgs, system, ... }@sysArg: +let + craneLib = inputs.crane.mkLib pkgs; +in { + librespot-auth = pkgs.callPackage ./librespot-auth { inherit craneLib; }; + nft-update-addresses = pkgs.callPackage ./nft-update-addresses { }; secrix-wrapper = diff --git a/nix/packages/librespot-auth/default.nix b/nix/packages/librespot-auth/default.nix new file mode 100644 index 0000000..bee8aca --- /dev/null +++ b/nix/packages/librespot-auth/default.nix @@ -0,0 +1,35 @@ +{ + stdenv, + lib, + fetchFromGitHub, + # from flake + craneLib, +}: + +# TODO temporary useful due to https://github.com/hrkfdn/ncspot/issues/1500 +craneLib.buildPackage rec { + pname = "librespot-auth"; + version = "0.1.1"; + + src = fetchFromGitHub { + owner = "dspearson"; + repo = "librespot-auth"; + rev = "v${version}"; + hash = "sha256-IbbArRSKpnljhZSgL0b3EjVzKWN7bk6t0Bv7TkYr8FI="; + }; + + buildInputs = [ ]; + + enableParallelBuilding = true; + + # Ensure Rust compiles for the right target + env.CARGO_BUILD_TARGET = stdenv.hostPlatform.rust.rustcTarget; + + meta = with lib; { + description = "A simple program for populating a `credentials.json` for librespot via Spotify's zeroconf authentication."; + homepage = "https://github.com/dspearson/librespot-auth"; + changelog = "https://github.com/dspearson/librespot-auth/releases/tag/v${version}"; + license = licenses.isc; + mainProgram = "librespot-auth"; + }; +}