chore: remove cargo2nix

This commit changes from cargo2nix to just use `buildRustPackage`, which
does not generate itermediate crate derivations for the build. This
means that we lose dependency caching (for CI as well), but on the other
hand it becomes much more cacheable for people that actually use Nix to
add the dependencies.
This commit is contained in:
Cainã Costa 2023-07-06 15:40:02 -03:00 committed by Lucas
parent 723c347a1a
commit 4a435a69f0
3 changed files with 47 additions and 4904 deletions

4754
Cargo.nix generated vendored

File diff suppressed because it is too large Load Diff

108
flake.lock generated vendored
View File

@ -1,84 +1,6 @@
{ {
"nodes": { "nodes": {
"cargo2nix": {
"inputs": {
"flake-compat": "flake-compat",
"flake-utils": [
"flake-utils"
],
"nixpkgs": [
"nixpkgs"
],
"rust-overlay": [
"rust-overlay"
]
},
"locked": {
"lastModified": 1655189312,
"narHash": "sha256-gpJ57OgIebUpO+7F00VltxSEy6dz2x6HeJ5BcRM8rDA=",
"owner": "cargo2nix",
"repo": "cargo2nix",
"rev": "c149357cc3d17f2849c73eb7a09d07a307cdcfe8",
"type": "github"
},
"original": {
"owner": "cargo2nix",
"ref": "release-0.11.0",
"repo": "cargo2nix",
"type": "github"
}
},
"devshell": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1682700442,
"narHash": "sha256-qjaAAcCYgp1pBBG7mY9z95ODUBZMtUpf0Qp3Gt/Wha0=",
"owner": "numtide",
"repo": "devshell",
"rev": "fb6673fe9fe4409e3f43ca86968261e970918a83",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "devshell",
"type": "github"
}
},
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1650374568,
"narHash": "sha256-Z+s0J8/r907g149rllvwhb4pKi8Wam5ij0st8PwAh+E=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "b4a34015c698c7793d592d66adbab377907a2be8",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-utils": { "flake-utils": {
"locked": {
"lastModified": 1642700792,
"narHash": "sha256-XqHrk7hFb+zBvRg6Ghl+AZDq03ov6OshJLiSWOoX5es=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "846b2ae0fc4cc943637d3d1def4454213e203cba",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_2": {
"inputs": { "inputs": {
"systems": "systems" "systems": "systems"
}, },
@ -96,7 +18,7 @@
"type": "github" "type": "github"
} }
}, },
"flake-utils_3": { "flake-utils_2": {
"inputs": { "inputs": {
"systems": "systems_2" "systems": "systems_2"
}, },
@ -115,22 +37,6 @@
} }
}, },
"nixpkgs": { "nixpkgs": {
"locked": {
"lastModified": 1677383253,
"narHash": "sha256-UfpzWfSxkfXHnb4boXZNaKsAcUrZT9Hw+tao1oZxd08=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "9952d6bc395f5841262b006fbace8dd7e143b634",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1682773483, "lastModified": 1682773483,
"narHash": "sha256-FN7Zf+gQpYQUzt9LeJv6yGnvbqaBb97RjFtNnfu9OB4=", "narHash": "sha256-FN7Zf+gQpYQUzt9LeJv6yGnvbqaBb97RjFtNnfu9OB4=",
@ -145,7 +51,7 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs_3": { "nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1681358109, "lastModified": 1681358109,
"narHash": "sha256-eKyxW4OohHQx9Urxi7TQlFBTDWII+F+x2hklDOQPB50=", "narHash": "sha256-eKyxW4OohHQx9Urxi7TQlFBTDWII+F+x2hklDOQPB50=",
@ -163,17 +69,15 @@
}, },
"root": { "root": {
"inputs": { "inputs": {
"cargo2nix": "cargo2nix", "flake-utils": "flake-utils",
"devshell": "devshell", "nixpkgs": "nixpkgs",
"flake-utils": "flake-utils_2",
"nixpkgs": "nixpkgs_2",
"rust-overlay": "rust-overlay" "rust-overlay": "rust-overlay"
} }
}, },
"rust-overlay": { "rust-overlay": {
"inputs": { "inputs": {
"flake-utils": "flake-utils_3", "flake-utils": "flake-utils_2",
"nixpkgs": "nixpkgs_3" "nixpkgs": "nixpkgs_2"
}, },
"locked": { "locked": {
"lastModified": 1682734733, "lastModified": 1682734733,

View File

@ -6,75 +6,68 @@
# #
{ {
inputs = { inputs = {
cargo2nix = { nixpkgs.url = "github:nixos/nixpkgs";
url = "github:cargo2nix/cargo2nix/release-0.11.0";
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils";
inputs.rust-overlay.follows = "rust-overlay";
};
rust-overlay.url = "github:oxalica/rust-overlay"; rust-overlay.url = "github:oxalica/rust-overlay";
flake-utils.url = "github:numtide/flake-utils"; flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:nixos/nixpkgs";
devshell.url = "github:numtide/devshell";
}; };
outputs = { outputs = { self, rust-overlay, nixpkgs, flake-utils }:
self, flake-utils.lib.eachDefaultSystem (system:
cargo2nix, let
rust-overlay,
nixpkgs,
flake-utils,
devshell,
}:
flake-utils.lib.eachDefaultSystem (
system: let
pkgs = import nixpkgs { pkgs = import nixpkgs {
inherit system; inherit system;
overlays = [cargo2nix.overlays.default devshell.overlays.default]; overlays = [ rust-overlay.overlays.default ];
}; };
deno = nixpkgs.legacyPackages.${system}.deno; deno = nixpkgs.legacyPackages.${system}.deno;
rustPkgs = pkgs.rustBuilder.makePackageSet { aiken = pkgs.rustPlatform.buildRustPackage {
rustVersion = "1.69.0"; name = "aiken";
packageFun = import ./Cargo.nix; version = "1.0.11-alpha";
buildInputs = with pkgs; [ openssl ];
nativeBuildInputs = with pkgs; [ pkg-config openssl ];
src = pkgs.lib.cleanSourceWith { src = self; };
cargoLock.lockFile = ./Cargo.lock;
}; };
commonCategory = y: builtins.map (x: x // {category = y;}); commonCategory = y: builtins.map (x: x // { category = y; });
packages = { packages = {
aiken = (rustPkgs.workspace.aiken {}).bin; aiken = aiken;
default = packages.aiken; default = packages.aiken;
}; };
aikenCmds = commonCategory "Aiken Development" [ aikenCmds = commonCategory "Aiken Development" [{
{
name = "aiken"; name = "aiken";
help = "Aiken toolchain"; help = "Aiken toolchain";
package = packages.aiken; package = packages.aiken;
} }];
];
gitRev = if (builtins.hasAttr "rev" self) gitRev = if (builtins.hasAttr "rev" self) then self.rev else "dirty";
then self.rev
else "dirty";
in { in {
inherit packages; inherit packages;
devShell = rustPkgs.workspaceShell {
packages = [deno]; devShells.aiken = pkgs.mkShell {
shellHook = name = "aiken";
'' motd = ''
Aiken
$(type -p menu &>/dev/null && menu)'';
commands = aikenCmds;
packages = [
deno
(pkgs.rust-bin.stable.latest.default.override {
extensions = [ "rust-src" "clippy" "rustfmt" ];
})
];
shellHook = ''
export GIT_REVISION=${gitRev} export GIT_REVISION=${gitRev}
''; '';
}; };
devShells = { });
aiken = pkgs.devshell.mkShell {
name = "aiken";
motd = '' Aiken
$(type -p menu &>/dev/null && menu)'';
commands = aikenCmds;
};
};
}
);
} }