update nix flake to build the site

This commit is contained in:
Salar Rahmanian 2024-02-10 23:35:02 -08:00
parent 13caf95739
commit 83cb66c204

View file

@ -11,18 +11,38 @@
outputs = { self, nixpkgs, theme }: outputs = { self, nixpkgs, theme }:
let let
themeName = ((builtins.fromTOML (builtins.readFile "${theme}/theme.toml")).name);
allSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ]; allSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
forAllSystems = nixpkgs.lib.genAttrs allSystems; forAllSystems = nixpkgs.lib.genAttrs allSystems;
nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; }); nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; });
in in
{ {
packages = forAllSystems (system:
let
pkgs = nixpkgsFor.${system};
in {
default = pkgs.stdenv.mkDerivation rec {
name = "softinio-${system}";
version = "0.1";
src = ./.;
nativeBuildInputs = with pkgs; [ zola ];
configurePhase = ''
mkdir -p themes
ln -snf "${theme}" "themes/${themeName}"
'';
buildPhase = ''
zola build
'';
installPhase = ''
mkdir -p $out
cp -r public/* $out
'';
};
});
devShells = forAllSystems (system: devShells = forAllSystems (system:
let let
pkgs = nixpkgsFor.${system}; pkgs = nixpkgsFor.${system};
themeName = ((builtins.fromTOML (builtins.readFile "${theme}/theme.toml")).name);
in { in {
default = pkgs.mkShell { default = pkgs.mkShell {
buildInputs = with pkgs; [ zola ]; buildInputs = with pkgs; [ zola ];