diff --git a/.travis.yml b/.travis.yml index dcb2743..1c5fbf9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,25 +1,16 @@ -dist: focal -language: go -go: - - 1.13 +language: nix -before_install: - - sudo apt-get update - - sudo apt-get install git jq wget graphviz - - wget "https://github.com/gohugoio/hugo/releases/download/v${HUGO_RELEASE}/hugo_extended_${HUGO_RELEASE}_Linux-64bit.deb" - - sudo dpkg -i *.deb - - sudo gem install asciidoctor asciidoctor-diagram - - go version +before_script: + - sudo mkdir -p /etc/nix && echo 'sandbox = true' | sudo tee /etc/nix/nix.conf script: - - git clone https://git.sr.ht/~sircmpwn/openring && cd openring && go build && cd ../ - - chmod +x ./bin/openring-create && ./bin/openring-create + - nix-shell --pure ./shell.nix --run "./bin/openring-create" + - nix-env -i hugo go asciidoctor - hugo env: global: - PRODUCTION=true - - HUGO_RELEASE=0.76.0 deploy: local_dir: "./public/" diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..ea7724e --- /dev/null +++ b/shell.nix @@ -0,0 +1,53 @@ +let + # See https://nixos.wiki/wiki/FAQ/Pinning_Nixpkgs for more information on pinning + nixpkgs = builtins.fetchTarball { + # Descriptive name to make the store path easier to identify + name = "nixpkgs-unstable-2020-11-07"; + # Commit hash for nixos-unstable as of 2019-02-26 + url = https://github.com/NixOS/nixpkgs/archive/c54c614000644ecf9b8f8e9c873cfa91d1c05bf1.tar.gz; + # Hash obtained using `nix-prefetch-url --unpack ` + sha256 = "19xmsj1dhq25arhsfx0sl3r1y0zgpzfwhybc5dsxr1szh71wz3xs"; + }; +in +{ pkgs ? import {} }: + +with pkgs; + +let + openring = buildGoModule rec { + pname = "openring"; + version = "af9038b5"; + + src = fetchgit { + url = "https://git.sr.ht/~sircmpwn/openring"; + rev = "af9038b5bbf8d0bac9f401ccab263990df900dab"; + sha256 = "1r8vnqbsrjrafva12v5cbv4229qsx7z5lp19zhqzky9chais4c9k"; + }; + + vendorSha256 = "sha256-BbBTmkGyLrIWphXC+dBaHaVzHuXRZ+4N/Jt2k3nF7Z4="; + + subPackages = [ "." ]; + + meta = with stdenv.lib; { + description = "Tool for generating a webring from a list of RSS feeds."; + homepage = "https://git.sr.ht/~sircmpwn/openring"; + license = licenses.gpl3; + }; + }; +in +mkShell { + buildInputs = [ + asciidoctor + git + go + hugo + jq + openring + ]; + + shellHook = '' + chmod +x ./bin/openring-create + go version + hugo version + ''; +}