2022-02-17 10:06:02 +03:00
|
|
|
{
|
2022-04-17 22:36:31 +03:00
|
|
|
description = "runs programs without installing them";
|
2022-02-17 10:06:02 +03:00
|
|
|
|
|
|
|
inputs = {
|
2022-04-17 22:36:31 +03:00
|
|
|
naersk = {
|
|
|
|
url = "github:nix-community/naersk/master";
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
};
|
|
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
|
|
|
utils.url = "github:numtide/flake-utils";
|
|
|
|
flake-compat = {
|
2022-04-19 13:51:07 +03:00
|
|
|
url = "github:edolstra/flake-compat";
|
2022-04-17 22:36:31 +03:00
|
|
|
flake = false;
|
|
|
|
};
|
2022-02-17 10:06:02 +03:00
|
|
|
};
|
|
|
|
|
2022-04-17 22:36:31 +03:00
|
|
|
outputs = { self, nixpkgs, utils, naersk, flake-compat }:
|
2022-06-06 16:37:20 +03:00
|
|
|
let
|
|
|
|
inherit (nixpkgs) lib;
|
|
|
|
commaLambda = pkgs:
|
|
|
|
let
|
|
|
|
naersk-lib = pkgs.callPackage naersk { };
|
|
|
|
in
|
|
|
|
naersk-lib.buildPackage {
|
|
|
|
pname = "comma";
|
|
|
|
root = ./.;
|
|
|
|
nativeBuildInputs = with pkgs; [ makeWrapper ];
|
|
|
|
overrideMain = _: {
|
|
|
|
postInstall = ''
|
|
|
|
wrapProgram $out/bin/comma \
|
|
|
|
--prefix PATH : ${lib.makeBinPath (with pkgs; [ nix fzy nix-index-unwrapped ])}
|
|
|
|
ln -s $out/bin/comma $out/bin/,
|
|
|
|
'';
|
2022-04-17 22:36:31 +03:00
|
|
|
};
|
2023-12-27 19:51:29 +03:00
|
|
|
checkInputs = [ pkgs.rustPackages.clippy ];
|
|
|
|
doCheck = true;
|
|
|
|
cargoTestCommands = x:
|
|
|
|
x ++ [
|
|
|
|
''cargo clippy --all --all-features --tests -- \
|
|
|
|
-D warnings || true''
|
|
|
|
];
|
2022-02-17 10:06:02 +03:00
|
|
|
};
|
2022-06-06 16:37:20 +03:00
|
|
|
in
|
|
|
|
utils.lib.eachDefaultSystem
|
|
|
|
(system:
|
|
|
|
let
|
|
|
|
pkgs = nixpkgs.legacyPackages.${system};
|
|
|
|
in
|
|
|
|
{
|
|
|
|
packages = {
|
|
|
|
default = self.packages."${system}".comma;
|
|
|
|
comma = commaLambda pkgs;
|
|
|
|
};
|
2022-02-17 10:06:02 +03:00
|
|
|
|
2022-06-06 16:37:20 +03:00
|
|
|
apps.default = utils.lib.mkApp {
|
|
|
|
drv = self.packages."${system}".default;
|
|
|
|
};
|
2022-02-17 10:06:02 +03:00
|
|
|
|
2022-06-06 16:37:20 +03:00
|
|
|
devShells.default = with pkgs; mkShell {
|
2023-04-06 01:15:12 +03:00
|
|
|
nativeBuildInputs = [ cargo cargo-edit nix-index rustc rustfmt rustPackages.clippy fzy ];
|
2022-06-06 16:37:20 +03:00
|
|
|
RUST_SRC_PATH = rustPlatform.rustLibSrc;
|
|
|
|
};
|
|
|
|
})
|
|
|
|
// {
|
|
|
|
overlays.default = (final: prev: {
|
|
|
|
comma = commaLambda prev;
|
2022-04-17 22:36:31 +03:00
|
|
|
});
|
2022-06-06 16:37:20 +03:00
|
|
|
};
|
2022-02-17 10:06:02 +03:00
|
|
|
}
|