2021-01-01 21:24:41 +00:00
|
|
|
{ sources ? import ./nix/sources.nix, pkgs ? import sources.nixpkgs { } }:
|
|
|
|
with pkgs;
|
2020-02-07 22:49:04 +00:00
|
|
|
|
2020-02-13 22:45:21 +00:00
|
|
|
let
|
2021-01-15 03:36:34 +00:00
|
|
|
rust = pkgs.callPackage ./nix/rust.nix { };
|
|
|
|
|
2021-01-01 21:24:41 +00:00
|
|
|
srcNoTarget = dir:
|
|
|
|
builtins.filterSource
|
|
|
|
(path: type: type != "directory" || builtins.baseNameOf path != "target")
|
|
|
|
dir;
|
|
|
|
|
2021-01-15 03:36:34 +00:00
|
|
|
naersk = pkgs.callPackage sources.naersk {
|
|
|
|
rustc = rust;
|
|
|
|
cargo = rust;
|
|
|
|
};
|
2021-01-01 21:24:41 +00:00
|
|
|
dhallpkgs = import sources.easy-dhall-nix { inherit pkgs; };
|
|
|
|
src = srcNoTarget ./.;
|
|
|
|
|
|
|
|
xesite = naersk.buildPackage {
|
|
|
|
inherit src;
|
2021-01-10 15:13:11 +00:00
|
|
|
doCheck = true;
|
2021-01-01 21:24:41 +00:00
|
|
|
buildInputs = [ pkg-config openssl git ];
|
|
|
|
remapPathPrefix = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
config = stdenv.mkDerivation {
|
|
|
|
pname = "xesite-config";
|
|
|
|
version = "HEAD";
|
|
|
|
buildInputs = [ dhallpkgs.dhall-simple ];
|
|
|
|
|
|
|
|
phases = "installPhase";
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
cd ${src}
|
|
|
|
dhall resolve < ${src}/config.dhall >> $out
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
in pkgs.stdenv.mkDerivation {
|
|
|
|
inherit (xesite) name;
|
|
|
|
inherit src;
|
|
|
|
phases = "installPhase";
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out $out/bin
|
|
|
|
|
|
|
|
cp -rf ${config} $out/config.dhall
|
|
|
|
cp -rf $src/blog $out/blog
|
|
|
|
cp -rf $src/css $out/css
|
|
|
|
cp -rf $src/gallery $out/gallery
|
|
|
|
cp -rf $src/static $out/static
|
|
|
|
cp -rf $src/talks $out/talks
|
|
|
|
|
|
|
|
cp -rf ${xesite}/bin/xesite $out/bin/xesite
|
|
|
|
'';
|
|
|
|
}
|