65 lines
1.6 KiB
Nix
65 lines
1.6 KiB
Nix
{
|
|
inputs = {
|
|
naersk.url = "github:nix-community/naersk/master";
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
|
utils.url = "github:numtide/flake-utils";
|
|
};
|
|
|
|
outputs =
|
|
{
|
|
self,
|
|
nixpkgs,
|
|
utils,
|
|
naersk,
|
|
}:
|
|
utils.lib.eachDefaultSystem (
|
|
system:
|
|
let
|
|
pkgs = import nixpkgs { inherit system; };
|
|
naersk-lib = pkgs.callPackage naersk { };
|
|
|
|
# Needed at compile time (on build system)
|
|
nativeBuildInputs = with pkgs; [
|
|
gtk4
|
|
cairo
|
|
glib
|
|
pkg-config
|
|
poppler
|
|
wrapGAppsHook
|
|
];
|
|
# Needed at runtime (on run system)
|
|
buildInputs = with pkgs; [ ];
|
|
in
|
|
rec {
|
|
defaultPackage = naersk-lib.buildPackage {
|
|
src = ./.;
|
|
inherit buildInputs;
|
|
inherit nativeBuildInputs;
|
|
|
|
postInstall = ''
|
|
mkdir -p $out/share/applications
|
|
cp ${./music-reader.desktop} $out/share/applications/music-reader.desktop
|
|
|
|
mkdir -p $out/share/icons
|
|
cp ${./music-reader.png} $out/share/icons/music-reader.png
|
|
'';
|
|
};
|
|
devShell =
|
|
with pkgs;
|
|
mkShell {
|
|
buildInputs = [
|
|
cargo
|
|
rustc
|
|
rustfmt
|
|
pre-commit
|
|
rustPackages.clippy
|
|
];
|
|
# Without inheriting nativeBuildinputs, cargo build will fail but that is good since we want to use only nix build
|
|
# inherit nativeBuildInputs;
|
|
|
|
RUST_SRC_PATH = rustPlatform.rustLibSrc;
|
|
};
|
|
}
|
|
);
|
|
}
|