summaryrefslogtreecommitdiff
path: root/nix
diff options
context:
space:
mode:
Diffstat (limited to 'nix')
-rw-r--r--nix/package.nix64
1 files changed, 64 insertions, 0 deletions
diff --git a/nix/package.nix b/nix/package.nix
new file mode 100644
index 0000000..cc60573
--- /dev/null
+++ b/nix/package.nix
@@ -0,0 +1,64 @@
+{
+ lib,
+ installShellFiles,
+ makeBinaryWrapper,
+ nix,
+ rustPlatform,
+ versionCheckHook,
+}:
+
+let
+ fs = lib.fileset;
+in
+rustPlatform.buildRustPackage rec {
+ pname = "nix-forecast";
+ inherit (passthru.cargoTOML.package) version;
+
+ src = fs.toSource {
+ root = ../.;
+ fileset = fs.intersection (fs.gitTracked ../.) (
+ fs.unions [
+ ../Cargo.lock
+ ../Cargo.toml
+ ../build.rs
+ ../src
+ ]
+ );
+ };
+
+ cargoLock.lockFile = ../Cargo.lock;
+
+ nativeBuildInputs = [
+ installShellFiles
+ makeBinaryWrapper
+ ];
+
+ doInstallCheck = true;
+ nativeInstallCheckInputs = [ versionCheckHook ];
+
+ postInstall = ''
+ wrapProgram $out/bin/nix-forecast --suffix PATH : ${lib.makeBinPath [ nix ]}
+
+ installShellCompletion --cmd nix-forecast \
+ --bash completions/nix-forecast.bash \
+ --fish completions/nix-forecast.fish \
+ --zsh completions/_nix-forecast
+ '';
+
+ env = {
+ COMPLETION_DIR = "completions";
+ };
+
+ passthru = {
+ cargoTOML = lib.importTOML ../Cargo.toml;
+ };
+
+ meta = {
+ description = "Check the forecast for today's Nix builds";
+ homepage = "https://github.com/getchoo/nix-forecast";
+ changelog = "https://github.com/getchoo/nix-forecast/releases/tag/${version}";
+ license = lib.licenses.mpl20;
+ maintainers = with lib.maintainers; [ getchoo ];
+ mainProgram = "nix-forecast";
+ };
+}