site/flake.nix

98 lines
3.4 KiB
Nix
Raw Normal View History

2021-11-30 18:50:21 +01:00
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-21.11";
2021-11-30 18:50:21 +01:00
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }: flake-utils.lib.eachDefaultSystem
(system:
let
pkgs = import nixpkgs { inherit system; config.allowUnfree = true; };
in
rec {
packages = rec {
bulma = pkgs.fetchzip {
url = "https://github.com/jgthms/bulma/releases/download/0.9.0/bulma-0.9.0.zip";
sha256 = "sha256-FKWdkq6pRukCzR2IQ88OHlPkIJbeeEz7NdIWv44k8TM=";
};
podlove-subscribe-button = pkgs.fetchzip {
url = "https://github.com/podlove/podlove-subscribe-button/releases/download/v17/podlove-subscribe-button-v17.zip";
sha256 = "sha256-N+lxzDpw2mNOg0i+pOFuvwNMi5Q7rZK4H9WEzf5/1us=";
stripRoot = false;
};
podlove-web-player = pkgs.fetchzip {
url = "https://registry.npmjs.org/@podlove/web-player/-/web-player-4.5.13.tgz";
sha256 = "sha256-U7REkg0FwBaMO25M4lHRRWcNNhgZPPjx/AR48usPqCU=";
};
schulischer-schabernack = pkgs.callPackage
({ stdenv
, ffmpeg-full
, python3
, zola
, staging ? false
}:
let
linkVendor = ''
mkdir -p vendor static/vendor
ln -sfT ${packages.bulma} vendor/bulma
# !!! XXX hack
# copying is required at least with interactive shell, because zola does not copy symlinks to output directory
# to keep it up to date, it is removed before that
rm -rf static/vendor/{podlove-subscribe-button,podlove-web-player}
cp --reflink=auto --no-preserve=mode,ownership -rf ${packages.podlove-subscribe-button} static/vendor/podlove-subscribe-button
cp --reflink=auto --no-preserve=mode,ownership -rf ${packages.podlove-web-player} static/vendor/podlove-web-player
'';
in
stdenv.mkDerivation {
name = "schulischer-schabernack";
src = self;
nativeBuildInputs = [
(ffmpeg-full.override { nonfreeLicensing = true; fdkaacExtlib = true; })
(python3.withPackages (ps: with ps; [ mutagen ]))
zola
];
SCHABERNACK_ENV = if staging then "staging" else "production";
postPatch = ''
patchShebangs .
'';
configurePhase = ''
runHook preConfigure
${linkVendor}
runHook postConfigure
'';
buildPhase = ''
runHook preBuild
./build.sh
runHook postBuild
'';
installPhase = ''
runHook preInstall
cp -r public $out
runHook postInstall
'';
shellHook = ''
${linkVendor}
export NIXOPS_DEPLOYMENT=schulischer-schabernack-hcloud
export NIX_PATH=nixpkgs=${nixpkgs}
'';
})
{ };
schulischer-schabernack-staging = schulischer-schabernack.override { staging = true; };
};
defaultPackage = packages.schulischer-schabernack;
});
2021-11-30 18:50:21 +01:00
}