main
Moritz Böhme 2022-12-30 19:43:37 +01:00
commit c83861fde9
Signed by: moritz
GPG Key ID: 970C6E89EB0547A9
4 changed files with 114 additions and 0 deletions

24
flake.lock Normal file
View File

@ -0,0 +1,24 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1672057183,
"narHash": "sha256-GN7/10DNNvs1FPj9tlZA2qgNdFuYKKuS3qlHTqAxasQ=",
"path": "/nix/store/lr5ag2idiw8p5dn97khn84h0qxd3l0xy-source",
"rev": "b139e44d78c36c69bcbb825b20dbfa51e7738347",
"type": "path"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

37
flake.nix Normal file
View File

@ -0,0 +1,37 @@
{
description = "Cooklang tools";
outputs = { self, nixpkgs }:
let
supportedSystems = [ "x86_64-linux" ];
pkgsFor = system: import nixpkgs { inherit system; };
perSystem = nixpkgs.lib.genAttrs supportedSystems;
mkApp =
{ drv
, name ? drv.pname or drv.name
, exePath ? drv.meta.mainProgram or "bin/${name}"
}: {
type = "app";
program = "${drv}/${exePath}";
};
in
{
packages = perSystem (system:
let
pkgs = pkgsFor system;
in
rec {
cookcli = pkgs.callPackage ./packages/cookcli.nix { };
cook-docs = pkgs.callPackage ./packages/cook-docs.nix { };
default = cookcli;
});
apps = perSystem (system: rec {
cookcli = mkApp {
drv = self.packages.${system}.cookcli;
exePath = "/bin/cook";
};
cook-docs = mkApp { drv = self.packages.${system}.cook-docs; };
default = cookcli;
});
};
}

27
packages/cook-docs.nix Normal file
View File

@ -0,0 +1,27 @@
{ lib, buildGoModule, fetchFromGitHub, git }:
buildGoModule rec {
pname = "cook-docs";
version = "0.7.0";
src = fetchFromGitHub {
owner = "nicholaswilde";
repo = pname;
rev = "v${version}";
sha256 = "sha256-5wK8juYdr9S8Ugck5dfjHZXD8NYkYawsF3mCqzfbv/o=";
};
nativeBuildInputs = [ git ];
doCheck = false;
vendorHash = null;
meta = with lib; {
description = "A tool for automatically generating markdown documentation for cooklang recipes";
license = licenses.mit;
maintainers = with maintainers; [ MoritzBoehme ];
homepage = "https://github.com/nicholaswilde/cook-docs";
platforms = [ "x86_64-linux" ];
};
}

26
packages/cookcli.nix Normal file
View File

@ -0,0 +1,26 @@
{ lib, stdenv, fetchzip, swift, zlib }:
stdenv.mkDerivation (finalAttrs: {
pname = "cookcli";
version = "0.1.6";
src = fetchzip {
url = "https://github.com/cooklang/CookCLI/releases/download/v${finalAttrs.version}/CookCLI_${finalAttrs.version}_linux_amd64.zip";
sha256 = "sha256-8UBQ0OBVe6NC7E+3AKsNTNnESeyxgrlANOj9bMxCf6s=";
};
installPhase = ''
mkdir -p $out/bin
cp cook $out/bin/cook
chmod +x $out/bin/cook
'';
meta = with lib; {
description = "command line program which provides a suite of tools to create shopping lists and maintain recipes";
license = licenses.mit;
maintainers = with maintainers; [ MoritzBoehme ];
homepage = "https://github.com/cooklang/CookCLI";
platforms = with platforms; [ "x86_64-linux" ];
mainProgram = "cook";
};
})