nix: add overlays, packages, apps
This commit is contained in:
parent
c1688a424c
commit
9a491acf37
1 changed files with 33 additions and 0 deletions
33
flake.nix
33
flake.nix
|
@ -11,12 +11,45 @@
|
||||||
, flake-utils
|
, flake-utils
|
||||||
, rust-overlay
|
, rust-overlay
|
||||||
}:
|
}:
|
||||||
|
let
|
||||||
|
inherit (builtins) fromTOML readFile substring;
|
||||||
|
|
||||||
|
cargoToml = fromTOML (readFile ./Cargo.toml);
|
||||||
|
version = "${cargoToml.package.version}+${substring 0 8 self.lastModifiedDate}_${self.shortRev or "dirty"}";
|
||||||
|
|
||||||
|
mkFimt = { lib, rustPlatform, ... }:
|
||||||
|
rustPlatform.buildRustPackage {
|
||||||
|
pname = cargoToml.package.name;
|
||||||
|
inherit version;
|
||||||
|
|
||||||
|
src = lib.cleanSource ./.;
|
||||||
|
cargoLock.lockFile = ./Cargo.lock;
|
||||||
|
|
||||||
|
doCheck = true;
|
||||||
|
};
|
||||||
|
in
|
||||||
|
{
|
||||||
|
overlays.fimt = final: prev: {
|
||||||
|
fimt = prev.callPackage mkFimt;
|
||||||
|
};
|
||||||
|
overlays.default = self.overlays.fimt;
|
||||||
|
}
|
||||||
|
//
|
||||||
flake-utils.lib.eachDefaultSystem (system:
|
flake-utils.lib.eachDefaultSystem (system:
|
||||||
let
|
let
|
||||||
overlays = [ (import rust-overlay) ];
|
overlays = [ (import rust-overlay) ];
|
||||||
pkgs = import nixpkgs { inherit system overlays; };
|
pkgs = import nixpkgs { inherit system overlays; };
|
||||||
|
fimt = pkgs.callPackage mkFimt { };
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
packages = {
|
||||||
|
inherit fimt;
|
||||||
|
default = fimt;
|
||||||
|
};
|
||||||
|
apps = let fimtApp = flake-utils.lib.mkApp { drv = fimt; }; in {
|
||||||
|
fimt = fimtApp;
|
||||||
|
default = fimtApp;
|
||||||
|
};
|
||||||
devShell = pkgs.mkShell {
|
devShell = pkgs.mkShell {
|
||||||
nativeBuildInputs = [ ];
|
nativeBuildInputs = [ ];
|
||||||
buildInputs = [
|
buildInputs = [
|
||||||
|
|
Loading…
Reference in a new issue