110 lines
3.0 KiB
Nix
110 lines
3.0 KiB
Nix
|
|
{
|
||
|
|
description = "Fizz.buzz homepage";
|
||
|
|
|
||
|
|
inputs = {
|
||
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||
|
|
natter = {
|
||
|
|
url = "git+https://code.fizz.buzz/talexander/natter.git";
|
||
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
||
|
|
};
|
||
|
|
organic_ast_explorer = {
|
||
|
|
url = "git+https://code.fizz.buzz/talexander/organic_ast_explorer.git";
|
||
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
||
|
|
};
|
||
|
|
};
|
||
|
|
|
||
|
|
outputs =
|
||
|
|
{
|
||
|
|
self,
|
||
|
|
nixpkgs,
|
||
|
|
natter,
|
||
|
|
organic_ast_explorer,
|
||
|
|
}:
|
||
|
|
let
|
||
|
|
forAllSystems =
|
||
|
|
func:
|
||
|
|
builtins.listToAttrs (
|
||
|
|
map (system: {
|
||
|
|
name = system;
|
||
|
|
value = func system;
|
||
|
|
}) nixpkgs.lib.systems.flakeExposed
|
||
|
|
);
|
||
|
|
in
|
||
|
|
{
|
||
|
|
devShells = forAllSystems (
|
||
|
|
system:
|
||
|
|
let
|
||
|
|
overlays = [
|
||
|
|
natter.overlays.default
|
||
|
|
organic_ast_explorer.overlays.default
|
||
|
|
];
|
||
|
|
pkgs = import nixpkgs {
|
||
|
|
inherit system overlays;
|
||
|
|
};
|
||
|
|
in
|
||
|
|
{
|
||
|
|
default = pkgs.mkShell {
|
||
|
|
nativeBuildInputs = [
|
||
|
|
];
|
||
|
|
buildInputs = with pkgs; [
|
||
|
|
pkgs.natter.release
|
||
|
|
];
|
||
|
|
};
|
||
|
|
}
|
||
|
|
);
|
||
|
|
packages = forAllSystems (
|
||
|
|
system:
|
||
|
|
let
|
||
|
|
overlays = [
|
||
|
|
natter.overlays.default
|
||
|
|
organic_ast_explorer.overlays.default
|
||
|
|
];
|
||
|
|
pkgs = import nixpkgs {
|
||
|
|
inherit system overlays;
|
||
|
|
};
|
||
|
|
appliedOverlay = self.overlays.default pkgs pkgs;
|
||
|
|
in
|
||
|
|
rec {
|
||
|
|
default = release;
|
||
|
|
inherit (appliedOverlay.homepage)
|
||
|
|
release
|
||
|
|
;
|
||
|
|
docker_env = pkgs.buildEnv {
|
||
|
|
name = "homepage";
|
||
|
|
paths = with pkgs; [
|
||
|
|
appliedOverlay.homepage.launch_nginx
|
||
|
|
bash
|
||
|
|
uutils-coreutils-noprefix
|
||
|
|
# toybox # Smaller than uutils-coreutils?
|
||
|
|
];
|
||
|
|
};
|
||
|
|
}
|
||
|
|
);
|
||
|
|
overlays.default = final: prev: {
|
||
|
|
homepage = final.lib.makeScope final.newScope (
|
||
|
|
homepageScope:
|
||
|
|
let
|
||
|
|
natter' = (natter.overlays.default final final).natter.release;
|
||
|
|
organic_ast_explorer' =
|
||
|
|
(organic_ast_explorer.overlays.default final final).organic_ast_explorer.release;
|
||
|
|
release = homepageScope.callPackage ./nix/package.nix {
|
||
|
|
natter = natter';
|
||
|
|
organic_ast_explorer = organic_ast_explorer';
|
||
|
|
};
|
||
|
|
nginx_conf = final.replaceVars "${./docker/server/nginx.conf}" {
|
||
|
|
web_root = release;
|
||
|
|
mime_types = "${final.nginx}/conf/mime.types";
|
||
|
|
headers_include = "${./docker/server/headers.include}";
|
||
|
|
};
|
||
|
|
launch_nginx = final.writeShellScriptBin "launch_nginx" ''
|
||
|
|
${final.nginx}/bin/nginx -c ${nginx_conf} -e stderr -g "daemon off;"
|
||
|
|
'';
|
||
|
|
in
|
||
|
|
{
|
||
|
|
inherit release launch_nginx;
|
||
|
|
}
|
||
|
|
);
|
||
|
|
};
|
||
|
|
};
|
||
|
|
}
|