www/flake.nix

70 lines
1.7 KiB
Nix

{
description = "A flake containing a development environment for the CCCB website.";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-26.05";
};
outputs =
{
self,
nixpkgs,
}:
let
supported-systems = [
"x86_64-linux"
"aarch64-linux"
"aarch64-darwin"
"x86_64-darwin"
];
forAllSystems =
f:
nixpkgs.lib.genAttrs supported-systems (
system:
f rec {
inherit system;
pkgs = nixpkgs.legacyPackages.${system};
selfPkgs = self.packages.${system};
lib = pkgs.lib // self.lib;
}
);
in
{
packages = forAllSystems (import ./packages.nix);
devShells = forAllSystems (import ./devShells.nix);
formatter = forAllSystems ({ pkgs, ... }: pkgs.nixfmt-tree);
lib.mkWwwContent =
{ domain, system }:
let
pkgs = nixpkgs.legacyPackages.${system};
in
pkgs.stdenvNoCC.mkDerivation {
pname = "www-content";
version = domain;
src = ./.;
# Build dependencies
nativeBuildInputs = [
pkgs.hugo
pkgs.glibcLocales
];
# LOCALE_ARCHIVE = builtins.trace pkgs.glibcLocales "${pkgs.glibcLocales}/lib/locale/locale-archive";
# Build phase - run Hugo to generate the site
buildPhase = ''
mkdir -p public
hugo --baseURL=https://${domain}/
'';
# Install phase - copy the public directory to the output
installPhase = ''
mkdir -p $out
cp -r public/* $out/
'';
};
};
}