kalker/flake.nix

61 lines
1.5 KiB
Nix
Raw Normal View History

{
description = "A calculator program/website";
outputs = { self, nixpkgs }:
let
systems =
[ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f system);
nixpkgsFor = forAllSystems (system:
import nixpkgs {
inherit system;
overlays = [ self.overlay ];
});
2021-09-30 10:08:39 +02:00
in rec {
overlay = final: prev: {
kalker = final.rustPlatform.buildRustPackage {
pname = "kalker";
version = "unstable";
2021-09-24 09:54:06 +02:00
description = "A CLI calculator";
src = self;
nativeBuildInputs = with final; [ gcc ];
outputs = [ "out" "lib" ];
postInstall = ''
moveToOutput "lib" "$lib"
'';
cargoLock = { lockFile = self + "/Cargo.lock"; };
buildInputs = with final; [ gmp mpfr libmpc ];
CARGO_FEATURE_USE_SYSTEM_LIBS = "1";
};
};
2021-09-23 12:37:08 +02:00
packages =
forAllSystems (system: { inherit (nixpkgsFor.${system}) kalker; });
defaultPackage = forAllSystems (system: self.packages.${system}.kalker);
apps = forAllSystems (system: {
kalker = {
type = "app";
program = "${self.packages.${system}.kalker}/bin/kalker";
};
});
defaultApp = forAllSystems (system: self.apps.${system}.kalker);
2021-09-24 09:57:56 +02:00
devShell = forAllSystems (system:
nixpkgs.legacyPackages.${system}.mkShell {
2021-09-30 10:08:39 +02:00
inputsFrom = builtins.attrValues (packages.${system});
2021-09-24 09:57:56 +02:00
});
};
}