project-cloud/flake.nix

59 lines
1.4 KiB
Nix

{
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
inputs.theme_anemone = {
url = "github:Speyll/anemone";
flake = false;
};
inputs.theme_deepthought = {
url = "github:RatanShreshtha/DeepThought";
flake = false;
};
outputs = {
self,
nixpkgs,
theme_anemone,
theme_deepthought,
}: let
supportedSystems = ["x86_64-linux" "aarch64-linux"];
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
pkgs = forAllSystems (system: nixpkgs.legacyPackages.${system});
url_deploy = "https://project-cloud.net";
url_local = "http://localhost:8080";
name = "project-cloud";
theme = theme_deepthought;
package = system: url:
pkgs.${system}.stdenv.mkDerivation {
inherit name;
nativeBuildInputs = with pkgs.${system}; [zola];
src = ./.;
submodules = true;
buildPhase = ''
ln -s ${theme} themes/DeepThought
zola build -u ${url}
'';
installPhase = ''
mkdir $out
cp -r public/ $out/
cat goatcounter.url >> $out/public/index.html
'';
};
in {
packages = forAllSystems (system: rec {
project-cloud = package system url_deploy;
test = package system url_local;
default = project-cloud;
});
devShells = forAllSystems (system: {
default = pkgs.${system}.mkShellNoCC {
packages = with pkgs.${system}; [zola caddy];
};
});
};
}