71 lines
2.1 KiB
Nix
71 lines
2.1 KiB
Nix
|
{
|
||
|
description = "rust-template";
|
||
|
|
||
|
inputs = {
|
||
|
nixpkgs.url = github:NixOS/nixpkgs/nixpkgs-unstable;
|
||
|
flake-utils.url = github:numtide/flake-utils;
|
||
|
|
||
|
rust-overlay = {
|
||
|
url = github:oxalica/rust-overlay;
|
||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||
|
inputs.flake-utils.follows = "flake-utils";
|
||
|
};
|
||
|
|
||
|
cargo2nix = {
|
||
|
url = github:cargo2nix/cargo2nix;
|
||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||
|
inputs.flake-utils.follows = "flake-utils";
|
||
|
inputs.rust-overlay.follows = "rust-overlay";
|
||
|
};
|
||
|
};
|
||
|
|
||
|
outputs = { self, nixpkgs, flake-utils, rust-overlay, cargo2nix, ... } @ inputs: flake-utils.lib.eachSystem [ "x86_64-linux" ] (system:
|
||
|
let
|
||
|
overlays = [
|
||
|
cargo2nix.overlays.default
|
||
|
(import rust-overlay)
|
||
|
];
|
||
|
pkgs = import nixpkgs {
|
||
|
inherit system overlays;
|
||
|
};
|
||
|
rustPkgs = pkgs.rustBuilder.makePackageSet {
|
||
|
packageFun = import ./Cargo.nix;
|
||
|
rustChannel = "nightly";
|
||
|
target = "thumbv6m-none-eabi";
|
||
|
packageOverrides = pkgs: pkgs.rustBuilder.overrides.all;
|
||
|
};
|
||
|
in
|
||
|
rec {
|
||
|
devShells.default = with pkgs; mkShell {
|
||
|
buildInputs = [
|
||
|
(rust-bin.nightly.latest.default.override {
|
||
|
extensions = [ "rust-src" ];
|
||
|
})
|
||
|
cargo2nix.packages.${system}.cargo2nix
|
||
|
];
|
||
|
};
|
||
|
packages = {
|
||
|
rkbfirm-source = pkgs.releaseTools.sourceTarball {
|
||
|
name = "rkbfirm-source";
|
||
|
src = self;
|
||
|
officialRelease = true;
|
||
|
version = self.lastModifiedDate;
|
||
|
nativeBuildInputs = [ pkgs.zstd ];
|
||
|
distPhase = ''
|
||
|
releaseName=rkb1-src-$version
|
||
|
mkdir -p $out/tarballs
|
||
|
mkdir ../$releaseName
|
||
|
cp -prd . ../$releaseName
|
||
|
(cd .. && tar -cf- $releaseName | zstd --ultra -22 > $out/tarballs/$releaseName.tar.zst) || false
|
||
|
'';
|
||
|
};
|
||
|
rust-template = rustPkgs.workspace.rust-template { };
|
||
|
|
||
|
};
|
||
|
nixosModules.default = import ./nixos {
|
||
|
inherit inputs system;
|
||
|
};
|
||
|
hydraJobs = packages;
|
||
|
});
|
||
|
}
|