mirror of
https://github.com/Superredstone/spotiflac-cli.git
synced 2026-03-07 12:11:47 +01:00
feat(nix): add nix build
This commit is contained in:
35
flake.nix
35
flake.nix
@@ -7,6 +7,8 @@
|
||||
{ self, ... }@inputs:
|
||||
|
||||
let
|
||||
pname = "spotiflac-cli";
|
||||
version = "7.0.9";
|
||||
goVersion = 24; # Change this to update the whole stack
|
||||
|
||||
supportedSystems = [
|
||||
@@ -26,6 +28,18 @@
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
pkgs = import inputs.nixpkgs {
|
||||
system = "x86_64-linux";
|
||||
overlays = [ inputs.self.overlays.default ];
|
||||
};
|
||||
|
||||
spotiflac = pkgs.fetchFromGitHub {
|
||||
owner = "afkarxyz";
|
||||
repo = "SpotiFLAC";
|
||||
tag = "v${version}";
|
||||
hash = "sha256-VHYof17C+eRoZfssXRQpbB8GXlcfPhyRiWltM6yDqe0=";
|
||||
};
|
||||
in
|
||||
{
|
||||
overlays.default = final: prev: {
|
||||
@@ -43,5 +57,26 @@
|
||||
};
|
||||
}
|
||||
);
|
||||
packages = forEachSupportedSystem (
|
||||
{ pkgs }:
|
||||
{
|
||||
default = pkgs.buildGoModule (finalAttrs: {
|
||||
inherit pname version;
|
||||
src = ./.;
|
||||
vendorHash = "sha256-EpGgfiCqJjHEOphV2x8FmXeIFls7eq2NVxb/or4NLUo=";
|
||||
|
||||
subPackages = [
|
||||
"."
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
cp -r ${spotiflac} ./SpotiFLAC/
|
||||
sed -i "s/git clone https:\/\/github.com\/afkarxyz\/SpotiFLAC.git//g" ./tools/fetch_spotiflac_backend.sh
|
||||
sed -i "s/rm -rf SpotiFLAC//g" ./tools/fetch_spotiflac_backend.sh
|
||||
./tools/fetch_spotiflac_backend.sh
|
||||
'';
|
||||
});
|
||||
}
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
2
go.mod
2
go.mod
@@ -2,6 +2,8 @@ module github.com/Superredstone/spotiflac-cli
|
||||
|
||||
go 1.24.4
|
||||
|
||||
replace github.com/Superredstone/spotiflac-cli/app => ./app
|
||||
|
||||
require (
|
||||
github.com/bogem/id3v2/v2 v2.1.4 // indirect
|
||||
github.com/boombuler/barcode v1.0.1-0.20190219062509-6c824513bacc // indirect
|
||||
|
||||
@@ -6,7 +6,7 @@ FOLDER=lib
|
||||
|
||||
rm -rf lib/
|
||||
git clone https://github.com/afkarxyz/SpotiFLAC.git
|
||||
mv SpotiFLAC/backend/ lib/
|
||||
cp -r SpotiFLAC/backend/ lib/
|
||||
mkdir -p app/
|
||||
cp SpotiFLAC/app.go app/app.go
|
||||
rm -rf SpotiFLAC
|
||||
@@ -14,6 +14,9 @@ rm -rf SpotiFLAC
|
||||
sed -i "s/package main/package app/g" app/app.go
|
||||
sed -i "s/\"spotiflac\/backend\"/backend \"github.com\/Superredstone\/spotiflac-cli\/lib\"/g" app/app.go
|
||||
|
||||
# Nix shenanigans
|
||||
chmod -R 777 lib
|
||||
|
||||
for i in $(ls lib/); do
|
||||
sed -i "s/package backend/package $FOLDER/g" $FOLDER/$i
|
||||
done
|
||||
|
||||
Reference in New Issue
Block a user