home/flake.nix

51 lines
1.4 KiB
Nix
Raw Normal View History

2024-03-25 14:42:21 +01:00
{
inputs.nixpkgs.url = "github:NixOs/nixpkgs";
inputs.flake-utils.url = "github:numtide/flake-utils";
# inputs.flake-utils.inputs.nixpkgs.follows = "nixpkgs";
outputs = {
flake-utils,
nixpkgs,
...
}:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = import nixpkgs {
inherit system;
};
dev_serve = pkgs.writeShellScriptBin "serve" ''
2024-04-09 15:16:08 +02:00
${pkgs.zola}/bin/zola serve $@
2024-03-25 14:42:21 +01:00
'';
2024-04-09 14:56:51 +02:00
static_serve = pkgs.writeShellScriptBin "serve" ''
2024-04-09 15:16:08 +02:00
${pkgs.simple-http-server}/bin/simple-http-server -i
2024-04-09 14:56:51 +02:00
'';
static_homepage = pkgs.stdenv.mkDerivation {
name = "homepage";
src = ./.;
buildPhase = ''
${pkgs.zola}/bin/zola build
'';
installPhase = ''
mkdir -p $out/static
cp -a public/. $out/
'';
};
prod_homepage = pkgs.writeShellScriptBin "home-prod" ''
${pkgs.simple-http-server}/bin/simple-http-server -i ${static_homepage}/. $@
2024-03-27 11:38:31 +01:00
'';
2024-03-25 14:42:21 +01:00
in {
2024-04-09 14:56:51 +02:00
packages.default = prod_homepage;
packages.static = static_homepage;
2024-03-25 14:42:21 +01:00
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [
pkgs.vscode-langservers-extracted # html, css lsp
simple-http-server
dev_serve
2024-04-09 14:56:51 +02:00
static_serve
2024-03-27 11:23:10 +01:00
imagemagick
ffmpeg
2024-04-09 14:13:34 +02:00
zola
2024-03-25 14:42:21 +01:00
];
};
});
}