From cf942bc3c88e6d4482b6f99c1a31b5c13efe8e69 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 29 Jun 2024 17:36:24 +0200 Subject: initial commit --- .envrc | 9 +++++++++ default.nix | 28 ++++++++++++++++++++++++++++ justfile | 5 +++++ shell.nix | 7 +++++++ vanity-imports.toml | 17 +++++++++++++++++ 5 files changed, 66 insertions(+) create mode 100644 .envrc create mode 100644 default.nix create mode 100644 justfile create mode 100644 shell.nix create mode 100755 vanity-imports.toml diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..82b2b9e --- /dev/null +++ b/.envrc @@ -0,0 +1,9 @@ +#!/usr/bin/env bash +# the shebang is ignored, but nice for editors + +if type -P lorri &>/dev/null; then + eval "$(lorri direnv)" +else + echo 'while direnv evaluated .envrc, could not find the command "lorri" [https://github.com/nix-community/lorri]' + use nix +fi diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..4c20919 --- /dev/null +++ b/default.nix @@ -0,0 +1,28 @@ +{ lib +, buildGoModule +, fetchFromGitHub +}: + +buildGoModule rec { + pname = "vanity-imports"; + version = "0.0.12"; + + src = fetchFromGitHub { + owner = "mlcdf"; + repo = "vanity-imports"; + rev = "v${version}"; + hash = "sha256-4JoJL079hBkwWVvOTRbCM1WZhM7hPlKQ+HEAUr7fWP8="; + }; + + vendorHash = "sha256-w0LaXevbGm1xpHvKxxyubHCOVRN712UzLyOd+hVikKg="; + + ldflags = [ "-s" "-w" ]; + + meta = with lib; { + description = "Use a custom domain in your Go import path"; + homepage = "https://github.com/mlcdf/vanity-imports"; + license = licenses.mit; + maintainers = with maintainers; [ alanpearce ]; + mainProgram = "vanity-imports"; + }; +} diff --git a/justfile b/justfile new file mode 100644 index 0000000..37eeaaf --- /dev/null +++ b/justfile @@ -0,0 +1,5 @@ +#! /usr/bin/env cached-nix-shell +#! nix-shell -i "just --justfile" + +cd: + vanity-imports --config vanity-imports.toml diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..142eef8 --- /dev/null +++ b/shell.nix @@ -0,0 +1,7 @@ +{ pkgs ? import { } }: + +pkgs.mkShell { + buildInputs = [ + (pkgs.callPackage ./. { }) + ]; +} diff --git a/vanity-imports.toml b/vanity-imports.toml new file mode 100755 index 0000000..abaa87b --- /dev/null +++ b/vanity-imports.toml @@ -0,0 +1,17 @@ +domain = "go.alanpearce.eu" +output = "/srv/http/go/" + +[index] +description = "" +extra_head = "" +title = "Alan's go packages" + +[repos] + +[repos."/website"] +repo = "https://git.alanpearce.eu/website/" +vcs = "git" + +[repos."/searchix"] +repo = "https://git.alanpearce.eu/searchix/" +vcs = "git" -- cgit 1.4.1