chore: Add package output to nix flake
This commit is contained in:
parent
99e7d3895a
commit
9447de3f74
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,2 +1,3 @@
|
|||||||
/target
|
/target
|
||||||
|
/result
|
||||||
.direnv
|
.direnv
|
||||||
|
33
flake.nix
33
flake.nix
@ -15,18 +15,51 @@
|
|||||||
let
|
let
|
||||||
overlays = [ (import rust-overlay) ];
|
overlays = [ (import rust-overlay) ];
|
||||||
pkgs = import nixpkgs { inherit system overlays; };
|
pkgs = import nixpkgs { inherit system overlays; };
|
||||||
|
lib = nixpkgs.lib;
|
||||||
rust = pkgs.rust-bin;
|
rust = pkgs.rust-bin;
|
||||||
|
|
||||||
rustToolchain = rust.fromRustupToolchainFile ./rust-toolchain.toml;
|
rustToolchain = rust.fromRustupToolchainFile ./rust-toolchain.toml;
|
||||||
rustNightlyToolchain = rust.selectLatestNightlyWith (t: t.minimal.override {
|
rustNightlyToolchain = rust.selectLatestNightlyWith (t: t.minimal.override {
|
||||||
extensions = [ "rustfmt" ];
|
extensions = [ "rustfmt" ];
|
||||||
});
|
});
|
||||||
|
rustPlatform = pkgs.makeRustPlatform {
|
||||||
|
cargo = rustToolchain;
|
||||||
|
rustc = rustToolchain;
|
||||||
|
};
|
||||||
|
|
||||||
buildTools = [
|
buildTools = [
|
||||||
rustToolchain
|
rustToolchain
|
||||||
rustNightlyToolchain
|
rustNightlyToolchain
|
||||||
];
|
];
|
||||||
|
|
||||||
|
manifest = lib.importTOML ./Cargo.toml;
|
||||||
|
packageName = manifest.package.name;
|
||||||
|
packageVersion = manifest.package.version;
|
||||||
|
|
||||||
|
package = rustPlatform.buildRustPackage {
|
||||||
|
nativeBuildInputs = buildTools;
|
||||||
|
|
||||||
|
pname = packageName;
|
||||||
|
version = packageVersion;
|
||||||
|
src = lib.cleanSource ./.;
|
||||||
|
|
||||||
|
verbose = true;
|
||||||
|
|
||||||
|
cargoLock = {
|
||||||
|
lockFile = ./Cargo.lock;
|
||||||
|
allowBuiltinFetchGit = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
meta = {
|
||||||
|
mainProgram = packageName;
|
||||||
|
};
|
||||||
|
};
|
||||||
in {
|
in {
|
||||||
|
packages = {
|
||||||
|
default = package;
|
||||||
|
${packageName} = package;
|
||||||
|
};
|
||||||
|
|
||||||
devShells.default = pkgs.mkShell {
|
devShells.default = pkgs.mkShell {
|
||||||
name = "projtool";
|
name = "projtool";
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user