zwote_sonne/flake.nix

54 lines
1.1 KiB
Nix
Raw Normal View History

2024-08-22 12:48:30 +02:00
{
description = "Light control over the network";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/release-24.05";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, rust-overlay }:
let
inherit (nixpkgs) lib;
systems = ["x86_64-linux"];
systemClosure = attrs:
builtins.foldl' (acc: system:
lib.recursiveUpdate acc (attrs system)) {}
systems;
in
systemClosure (system:
let
inherit ((builtins.fromTOML (builtins.readFile ./Cargo.toml)).package) name;
pkgs = import nixpkgs {
inherit system;
overlays = [(import rust-overlay)];
};
toolchain = (
pkgs.rust-bin.fromRustupToolchainFile ./rust_toolchain.toml
);
rustPlatform = pkgs.makeRustPlatform
{
rustc = toolchain;
cargo = toolchain;
};
libPath = with pkgs; lib.makeLibraryPath [
];
in
{
packages.${system}.default = pkgs.callPackage ./derivation.nix {
inherit name rustPlatform;
};
devShells.${system}.default = pkgs.mkShell {
buildInputs = with pkgs; [
toolchain
clang
llvmPackages.bintools
];
LD_LIBRARY_PATH = libPath;
};
});
}