Skip to content
Snippets Groups Projects
Verified Commit 736ca64b authored by Volker Schukai's avatar Volker Schukai :alien:
Browse files

chore: packaging

parent 0d4cd39b
Branches
Tags
No related merge requests found
{ {
"nodes": { "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": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1688679045, "lastModified": 1688679045,
...@@ -25,50 +10,14 @@ ...@@ -25,50 +10,14 @@
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "NixOS", "id": "nixpkgs",
"ref": "nixos-unstable", "ref": "nixos-unstable",
"repo": "nixpkgs", "type": "indirect"
"type": "github"
} }
}, },
"root": { "root": {
"inputs": { "inputs": {
"nix-filter": "nix-filter", "nixpkgs": "nixpkgs"
"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"
} }
} }
}, },
......
{ {
description = "Bob: The HTML and HTML fragment builder"; 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;
};
# Nixpkgs / NixOS version to use.
inputs.nixpkgs.url = "nixpkgs/nixos-unstable";
outputs = {self, nixpkgs, utils, nix-filter }: outputs = { self, nixpkgs }:
let let
# to work with older version of flakes # to work with older version of flakes
lastModifiedDate = self.lastModifiedDate or self.lastModified or "19700101"; 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. # System types to support.
supportedSystems = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ]; supportedSystems = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ];
...@@ -21,14 +28,21 @@ ...@@ -21,14 +28,21 @@
# Nixpkgs instantiated for supported system types. # Nixpkgs instantiated for supported system types.
nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; }); 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 'nix develop', we don't need a copy of the source tree
# in the Nix store. # in the Nix store.
src = ././application/source; src = ././application/source;
...@@ -41,10 +55,10 @@ ...@@ -41,10 +55,10 @@
# it should be "out-of-band" with other tooling (eg. gomod2nix). # it should be "out-of-band" with other tooling (eg. gomod2nix).
# To begin with it is recommended to set this, but one must # To begin with it is recommended to set this, but one must
# remeber to bump this hash when your dependencies change. # remeber to bump this hash when your dependencies change.
#vendorSha256 = nixpkgs.legacyPackages.${system}.lib.fakeSha256; #vendorSha256 = pkgs.lib.fakeSha256;
vendorSha256 = "sha256-XdB+u94Rqsb29jVs4miyOq1NEYaVJHWFXg6QebFJzNQ="; vendorSha256 = "sha256-XdB+u94Rqsb29jVs4miyOq1NEYaVJHWFXg6QebFJzNQ=";
doCheck = false;
meta = with nixpkgs.legacyPackages.${system}.lib; { meta = with nixpkgs.legacyPackages.${system}.lib; {
description = "Bob: The HTML and HTML fragment builder"; description = "Bob: The HTML and HTML fragment builder";
...@@ -53,8 +67,23 @@ ...@@ -53,8 +67,23 @@
maintainers = with maintainers; [ "schukai GmbH" ]; maintainers = with maintainers; [ "schukai GmbH" ];
}; };
};
});
# 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);
}; };
defaultPackage = packages.app;
}));
} }
{"version":"0.6.1"} {"version":"0.6.2"}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment