diff --git a/.direnv/flake-profile b/.direnv/flake-profile index 519b17befac794908eb1dfd91afdc4564f3d4213..81fbd587cf07258979f9e2ee22c4cd2d74550f83 120000 --- a/.direnv/flake-profile +++ b/.direnv/flake-profile @@ -1 +1 @@ -flake-profile-3-link \ No newline at end of file +flake-profile-8-link \ No newline at end of file diff --git a/.direnv/flake-profile-4-link b/.direnv/flake-profile-4-link new file mode 120000 index 0000000000000000000000000000000000000000..58a3ce79a7ca2c9517e96156f49d279716c9b7fe --- /dev/null +++ b/.direnv/flake-profile-4-link @@ -0,0 +1 @@ +/nix/store/s78r1i6ai1in42ybid66ra73z8ndpypi-bob-env \ No newline at end of file diff --git a/.direnv/flake-profile-5-link b/.direnv/flake-profile-5-link new file mode 120000 index 0000000000000000000000000000000000000000..47fb33fdd5446ff0e5bf86a5d030216217c542c1 --- /dev/null +++ b/.direnv/flake-profile-5-link @@ -0,0 +1 @@ +/nix/store/48xnpf2slkjsf61k6wpvcrpsbdhqjfwj-bob-env \ No newline at end of file diff --git a/.direnv/flake-profile-6-link b/.direnv/flake-profile-6-link new file mode 120000 index 0000000000000000000000000000000000000000..31ab033c000d8e4d59a37f82273df75b1fd99794 --- /dev/null +++ b/.direnv/flake-profile-6-link @@ -0,0 +1 @@ +/nix/store/k2b7cyr7j68qzx94yz3jgwixdgsfr8kg-bob-env \ No newline at end of file diff --git a/.direnv/flake-profile-7-link b/.direnv/flake-profile-7-link new file mode 120000 index 0000000000000000000000000000000000000000..c48a801731f99599dd57eaccbfc2d8f4d66cd045 --- /dev/null +++ b/.direnv/flake-profile-7-link @@ -0,0 +1 @@ +/nix/store/yk163kyn90q9axhmgn6b17fy2h1cmgqx-bob-env \ No newline at end of file diff --git a/.direnv/flake-profile-8-link b/.direnv/flake-profile-8-link new file mode 120000 index 0000000000000000000000000000000000000000..aeb8fad8589a437cf73660e8caf74cabeee9f628 --- /dev/null +++ b/.direnv/flake-profile-8-link @@ -0,0 +1 @@ +/nix/store/h3gvv220m3mpjnfai4lhd8qvmifzm4l6-bob-env \ No newline at end of file diff --git a/flake.nix b/flake.nix index c92d89cfd75b020bcabd6d13c27600229c0be70f..28156d00683188da55a9f19d1f7079d6eba73adf 100644 --- a/flake.nix +++ b/flake.nix @@ -1,4 +1,3 @@ - { description = "Bob: The HTML and HTML fragment builder"; @@ -6,6 +5,10 @@ outputs = { self, nixpkgs }: let + rootPath = ./.; + releaseJson = builtins.fromJSON (builtins.readFile "${rootPath}/release.json"); + currentVersion = releaseJson.version; + systems = [ "x86_64-linux" "aarch64-linux" ]; forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f system); makePackage = system: @@ -19,17 +22,29 @@ bob = final.buildGoModule { name = "bob"; src = ././application/source; - vendorSha256 = null; # Use "nix to-sri --type sha256" on the actual hash + vendorSha256 = "sha256-qiObIbA75kfkGzZoTtZbkm4zQqXokL+hiWrJdmL8oxU="; # Use "nix to-sri --type sha256" on the actual hash doCheck = false; + nativeBuildInputs = [ final.jq ]; + +# preBuild = '' +# jq -r '.version' ${rootPath}/release.json > $TMPDIR/version +# ''; - buildFlagsArray = [ - "-ldflags=-X main.Version=${self.lastModifiedDate}" - ]; + buildPhase = '' + buildFlagsArray=( + "-ldflags=-X main.version=${currentVersion} -X main.build=${self.lastModifiedDate}" + ) + buildPhase + ''; }; }; defaultPackage = forAllSystems makePackage; + packages = forAllSystems (system: { + bob = makePackage system; + }); + checks = { test = forAllSystems makePackage; }; diff --git a/result b/result new file mode 120000 index 0000000000000000000000000000000000000000..607519d58851e6a4ca396740d4dbee1cb94debbf --- /dev/null +++ b/result @@ -0,0 +1 @@ +/nix/store/nzn16jnc6wgd2p9bwrczn8wl4vysg7y8-bob \ No newline at end of file