2022-02-08 11:25:17 +00:00
|
|
|
{
|
|
|
|
description = "A tool for organising a music library";
|
|
|
|
|
|
|
|
inputs = {
|
2023-08-31 22:08:21 +01:00
|
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
2022-02-08 11:25:17 +00:00
|
|
|
utils.url = "github:numtide/flake-utils";
|
|
|
|
flake-compat = {
|
|
|
|
url = "github:edolstra/flake-compat";
|
|
|
|
flake = false;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2023-01-08 10:24:44 +00:00
|
|
|
outputs = {
|
|
|
|
self,
|
|
|
|
nixpkgs,
|
|
|
|
utils,
|
|
|
|
...
|
|
|
|
}:
|
2022-02-08 11:25:17 +00:00
|
|
|
{
|
2023-09-08 10:55:10 +01:00
|
|
|
overlays.musicutil = final: prev: let
|
2023-01-08 10:24:44 +00:00
|
|
|
system = final.system;
|
2023-01-14 16:53:53 +00:00
|
|
|
pkgs = final.pkgs;
|
|
|
|
lib = pkgs.lib;
|
|
|
|
stdenv = pkgs.stdenv;
|
2022-02-08 11:25:17 +00:00
|
|
|
in {
|
2023-01-14 16:53:53 +00:00
|
|
|
musicutil = pkgs.rustPlatform.buildRustPackage rec {
|
2023-01-08 10:24:44 +00:00
|
|
|
pname = "musicutil";
|
|
|
|
version = "latest";
|
|
|
|
|
|
|
|
src = ./.;
|
|
|
|
cargoLock = {lockFile = ./Cargo.lock;};
|
2022-02-08 11:25:17 +00:00
|
|
|
|
2023-01-14 16:53:53 +00:00
|
|
|
LIBCLANG_PATH = "${pkgs.llvmPackages.libclang.lib}/lib";
|
|
|
|
|
|
|
|
preBuild = ''
|
|
|
|
export BINDGEN_EXTRA_CLANG_ARGS="$(< ${stdenv.cc}/nix-support/libc-crt1-cflags) \
|
|
|
|
$(< ${stdenv.cc}/nix-support/libc-cflags) \
|
|
|
|
$(< ${stdenv.cc}/nix-support/cc-cflags) \
|
|
|
|
$(< ${stdenv.cc}/nix-support/libcxx-cxxflags) \
|
|
|
|
${lib.optionalString stdenv.cc.isClang "-idirafter ${stdenv.cc.cc}/lib/clang/${lib.getVersion stdenv.cc.cc}/include"} \
|
|
|
|
${lib.optionalString stdenv.cc.isGNU "-isystem ${stdenv.cc.cc}/include/c++/${lib.getVersion stdenv.cc.cc} -isystem ${stdenv.cc.cc}/include/c++/${lib.getVersion stdenv.cc.cc}/${stdenv.hostPlatform.config} -idirafter ${stdenv.cc.cc}/lib/gcc/${stdenv.hostPlatform.config}/${lib.getVersion stdenv.cc.cc}/include"} \
|
|
|
|
"
|
|
|
|
'';
|
|
|
|
|
2023-01-08 10:24:44 +00:00
|
|
|
postPatch = ''
|
2023-01-14 16:53:53 +00:00
|
|
|
substituteInPlace src/meta.rs --replace 'ffmpeg' '${pkgs.ffmpeg}/bin/ffmpeg'
|
|
|
|
substituteInPlace src/meta.rs --replace 'ffprobe' '${pkgs.ffmpeg}/bin/ffprobe'
|
2023-01-08 10:24:44 +00:00
|
|
|
'';
|
2022-04-23 15:23:51 +01:00
|
|
|
|
2023-01-08 10:24:44 +00:00
|
|
|
doCheck = false;
|
2023-01-14 16:53:53 +00:00
|
|
|
nativeBuildInputs = with pkgs; [pkg-config rustc cargo];
|
|
|
|
buildInputs = with pkgs; [ffmpeg zlib taglib];
|
2022-08-16 09:05:18 +01:00
|
|
|
};
|
2023-01-08 10:24:44 +00:00
|
|
|
};
|
2023-09-08 10:55:10 +01:00
|
|
|
overlays.default = self.overlays.musicutil;
|
2023-01-08 10:24:44 +00:00
|
|
|
}
|
|
|
|
// utils.lib.eachSystem (utils.lib.defaultSystems) (system: let
|
|
|
|
pkgs = import nixpkgs {
|
|
|
|
inherit system;
|
2023-09-08 10:55:10 +01:00
|
|
|
overlays = [self.overlays.default];
|
2023-01-08 10:24:44 +00:00
|
|
|
};
|
|
|
|
in {
|
|
|
|
defaultPackage = self.packages."${system}".musicutil;
|
|
|
|
packages.musicutil = pkgs.musicutil;
|
|
|
|
|
|
|
|
apps = rec {
|
|
|
|
musicutil = {
|
|
|
|
type = "app";
|
|
|
|
program = "${self.defaultPackage.${system}}/bin/musicutil";
|
|
|
|
};
|
|
|
|
default = musicutil;
|
|
|
|
};
|
|
|
|
|
|
|
|
defaultApp = self.apps."${system}".musicutil;
|
|
|
|
|
|
|
|
devShell = pkgs.mkShell {
|
|
|
|
RUST_SRC_PATH = pkgs.rustPlatform.rustLibSrc;
|
|
|
|
LIBCLANG_PATH = "${pkgs.llvmPackages.libclang.lib}/lib";
|
2023-01-14 16:53:53 +00:00
|
|
|
buildInputs = with pkgs; [zlib taglib pkg-config rustc cargo clippy rust-analyzer rustfmt];
|
2023-01-08 10:24:44 +00:00
|
|
|
shellHook = let
|
|
|
|
stdenv = pkgs.stdenv;
|
|
|
|
lib = pkgs.lib;
|
|
|
|
in ''
|
|
|
|
export BINDGEN_EXTRA_CLANG_ARGS="$(< ${stdenv.cc}/nix-support/libc-crt1-cflags) \
|
|
|
|
$(< ${stdenv.cc}/nix-support/libc-cflags) \
|
|
|
|
$(< ${stdenv.cc}/nix-support/cc-cflags) \
|
|
|
|
$(< ${stdenv.cc}/nix-support/libcxx-cxxflags) \
|
|
|
|
${lib.optionalString stdenv.cc.isClang "-idirafter ${stdenv.cc.cc}/lib/clang/${lib.getVersion stdenv.cc.cc}/include"} \
|
|
|
|
${lib.optionalString stdenv.cc.isGNU "-isystem ${stdenv.cc.cc}/include/c++/${lib.getVersion stdenv.cc.cc} -isystem ${stdenv.cc.cc}/include/c++/${lib.getVersion stdenv.cc.cc}/${stdenv.hostPlatform.config} -idirafter ${stdenv.cc.cc}/lib/gcc/${stdenv.hostPlatform.config}/${lib.getVersion stdenv.cc.cc}/include"} \
|
|
|
|
"
|
|
|
|
'';
|
|
|
|
};
|
2022-02-22 14:02:58 +00:00
|
|
|
|
2023-01-08 10:24:44 +00:00
|
|
|
lib = pkgs.musicutil.lib;
|
|
|
|
});
|
2022-02-08 11:25:17 +00:00
|
|
|
}
|