{ description = "Flake to build and develop honeyfetch"; inputs = { flake-utils.url = "github:numtide/flake-utils"; naersk.url = "github:nix-community/naersk"; nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; }; outputs = { self, flake-utils, naersk, nixpkgs }: flake-utils.lib.eachDefaultSystem (system: let pkgs = import nixpkgs { inherit system; }; naersk' = pkgs.callPackage naersk {}; # Common variables LIBCLANG_PATH = "${pkgs.llvmPackages.libclang.lib}/lib"; CLANG_PATH = "${pkgs.llvmPackages.clang}/bin/clang"; commonBuildInputs = with pkgs; [ libdrm openssl ]; commonNativeInputs = with pkgs; [ rustc cargo clippy ]; srcPath = builtins.path { path = ./.; name = "source"; }; in rec { packages = { default = naersk'.buildPackage { inherit LIBCLANG_PATH CLANG_PATH; src = srcPath; nativeBuildInputs = commonNativeInputs ++ commonBuildInputs; }; check = naersk'.buildPackage { inherit LIBCLANG_PATH CLANG_PATH; src = srcPath; nativeBuildInputs = commonNativeInputs ++ commonBuildInputs; }; test = naersk'.buildPackage { inherit LIBCLANG_PATH CLANG_PATH; src = srcPath; nativeBuildInputs = commonNativeInputs ++ commonBuildInputs; mode = "test"; }; clippy = naersk'.buildPackage { inherit LIBCLANG_PATH CLANG_PATH; src = srcPath; nativeBuildInputs = commonNativeInputs ++ commonBuildInputs; mode = "clippy"; }; devShell = pkgs.mkShell { inherit LIBCLANG_PATH CLANG_PATH; nativeBuildInputs = commonNativeInputs ++ commonBuildInputs; }; }; } ); }