Introduce nix into the project

This commit is contained in:
Michael Zhang 2021-09-05 04:13:41 -05:00
parent 3593bc8c5e
commit c26c135c55
Signed by: michael
GPG key ID: BDA47A31A3C8EE6B
5 changed files with 2262 additions and 0 deletions

3
.gitignore vendored
View file

@ -1,2 +1,5 @@
/target
**/*.rs.bk
/result
/result-lib

2188
Cargo.nix Normal file

File diff suppressed because it is too large Load diff

41
flake.lock Normal file
View file

@ -0,0 +1,41 @@
{
"nodes": {
"flake-utils": {
"locked": {
"lastModified": 1629481132,
"narHash": "sha256-JHgasjPR0/J1J3DRm4KxM4zTyAj4IOJY8vIl75v/kPI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "997f7efcb746a9c140ce1f13c72263189225f482",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1630832195,
"narHash": "sha256-9f1fN2joAFOkQ9KKNNNRaCjtRGXtmaJz2EWl5D+ztKM=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "33e17471c8f04c8f7aae64b6938aa72dad2abaeb",
"type": "github"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

27
flake.nix Normal file
View file

@ -0,0 +1,27 @@
{
inputs = {
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachSystem ["x86_64-linux"] (system:
let
pkgs = nixpkgs.legacyPackages.${system};
garbageProj = import ./Cargo.nix { inherit pkgs; };
garbage; = pkgs.lib.recursiveUpdate garbageProj.rootCrate.build {
meta = {
description = "CLI tool to interact with the FreeDesktop trash API.";
mainProgram = "garbage";
};
};
flakePkgs = {
inherit garbage;
};
in
rec {
packages = flake-utils.lib.flattenTree flakePkgs;
defaultPackage = flakePkgs.garbage;
});
}
# vim: set ts=2 sw=2 :

View file

@ -10,6 +10,9 @@ pub enum Error {
#[error("IO error: {0}")]
Io(#[from] std::io::Error),
#[error("Could not open file {0:?}: {1}")]
OpenFile(PathBuf, std::io::Error),
#[error("Walkdir error: {0}")]
WalkDir(#[from] walkdir::Error),