Skip to content

Commit

Permalink
Sync package with nixpkgs'
Browse files Browse the repository at this point in the history
Closes #69
  • Loading branch information
viperML committed Feb 19, 2024
1 parent 36eba28 commit 7db2d78
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 19 deletions.
6 changes: 3 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,15 @@
] (system: function nixpkgs.legacyPackages.${system});
in {
overlays.default = final: prev: {
nh = final.callPackage ./package.nix {};
nh = final.callPackage ./package.nix {
rev = self.dirtyShortRev;
};
};

packages = forAllSystems (pkgs: rec {
nh = pkgs.callPackage ./package.nix {};
nh = pkgs.callPackage ./package.nix {
rev = self.dirtyShortRev;
};
default = nh;
});

Expand Down
39 changes: 25 additions & 14 deletions package.nix
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
{
stdenv,
lib,
rustPlatform,
installShellFiles,
makeWrapper,
lib,
makeBinaryWrapper,
darwin,
nvd,
use-nom ? true,
nix-output-monitor,
buildType ? "release",
}: let
nix-output-monitor ? null,
rev ? "dirty",
}:
assert use-nom -> nix-output-monitor != null; let
runtimeDeps = [nvd] ++ lib.optionals use-nom [nix-output-monitor];
cargoToml = builtins.fromTOML (builtins.readFile ./Cargo.toml);
propagatedBuildInputs = [nvd] ++ lib.optionals use-nom [nix-output-monitor];
in
rustPlatform.buildRustPackage {
inherit propagatedBuildInputs buildType;
pname = cargoToml.package.name;
inherit (cargoToml.package) version;
cargoLock.lockFile = ./Cargo.lock;
pname = "nh";
version = "${cargoToml.package.version}-${rev}";

src = lib.fileset.toSource {
root = ./.;
Expand All @@ -29,11 +30,15 @@ in
]);
};

strictDeps = true;

nativeBuildInputs = [
installShellFiles
makeWrapper
makeBinaryWrapper
];

buildInputs = lib.optionals stdenv.isDarwin [darwin.apple_sdk.frameworks.SystemConfiguration];

preFixup = ''
mkdir completions
$out/bin/nh completions --shell bash > completions/nh.bash
Expand All @@ -45,11 +50,17 @@ in

postFixup = ''
wrapProgram $out/bin/nh \
--prefix PATH : ${lib.makeBinPath propagatedBuildInputs} \
--prefix PATH : ${lib.makeBinPath runtimeDeps} \
${lib.optionalString use-nom "--set-default NH_NOM 1"}
'';

meta.mainProgram = "nh";
cargoLock.lockFile = ./Cargo.lock;

strictDeps = true;
meta = {
description = "Yet another nix cli helper";
homepage = "https://github.com/viperML/nh";
license = lib.licenses.eupl12;
mainProgram = "nh";
maintainers = with lib.maintainers; [drupol viperML];
};
}

0 comments on commit 7db2d78

Please sign in to comment.