66 lines
1.3 KiB
Nix
66 lines
1.3 KiB
Nix
{
|
|
description = "Bloggy time!";
|
|
inputs = {
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05";
|
|
};
|
|
|
|
outputs = { self, nixpkgs }: let
|
|
systems = [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" "x86_64-darwin" ];
|
|
forAllSystems = function:
|
|
nixpkgs.lib.genAttrs systems (system: function (
|
|
import nixpkgs {
|
|
inherit system;
|
|
config.allowUnfree = true;
|
|
}
|
|
));
|
|
|
|
env = pkgs: pkgs.callPackage ({ mkYarnModules }:
|
|
mkYarnModules {
|
|
pname = "blog-env";
|
|
version = "2.2.2";
|
|
yarnLock = ./yarn.lock;
|
|
packageJSON = ./package.json;
|
|
}) { };
|
|
|
|
in {
|
|
packages = forAllSystems (pkgs: rec {
|
|
eleventyEnv = (env pkgs);
|
|
blog = pkgs.callPackage (
|
|
{ stdenvNoCC, eleventyEnv, lib, nodejs, vips}:
|
|
stdenvNoCC.mkDerivation {
|
|
pname = "blog";
|
|
version = "2.2.2";
|
|
src = ./.;
|
|
|
|
nativeBuildInputs = [
|
|
eleventyEnv
|
|
nodejs
|
|
vips
|
|
];
|
|
ELEVENTY_ENVIRONMENT = "prod";
|
|
configurePhase = ''
|
|
ln -s ${eleventyEnv}/node_modules ./node_modules
|
|
'';
|
|
|
|
buildPhase = ''
|
|
npx eleventy
|
|
'';
|
|
installPhase = ''
|
|
cp -ar _site $out
|
|
'';
|
|
}) { inherit eleventyEnv; };
|
|
});
|
|
|
|
devShells = forAllSystems (pkgs: {
|
|
default = pkgs.mkShell {
|
|
packages = with pkgs; [
|
|
nodejs
|
|
yarn
|
|
(env pkgs)
|
|
];
|
|
};
|
|
});
|
|
};
|
|
|
|
}
|