add Cargo.nix & update flake.nix accordingly

This commit is contained in:
Armaël Guéneau 2024-04-10 15:07:29 +02:00
parent 35cb6c2267
commit fad6b02297
2 changed files with 3699 additions and 11 deletions

3673
Cargo.nix Normal file

File diff suppressed because it is too large Load diff

View file

@ -1,14 +1,29 @@
{
description = "restic-alarm";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
outputs = { self, nixpkgs } :
let pkgs = import nixpkgs { system = "x86_64-linux"; };
in {
defaultPackage.x86_64-linux = pkgs.rustPlatform.buildRustPackage rec {
pname = "restic-alarm";
version = "0.0.1";
src = ./.;
cargoLock.lockFile = ./Cargo.lock;
inputs = {
cargo2nix.url = "github:cargo2nix/cargo2nix/release-0.11.0";
flake-utils.follows = "cargo2nix/flake-utils";
nixpkgs.follows = "cargo2nix/nixpkgs";
};
outputs = inputs: with inputs;
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [cargo2nix.overlays.default];
};
rustPkgs = pkgs.rustBuilder.makePackageSet {
rustVersion = "1.75.0";
packageFun = import ./Cargo.nix;
};
in rec {
packages = {
restic-alarm = (rustPkgs.workspace.restic-alarm {});
default = packages.restic-alarm;
};
}
);
}