Files
sukr/flake.nix

69 lines
1.8 KiB
Nix

{
description = "sukr - bespoke static site compiler";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = {
self,
nixpkgs,
fenix,
}: let
systems = [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
forAllSystems = fn: nixpkgs.lib.genAttrs systems (system: fn (pkgsFor system) (toolchainFor system));
pkgsFor = system:
import nixpkgs {
system = system;
};
toolchainFor = system:
fenix.packages.${system}.fromToolchainFile {
file = ./rust-toolchain.toml;
sha256 = "sha256-vra6TkHITpwRyA5oBKAHSX0Mi6CBDNQD+ryPSpxFsfg=";
};
cargoToml = builtins.fromTOML (builtins.readFile ./Cargo.toml);
in {
devShells = forAllSystems (
pkgs: toolchain: {
default = pkgs.mkShell.override {stdenv = pkgs.clangStdenv;} {
RUST_SRC_PATH = "${toolchain}/lib/rustlib/src/rust/library";
packages =
[
toolchain
pkgs.treefmt
pkgs.shfmt
pkgs.rust-analyzer
pkgs.taplo
pkgs.pkg-config
pkgs.nixfmt
pkgs.nodePackages.prettier
pkgs.miniserve # Dev server for testing
]
++ pkgs.lib.optionals pkgs.stdenv.isDarwin [
pkgs.apple-sdk
pkgs.libiconv
];
};
}
);
packages = forAllSystems (pkgs: toolchain: rec {
sukr = pkgs.rustPlatform.buildRustPackage {
pname = cargoToml.package.name;
version = cargoToml.package.version;
src = ./.;
cargoHash = "sha256-ubioKKShVIkLVHI+IDzFOo67jv4gtzr1Rfhi/9s7/vo=";
};
default = sukr;
});
};
}