Update flake with better devshell, remove default.nix
This commit is contained in:
parent
7d8e161073
commit
b8c794f9d7
|
@ -1 +1,3 @@
|
|||
/target
|
||||
/result
|
||||
/.direnv
|
||||
|
|
55
default.nix
55
default.nix
|
@ -1,55 +0,0 @@
|
|||
{ lib
|
||||
, naersk
|
||||
, stdenv
|
||||
, clangStdenv
|
||||
, hostPlatform
|
||||
, targetPlatform
|
||||
, pkg-config
|
||||
, libiconv
|
||||
, rustfmt
|
||||
, cargo
|
||||
, rustc
|
||||
# , llvmPackages # Optional
|
||||
# , protobuf # Optional
|
||||
}:
|
||||
|
||||
let
|
||||
cargoToml = (builtins.fromTOML (builtins.readFile ./Cargo.toml));
|
||||
in
|
||||
|
||||
naersk.lib."${targetPlatform.system}".buildPackage rec {
|
||||
src = ./.;
|
||||
|
||||
buildInputs = [
|
||||
rustfmt
|
||||
pkg-config
|
||||
cargo
|
||||
rustc
|
||||
libiconv
|
||||
];
|
||||
checkInputs = [ cargo rustc ];
|
||||
|
||||
doCheck = true;
|
||||
CARGO_BUILD_INCREMENTAL = "false";
|
||||
RUST_BACKTRACE = "full";
|
||||
copyLibs = true;
|
||||
|
||||
# Optional things you might need:
|
||||
#
|
||||
# If you depend on `libclang`:
|
||||
# LIBCLANG_PATH = "${llvmPackages.libclang}/lib";
|
||||
#
|
||||
# If you depend on protobuf:
|
||||
# PROTOC = "${protobuf}/bin/protoc";
|
||||
# PROTOC_INCLUDE = "${protobuf}/include";
|
||||
|
||||
name = cargoToml.package.name;
|
||||
version = cargoToml.package.version;
|
||||
|
||||
meta = with lib; {
|
||||
description = cargoToml.package.description;
|
||||
homepage = cargoToml.package.homepage;
|
||||
license = with licenses; [ mit ];
|
||||
maintainers = with maintainers; [ ];
|
||||
};
|
||||
}
|
142
flake.lock
142
flake.lock
|
@ -1,48 +1,160 @@
|
|||
{
|
||||
"nodes": {
|
||||
"naersk": {
|
||||
"devshell": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1632266297,
|
||||
"narHash": "sha256-J1yeJk6Gud9ef2pEf6aKQemrfg1pVngYDSh+SAY94xk=",
|
||||
"owner": "nmattia",
|
||||
"repo": "naersk",
|
||||
"rev": "ee7edec50b49ab6d69b06d62f1de554efccb1ccd",
|
||||
"lastModified": 1660811669,
|
||||
"narHash": "sha256-V6lmsaLNFz41myppL0yxglta92ijkSvpZ+XVygAh+bU=",
|
||||
"owner": "numtide",
|
||||
"repo": "devshell",
|
||||
"rev": "c2feacb46ee69949124c835419861143c4016fb5",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nmattia",
|
||||
"owner": "numtide",
|
||||
"repo": "devshell",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"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": {
|
||||
"locked": {
|
||||
"lastModified": 1656928814,
|
||||
"narHash": "sha256-RIFfgBuKz6Hp89yRr7+NR5tzIAbn52h8vT6vXkYjZoM=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "7e2a3b3dfd9af950a856d66b0a7d01e3c18aa249",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"naersk": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1659610603,
|
||||
"narHash": "sha256-LYgASYSPYo7O71WfeUOaEUzYfzuXm8c8eavJcel+pfI=",
|
||||
"owner": "nix-community",
|
||||
"repo": "naersk",
|
||||
"rev": "c6a45e4277fa58abd524681466d3450f896dc094",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "naersk",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1641687203,
|
||||
"narHash": "sha256-W6Xrb/l1x+E+WMVLw4q5HUnNjt3x4WQFSYJtjJtopbU=",
|
||||
"lastModified": 1643381941,
|
||||
"narHash": "sha256-pHTwvnN4tTsEKkWlXQ8JMY423epos8wUOhthpwJjtpc=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "00acdb2aa817048fbe1f91ece18fe7de09762531",
|
||||
"rev": "5efc8ca954272c4376ac929f4c5ffefcc20551d5",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-21.11",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1661353537,
|
||||
"narHash": "sha256-1E2IGPajOsrkR49mM5h55OtYnU0dGyre6gl60NXKITE=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "0e304ff0d9db453a4b230e9386418fd974d5804a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"id": "nixpkgs",
|
||||
"type": "indirect"
|
||||
}
|
||||
},
|
||||
"nixpkgs_3": {
|
||||
"locked": {
|
||||
"lastModified": 1661353537,
|
||||
"narHash": "sha256-1E2IGPajOsrkR49mM5h55OtYnU0dGyre6gl60NXKITE=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "0e304ff0d9db453a4b230e9386418fd974d5804a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"id": "nixpkgs",
|
||||
"type": "indirect"
|
||||
}
|
||||
},
|
||||
"nixpkgs_4": {
|
||||
"locked": {
|
||||
"lastModified": 1659102345,
|
||||
"narHash": "sha256-Vbzlz254EMZvn28BhpN8JOi5EuKqnHZ3ujFYgFcSGvk=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "11b60e4f80d87794a2a4a8a256391b37c59a1ea7",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"devshell": "devshell",
|
||||
"naersk": "naersk",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"nixpkgs": "nixpkgs_3",
|
||||
"rust-overlay": "rust-overlay",
|
||||
"utils": "utils"
|
||||
}
|
||||
},
|
||||
"rust-overlay": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils_2",
|
||||
"nixpkgs": "nixpkgs_4"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1662001050,
|
||||
"narHash": "sha256-tduflWLNZ6C3Xz0eUHf5Cnnfl47Vgey2NUY5ZU9f/S4=",
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"rev": "6f27501ff78beb62728cb292daca846fcab96c9e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"utils": {
|
||||
"locked": {
|
||||
"lastModified": 1637014545,
|
||||
|
|
60
flake.nix
60
flake.nix
|
@ -1,27 +1,53 @@
|
|||
{
|
||||
description = "My cute Rust crate!";
|
||||
description = "ISO7010 Twitter bot";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-21.11";
|
||||
utils.url = "github:numtide/flake-utils";
|
||||
naersk.url = "github:nmattia/naersk";
|
||||
naersk.inputs.nixpkgs.follows = "nixpkgs";
|
||||
devshell.url = "github:numtide/devshell";
|
||||
naersk.url = "github:nix-community/naersk";
|
||||
rust-overlay.url = "github:oxalica/rust-overlay";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, utils, naersk }:
|
||||
let
|
||||
cargoToml = (builtins.fromTOML (builtins.readFile ./Cargo.toml));
|
||||
in
|
||||
outputs = {
|
||||
self,
|
||||
nixpkgs,
|
||||
utils,
|
||||
naersk,
|
||||
devshell,
|
||||
rust-overlay,
|
||||
}:
|
||||
utils.lib.eachDefaultSystem (system: let
|
||||
pkgs = nixpkgs.legacyPackages."${system}";
|
||||
naersk-lib = naersk.lib."${system}";
|
||||
in rec {
|
||||
packages."${cargoToml.package.name}" = naersk-lib.buildPackage {
|
||||
pname = "${cargoToml.package.name}";
|
||||
root = ./.;
|
||||
buildInputs = [ pkgs.openssl pkgs.pkgconfig ];
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
overlays = [(import rust-overlay)];
|
||||
};
|
||||
defaultPackage = packages."${cargoToml.package.name}";
|
||||
hydraJobs.build = defaultPackage;
|
||||
rust = pkgs.rust-bin.stable.latest.default;
|
||||
# Override naersk to use our chosen rust version from rust-overlay
|
||||
naersk-lib = naersk.lib.${system}.override {
|
||||
cargo = rust;
|
||||
rustc = rust;
|
||||
};
|
||||
in rec {
|
||||
packages.default = naersk-lib.buildPackage {
|
||||
pname = "iso7010-a-day";
|
||||
root = ./.;
|
||||
buildInputs = [pkgs.openssl pkgs.pkgconfig];
|
||||
};
|
||||
|
||||
apps.default = utils.lib.mkApp {drv = packages.default;};
|
||||
|
||||
hydraJobs.build = packages.default;
|
||||
|
||||
# Provide a dev env with rust and rls
|
||||
devShells.default = let
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
overlays = [devshell.overlay];
|
||||
};
|
||||
in
|
||||
pkgs.devshell.mkShell {
|
||||
packages = with pkgs; [(rust.override {extensions = ["rls"];})];
|
||||
};
|
||||
formatter = pkgs.alejandra;
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue