diff options
Diffstat (limited to '')
-rw-r--r-- | default.nix | 55 |
1 files changed, 38 insertions, 17 deletions
diff --git a/default.nix b/default.nix index 0d7fee0..7b297d2 100644 --- a/default.nix +++ b/default.nix @@ -1,11 +1,9 @@ let pkgsOriginal = import <nixpkgs> {}; - pkgsSrc = pkgsOriginal.fetchzip { - url = "https://github.com/NixOS/nixpkgs/archive/18.03.zip"; - sha256 = "0hk4y2vkgm1qadpsm4b0q1vxq889jhxzjx3ragybrlwwg54mzp4f"; - }; - pkgs = import (pkgsSrc) {}; - stdenv = pkgs.stdenv; + pkgs = import (pkgsOriginal.fetchzip { + url = "https://github.com/NixOS/nixpkgs/archive/dd6b4b7078d89decabefc6b1a698327db132fbfe.zip"; + sha256 = "1cs5vibi2gab8i9m317v1b1spvmm2ppad8pxpkkp64fp1s3q6zy9"; + }) {}; # Taken from: # http://www.cs.yale.edu/homes/lucas.paul/posts/2017-04-10-hakyll-on-nix.html @@ -21,17 +19,40 @@ let ghc -O2 -dynamic --make Main.hs -o $out/bin/build-site ''; }; -in stdenv.mkDerivation rec { - name = "euandreh-website"; - src = ./site; - phases = "unpackPhase buildPhase"; - buildInputs = [ websiteBuilder ]; - buildPhase = '' - export LOCALE_ARCHIVE="${pkgs.glibcLocales}/lib/locale/locale-archive"; - export LANG=en_US.UTF-8 - build-site build +in with pkgs; with pkgs.stdenv; rec { + build = mkDerivation rec { + name = "website"; + src = ./site; + phases = "unpackPhase buildPhase"; + buildInputs = [ websiteBuilder ]; + buildPhase = '' + export LOCALE_ARCHIVE="${pkgs.glibcLocales}/lib/locale/locale-archive"; + export LANG=en_US.UTF-8 + build-site build - mkdir $out - cp -r _site/* $out + mkdir $out + cp -r _site/* $out + ''; + }; + shell = mkShell rec { + # See also the reference documentation: + # https://nixos.org/nixpkgs/manual/#sec-pkgs-mkShell + name = "website-shell"; + buildInputs = [ + websiteBuilder + (pkgs.haskellPackages.ghcWithPackages (p: with p; [ hakyll ])) + ]; + }; + publishScript = pkgs.writeShellScriptBin "publish.sh" '' + set -euo pipefail + ${pkgs.rsync}/bin/rsync --verbose \ + --copy-links \ + --progress \ + --stats \ + --update \ + --recursive \ + --rsh="ssh -o StrictHostKeyChecking=no" \ + ${build}/ \ + "$SERVER_URL:$DOCS_SERVER_PATH" ''; } |