From 7b8c1247bb7bc8f40c7ad3b11f4f4fe123be3570 Mon Sep 17 00:00:00 2001 From: Hamcha Date: Sat, 30 Mar 2024 22:00:26 +0100 Subject: [PATCH] build: I'm following GPT4 advice here, brace for hallucination bingo --- flake.lock | 99 ++++-------------------------------------------------- flake.nix | 20 +++++++++-- 2 files changed, 25 insertions(+), 94 deletions(-) diff --git a/flake.lock b/flake.lock index 9557dad..6673c16 100644 --- a/flake.lock +++ b/flake.lock @@ -1,21 +1,5 @@ { "nodes": { - "flake-compat": { - "flake": false, - "locked": { - "lastModified": 1673956053, - "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", - "owner": "edolstra", - "repo": "flake-compat", - "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", - "type": "github" - }, - "original": { - "owner": "edolstra", - "repo": "flake-compat", - "type": "github" - } - }, "flake-parts": { "inputs": { "nixpkgs-lib": "nixpkgs-lib" @@ -52,56 +36,18 @@ "type": "github" } }, - "libgit2": { - "flake": false, - "locked": { - "lastModified": 1697646580, - "narHash": "sha256-oX4Z3S9WtJlwvj0uH9HlYcWv+x1hqp8mhXl7HsLu2f0=", - "owner": "libgit2", - "repo": "libgit2", - "rev": "45fd9ed7ae1a9b74b957ef4f337bc3c8b3df01b5", - "type": "github" - }, - "original": { - "owner": "libgit2", - "repo": "libgit2", - "type": "github" - } - }, - "nix": { - "inputs": { - "flake-compat": "flake-compat", - "libgit2": "libgit2", - "nixpkgs": "nixpkgs", - "nixpkgs-regression": "nixpkgs-regression" - }, - "locked": { - "lastModified": 1711812209, - "narHash": "sha256-3uijtGKH6tvQtXIhWzGojSVnoYvc0daAGA4LD0lV+Pc=", - "owner": "NixOS", - "repo": "nix", - "rev": "9b88e5284608116b7db0dbd3d5dd7a33b90d52d7", - "type": "github" - }, - "original": { - "id": "nix", - "type": "indirect" - } - }, "nixpkgs": { "locked": { - "lastModified": 1709083642, - "narHash": "sha256-7kkJQd4rZ+vFrzWu8sTRtta5D1kBG0LSRYAfhtmMlSo=", + "lastModified": 1701040486, + "narHash": "sha256-vawYwoHA5CwvjfqaT3A5CT9V36Eq43gxdwpux32Qkjw=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "b550fe4b4776908ac2a861124307045f8e717c8e", + "rev": "45827faa2132b8eade424f6bdd48d8828754341a", "type": "github" }, "original": { - "owner": "NixOS", - "ref": "release-23.11", - "repo": "nixpkgs", - "type": "github" + "id": "nixpkgs", + "type": "indirect" } }, "nixpkgs-lib": { @@ -122,37 +68,7 @@ "type": "github" } }, - "nixpkgs-regression": { - "locked": { - "lastModified": 1643052045, - "narHash": "sha256-uGJ0VXIhWKGXxkeNnq4TvV3CIOkUJ3PAoLZ3HMzNVMw=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", - "type": "github" - }, - "original": { - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", - "type": "github" - } - }, "nixpkgs_2": { - "locked": { - "lastModified": 1701040486, - "narHash": "sha256-vawYwoHA5CwvjfqaT3A5CT9V36Eq43gxdwpux32Qkjw=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "45827faa2132b8eade424f6bdd48d8828754341a", - "type": "github" - }, - "original": { - "id": "nixpkgs", - "type": "indirect" - } - }, - "nixpkgs_3": { "locked": { "lastModified": 1681358109, "narHash": "sha256-eKyxW4OohHQx9Urxi7TQlFBTDWII+F+x2hklDOQPB50=", @@ -171,8 +87,7 @@ "root": { "inputs": { "flake-parts": "flake-parts", - "nix": "nix", - "nixpkgs": "nixpkgs_2", + "nixpkgs": "nixpkgs", "rust-crate2nix": "rust-crate2nix", "rust-overlay": "rust-overlay" } @@ -196,7 +111,7 @@ "rust-overlay": { "inputs": { "flake-utils": "flake-utils", - "nixpkgs": "nixpkgs_3" + "nixpkgs": "nixpkgs_2" }, "locked": { "lastModified": 1701137803, diff --git a/flake.nix b/flake.nix index 1a3d4c3..1fa854c 100644 --- a/flake.nix +++ b/flake.nix @@ -13,7 +13,6 @@ outputs = inputs @ { self , nixpkgs - , nix , flake-parts , rust-overlay , rust-crate2nix @@ -51,10 +50,25 @@ { inherit pkgs; }; + + # Package with runtime dependencies and environment variable + wrappedPackage = pkgs.stdenv.mkDerivation { + name = "staxman"; + buildInputs = [ pkgs.arion pkgs.docker-client pkgs.nix pkgs.makeWrapper ]; + + phases = [ "installPhase" ]; + installPhase = '' + mkdir -p $out/bin + cp ${project.rootCrate.build}/bin/* $out/bin + wrapProgram $out/bin/staxman \ + --set STAX_ARION_BIN "${pkgs.arion}/bin/arion" \ + --prefix PATH : ${pkgs.lib.makeBinPath [ pkgs.arion pkgs.docker-client pkgs.nix ]} + ''; + }; in rec { packages = { - staxman = project.rootCrate.build; + staxman = wrappedPackage; default = packages.staxman; }; @@ -63,6 +77,8 @@ rustc cargo-watch clang + arion + docker-client ]; }; };