forked from Fediversity/fediversity.eu
48 lines
1.5 KiB
Nix
48 lines
1.5 KiB
Nix
{
|
|
inputs = {
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
|
hugoplate.url = "github:zeon-studio/hugoplate";
|
|
hugoplate.flake = false;
|
|
hugo-modules.url = "github:gethugothemes/hugo-modules";
|
|
hugo-modules.flake = false;
|
|
};
|
|
outputs = inputs@{ self, nixpkgs, hugoplate, ... }:
|
|
let
|
|
system = "x86_64-linux";
|
|
lib = nixpkgs.lib;
|
|
pkgs = nixpkgs.legacyPackages.${system};
|
|
in
|
|
{
|
|
packages.${system}.default =
|
|
let
|
|
theme = "hugoplate";
|
|
modules = with builtins; map (attrs: baseNameOf attrs.path) (fromTOML (readFile ./src/config/_default/module.toml)).imports;
|
|
in
|
|
pkgs.stdenv.mkDerivation
|
|
{
|
|
name = "website";
|
|
src = ./src;
|
|
buildInputs = with pkgs; [ go nodejs git ];
|
|
buildPhase = ''
|
|
# install theme
|
|
mkdir -p themes/${theme}
|
|
cat << EOF >> hugo.toml
|
|
theme = "${theme}"
|
|
EOF
|
|
cp -r ${inputs.${theme}}/* themes/${theme}
|
|
# install modules
|
|
mkdir -p themes/github.com/gethugothemes/hugo-modules
|
|
cp -r ${toString (map (module: "${inputs.hugo-modules}/${module}") modules)} themes/github.com/gethugothemes/hugo-modules/
|
|
${lib.getExe pkgs.hugo} --minify --logLevel info -d public
|
|
'';
|
|
installPhase = "cp -r public $out";
|
|
};
|
|
devShells.${system}.default =
|
|
pkgs.mkShell {
|
|
packages = [
|
|
pkgs.hugo
|
|
];
|
|
};
|
|
};
|
|
}
|