commit c83861fde903c5829599edac78124c7f0f798ed8 Author: Moritz Böhme Date: Fri Dec 30 19:43:37 2022 +0100 init diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..5aeccd0 --- /dev/null +++ b/flake.lock @@ -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 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..37f4d35 --- /dev/null +++ b/flake.nix @@ -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; + }); + }; +} diff --git a/packages/cook-docs.nix b/packages/cook-docs.nix new file mode 100644 index 0000000..5cea4ba --- /dev/null +++ b/packages/cook-docs.nix @@ -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" ]; + }; +} diff --git a/packages/cookcli.nix b/packages/cookcli.nix new file mode 100644 index 0000000..879667f --- /dev/null +++ b/packages/cookcli.nix @@ -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"; + }; +})