1
0
Fork 0
blog/flake.nix

66 lines
1.3 KiB
Nix
Raw Normal View History

2024-07-07 17:00:34 +00:00
{
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)
];
};
});
};
}