diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..ea91da7 --- /dev/null +++ b/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1776548001, + "narHash": "sha256-ZSK0NL4a1BwVbbTBoSnWgbJy9HeZFXLYQizjb2DPF24=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "b12141ef619e0a9c1c84dc8c684040326f27cdcc", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..2f80b5d --- /dev/null +++ b/flake.nix @@ -0,0 +1,73 @@ +{ + description = "pear — strip any recipe URL down to what matters"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + }; + + outputs = + { + self, + nixpkgs, + }: + let + systems = [ + "x86_64-linux" + "aarch64-linux" + "aarch64-darwin" + "x86_64-darwin" + ]; + forAllSystems = nixpkgs.lib.genAttrs systems; + in + { + packages = forAllSystems (system: { + default = + let + pkgs = nixpkgs.legacyPackages.${system}; + in + pkgs.buildGoModule { + pname = "pear"; + version = "0.1.0"; + + src = ./.; + + vendorHash = "sha256-qnvBWpHLZZq0R8QEhDJeclVlHEbnru6v2RkPnKIGMAY="; + + ldflags = [ + "-X main.gitHash=${self.shortRev or self.dirtyShortRev or "dev"}" + ]; + + meta = with pkgs.lib; { + description = "Nice recipes — strip any recipe URL down to what matters"; + homepage = "https://pear.dunkirk.sh"; + license = licenses.mit; + platforms = platforms.unix; + }; + }; + }); + + apps = forAllSystems (system: { + default = { + type = "app"; + program = "${self.packages.${system}.default}/bin/pear"; + }; + }); + + devShells = forAllSystems (system: { + default = + let + pkgs = nixpkgs.legacyPackages.${system}; + in + pkgs.mkShell { + packages = with pkgs; [ + go + sqlite + ]; + + shellHook = '' + export DATABASE_URL="pear.db" + ''; + }; + }); + }; +} \ No newline at end of file diff --git a/go.mod b/go.mod index 0b09a34..791f4f6 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module tangled.org/dunkirk.sh/pear -go 1.26.2 +go 1.26 require ( github.com/aquilax/cooklang-go v0.2.0