2024-02-27 11:02:16 +08:00

87 lines
2.7 KiB
Nix

{
inputs = {
fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
};
nixpkgs.url = "nixpkgs/nixos-unstable";
};
outputs = { nixpkgs, fenix, ... }:
let
systems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
foreachSystem = nixpkgs.lib.genAttrs systems;
in
rec {
packages = foreachSystem (system:
let
pkgs = import nixpkgs { inherit system; };
rustPlatform = pkgs.makeRustPlatform {
cargo = fenix.packages."${pkgs.stdenv.system}".complete.toolchain;
rustc = fenix.packages."${pkgs.stdenv.system}".complete.toolchain;
};
buildTools = with pkgs; [ pkg-config ];
libraries = with pkgs; [ sqlite ] ++ (nixpkgs.lib.optional pkgs.stdenv.isDarwin darwin.apple_sdk.frameworks.Security);
in
rec {
ice-publicip-checker = rustPlatform.buildRustPackage rec {
pname = "ice-publicip-checker";
version = "1.0.0";
nativeBuildInputs = buildTools;
buildInputs = libraries;
src = ./.;
cargoLock = {
lockFile = ./Cargo.lock;
};
meta = with nixpkgs.lib; {
description = "rust project scaffold";
homepage = "https://git.jeffthecoder.xyz/public/os-flakes";
license = licenses.unlicense;
maintainers = [ ];
};
};
default = ice-publicip-checker;
});
devShells = foreachSystem
(system:
let
pkgs = import nixpkgs { inherit system; };
developmentTools = with pkgs; [
# bpf-linker
# cargo-espflash
# cargo-generate
# cargo-make
# cargo-mobile2
# cargo-tauri
# cargo-watch
# TODO: cargo-xcode
# TODO: create-tauri-app
# cargo-espflash
# TODO: kopium
# TODO: ldproxy
# TODO: paperclip
sea-orm-cli
# perseus-cli
# trunk
# wasm-bindgen-cli
] ++ (with fenix.packages."${system}".complete; [ rust-analyzer rust-src ]);
in
with pkgs; rec {
default = packages."${system}".default.overrideAttrs (prevAttrs: {
nativeBuildInputs = prevAttrs.nativeBuildInputs ++ developmentTools;
RUST_SRC_PATH = stdenv.mkDerivation {
inherit (rustc) src;
inherit (rustc.src) name;
phases = ["unpackPhase" "installPhase"];
installPhase = ''cp -r library $out'';
};
});
});
};
}