flake-template-hell/templates/rust/flake.nix

46 lines
975 B
Nix
Raw Normal View History

2024-08-14 23:44:43 +01:00
{
description = "Rust Developer Environment";
inputs = {
2024-12-04 17:35:06 +00:00
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
2024-08-14 23:44:43 +01:00
rust.url = "github:oxalica/rust-overlay";
};
2024-12-04 17:35:06 +00:00
outputs = {
self,
nixpkgs,
rust,
}: let
2024-08-14 23:44:43 +01:00
systems = [
"x86_64-linux"
"aarch64-linux"
];
forAllSystems = nixpkgs.lib.genAttrs systems;
in {
packages = forAllSystems (system: let
pkgs = import nixpkgs {
inherit system;
overlays = [
2024-12-04 17:35:06 +00:00
(import rust)
2024-08-14 23:44:43 +01:00
];
};
inherit system;
in {
2024-12-04 17:35:06 +00:00
rust-app = pkgs.callPackage ./nix/package.nix {};
2024-08-14 23:44:43 +01:00
default = self.packages.${system}.rust-app;
});
devShells = forAllSystems (system: let
pkgs = import nixpkgs {
inherit system;
overlays = [
2024-12-04 17:35:06 +00:00
(import rust)
2024-08-14 23:44:43 +01:00
];
};
inherit system;
in {
default = pkgs.callPackage ./nix/shell.nix {
inherit (self.packages.${system}) rust-app;
};
});
};
}