zerforschen.plus/flake.nix
2025-04-07 18:25:01 +02:00

98 lines
2.4 KiB
Nix

{
description = "Flake for the contents of https://zerforschen.plus";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-24.11";
};
outputs =
{ self, nixpkgs }:
let
supported-systems = [
"x86_64-linux"
"aarch64-linux"
];
forAllSystems =
f:
nixpkgs.lib.genAttrs supported-systems (
system:
f rec {
pkgs = nixpkgs.legacyPackages.${system};
inherit system;
}
);
in
{
packages = forAllSystems (
{ pkgs, ... }:
rec {
hugo-theme-poison = pkgs.stdenv.mkDerivation {
pname = "hugo-theme-poison";
homepage = "https://poison.lukeorth.com/";
version = "";
src = pkgs.fetchFromGitHub {
owner = "lukeorth";
repo = "poison";
rev = "07485e85f0247518bc64ed0cc6fd6b39abe3d90d";
hash = "sha256-NQN4u6rBjw+zC7NuDUFg9LUuuvIR7Ed22UIs2jcZtkQ=";
};
installPhase = ''
mkdir -p $out
cp -r * $out
'';
};
zerforschen-plus-content = pkgs.stdenv.mkDerivation {
name = "zerforschen-plus-content";
# Source directory containing your Hugo project
src = ./.;
# Build dependencies
nativeBuildInputs = [
pkgs.hugo
];
preBuildPhase = ''
'';
# Build phase - run Hugo to generate the site
buildPhase = ''
# Copy in theme before building website
mkdir -p themes/poison
cp -r ${hugo-theme-poison}/* themes/poison/
hugo
'';
# Install phase - copy the public directory to the output
installPhase = ''
mkdir -p $out
cp -r public/* $out/
'';
};
default = zerforschen-plus-content;
}
);
devShells = forAllSystems (
{ pkgs, system, ... }:
{
default = pkgs.mkShellNoCC rec {
inputsFrom = [ self.packages.${system}.default ];
shellHook = ''
mkdir -p themes
ln -snf "${self.packages.${system}.hugo-theme-poison}" themes/poison
'';
};
}
);
formatter = forAllSystems ({ pkgs, ... }: pkgs.nixfmt-rfc-style);
};
}