diff --git a/flake.lock b/flake.lock index a3dbd4eb0cdbda8d9b933aad6f9d3b5a3fa57f00..cdd03702251fd550f35714977043f1e925b175b1 100644 --- a/flake.lock +++ b/flake.lock @@ -1,20 +1,5 @@ { "nodes": { - "nix-filter": { - "locked": { - "lastModified": 1687178632, - "narHash": "sha256-HS7YR5erss0JCaUijPeyg2XrisEb959FIct3n2TMGbE=", - "owner": "numtide", - "repo": "nix-filter", - "rev": "d90c75e8319d0dd9be67d933d8eb9d0894ec9174", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "nix-filter", - "type": "github" - } - }, "nixpkgs": { "locked": { "lastModified": 1688679045, @@ -25,50 +10,14 @@ "type": "github" }, "original": { - "owner": "NixOS", + "id": "nixpkgs", "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" + "type": "indirect" } }, "root": { "inputs": { - "nix-filter": "nix-filter", - "nixpkgs": "nixpkgs", - "utils": "utils" - } - }, - "systems": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } - }, - "utils": { - "inputs": { - "systems": "systems" - }, - "locked": { - "lastModified": 1687709756, - "narHash": "sha256-Y5wKlQSkgEK2weWdOu4J3riRd+kV/VCgHsqLNTTWQ/0=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "dbabf0ca0c0c4bce6ea5eaf65af5cb694d2082c7", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" + "nixpkgs": "nixpkgs" } } }, diff --git a/flake.nix b/flake.nix index fbc80187ab5021fea02ea3875af4402f7013031e..8a9d2a0f7214f7b3369442f0be5ed464cb306037 100644 --- a/flake.nix +++ b/flake.nix @@ -1,17 +1,24 @@ { - description = "Bob: The HTML and HTML fragment builder"; - inputs = { - nixpkgs.url = github:NixOS/nixpkgs/nixos-unstable; - utils.url = github:numtide/flake-utils; - nix-filter.url = github:numtide/nix-filter; - }; + description = "Bob: The HTML and HTML fragment builder"; + # Nixpkgs / NixOS version to use. + inputs.nixpkgs.url = "nixpkgs/nixos-unstable"; + outputs = { self, nixpkgs }: + let - outputs = {self, nixpkgs, utils, nix-filter }: - let - # to work with older version of flakes + # to work with older version of flakes lastModifiedDate = self.lastModifiedDate or self.lastModified or "19700101"; + + # Generate a user-friendly version number. + #version = builtins.substring 0 8 lastModifiedDate; + + + rootPath = ./.; + releaseJson = builtins.fromJSON (builtins.readFile "${rootPath}/release.json"); + version = releaseJson.version; + + # System types to support. supportedSystems = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ]; @@ -20,15 +27,22 @@ # Nixpkgs instantiated for supported system types. nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; }); - - rootPath = ./.; - releaseJson = builtins.fromJSON (builtins.readFile "${rootPath}/release.json"); - currentVersion = releaseJson.version; - in (utils.lib.eachDefaultSystem (system: rec { - packages.app = nixpkgs.legacyPackages.${system}.buildGoModule { - pname = "bob"; - version = currentVersion; + + + + in + { + + # Provide some binary packages for selected system types. + packages = forAllSystems (system: + let + pkgs = nixpkgsFor.${system}; + in + { + bob = pkgs.buildGoModule { + pname = "bob"; + inherit version; # In 'nix develop', we don't need a copy of the source tree # in the Nix store. src = ././application/source; @@ -41,20 +55,35 @@ # it should be "out-of-band" with other tooling (eg. gomod2nix). # To begin with it is recommended to set this, but one must # remeber to bump this hash when your dependencies change. - #vendorSha256 = nixpkgs.legacyPackages.${system}.lib.fakeSha256; + #vendorSha256 = pkgs.lib.fakeSha256; + vendorSha256 = "sha256-XdB+u94Rqsb29jVs4miyOq1NEYaVJHWFXg6QebFJzNQ="; - doCheck = false; - + meta = with nixpkgs.legacyPackages.${system}.lib; { description = "Bob: The HTML and HTML fragment builder"; homepage = "https://gitlab.schukai.com/oss/bob"; license = licenses.mit; maintainers = with maintainers; [ "schukai GmbH" ]; - }; - - + }; + }; - defaultPackage = packages.app; - })); + }); + + # Add dependencies that are only needed for development + devShells = forAllSystems (system: + let + pkgs = nixpkgsFor.${system}; + in + { + default = pkgs.mkShell { + buildInputs = with pkgs; [ go gopls gotools go-tools ]; + }; + }); + + # The default package for 'nix build'. This makes sense if the + # flake provides only one package or there is a clear "main" + # package. + defaultPackage = forAllSystems (system: self.packages.${system}.bob); + }; } diff --git a/release.json b/release.json index ae5df1d931c34af0129fc40f78fe2672fdbcb232..c4db434202b17605b14f0b02daf95a1296b0cdba 100644 --- a/release.json +++ b/release.json @@ -1 +1 @@ -{"version":"0.6.1"} +{"version":"0.6.2"}