wiki/flake.nix
Simon Bruder 50cc02d182
Update to latest nixos-unstable
This simplifies the flake a lot.
2022-06-09 22:13:17 +02:00

74 lines
1.9 KiB
Nix

{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, flake-utils, nixpkgs }: flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
in
rec {
packages = nixpkgs.lib.mapAttrs
(name: value: pkgs.python3Packages.callPackage value { })
{
iosevka-web =
{ stdenv, fetchzip }:
stdenv.mkDerivation rec {
pname = "iosevka-web";
version = "15.5.0";
src = fetchzip {
url = "https://github.com/be5invis/Iosevka/releases/download/v15.5.0/webfont-iosevka-15.5.0.zip";
sha256 = "sha256-o7JHLs/E6oJGx0WxdHczK65Is7SZ9HdMXef/Am29OoA=";
stripRoot = false;
};
dontBuild = true;
installPhase = ''
mkdir -p $out
sed -e "s/url('ttf\/iosevka-.*.ttf') format('truetype'), //" iosevka.css > $out/iosevka.css
cp -r woff2 $out
'';
};
wiki =
{ stdenv }:
stdenv.mkDerivation {
name = "wiki";
src = self;
buildPhase = ''
mkdocs build -d $out
'';
installPhase = ''
mkdir -p $out/assets/fonts
ln -s ${packages.iosevka-web} $out/assets/fonts/iosevka
'';
nativeBuildInputs = with pkgs; [
mkdocs
python3Packages.mkdocs-material
];
};
};
defaultPackage = packages.wiki;
apps = {
serve = {
type = "app";
program = toString (pkgs.writeShellScript "serve" ''
${pkgs.miniserve}/bin/miniserve --index index.html ${packages.wiki}
'');
};
};
});
}