nurl/flake.nix

63 lines
1.6 KiB
Nix
Raw Normal View History

2022-12-30 18:23:21 +03:00
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
};
outputs = { self, nixpkgs }:
let
inherit (nixpkgs.lib)
2022-12-30 21:18:27 +03:00
genAttrs importTOML licenses makeBinPath maintainers;
2022-12-30 18:23:21 +03:00
inherit (importTOML (self + "/Cargo.toml")) package;
2022-12-30 21:18:27 +03:00
forEachSystem = genAttrs [
"aarch64-darwin"
"aarch64-linux"
"x86_64-darwin"
"x86_64-linux"
];
2022-12-30 18:23:21 +03:00
in
{
2022-12-30 21:18:27 +03:00
formatter = forEachSystem
2022-12-30 18:23:21 +03:00
(system: nixpkgs.legacyPackages.${system}.nixpkgs-fmt);
2022-12-30 21:18:27 +03:00
packages = forEachSystem (system:
let
inherit (nixpkgs.legacyPackages.${system})
2022-12-30 23:36:38 +03:00
gitMinimal installShellFiles makeWrapper mercurial nix rustPlatform;
2022-12-30 21:18:27 +03:00
in
{
default = rustPlatform.buildRustPackage {
pname = "nurl";
inherit (package) version;
src = self;
cargoLock.lockFile = self + "/Cargo.lock";
2022-12-30 23:36:38 +03:00
nativeBuildInputs = [
installShellFiles
makeWrapper
];
2022-12-30 21:18:27 +03:00
2023-01-03 22:16:29 +03:00
# tests require internet access
doCheck = false;
2022-12-30 21:18:27 +03:00
postInstall = ''
wrapProgram $out/bin/nurl \
--prefix PATH : ${makeBinPath [ gitMinimal mercurial nix ]}
2022-12-30 23:36:38 +03:00
installManPage artifacts/nurl.1
installShellCompletion artifacts/nurl.{bash,fish} --zsh artifacts/_nurl
2022-12-30 21:18:27 +03:00
'';
2022-12-30 23:36:38 +03:00
GEN_ARTIFACTS = "artifacts";
2022-12-30 21:18:27 +03:00
meta = {
inherit (package) description;
license = licenses.mpl20;
maintainers = with maintainers; [ figsoda ];
2022-12-30 18:23:21 +03:00
};
2022-12-30 21:18:27 +03:00
};
});
2022-12-30 18:23:21 +03:00
};
}