2024-12-29 03:00:01 -08:00
|
|
|
{
|
|
|
|
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
2025-01-02 03:15:46 -08:00
|
|
|
inputs.liminalOS.url = "github:youwen5/liminalOS";
|
2024-12-29 03:00:01 -08:00
|
|
|
|
|
|
|
outputs =
|
2025-01-02 03:15:46 -08:00
|
|
|
inputs@{ nixpkgs, self, ... }:
|
2024-12-29 03:00:01 -08:00
|
|
|
let
|
|
|
|
forAllSystems = nixpkgs.lib.genAttrs [
|
|
|
|
"x86_64-linux"
|
|
|
|
"aarch64-linux"
|
|
|
|
"x86_64-darwin"
|
|
|
|
"aarch64-darwin"
|
|
|
|
];
|
|
|
|
in
|
|
|
|
{
|
|
|
|
packages = forAllSystems (
|
|
|
|
system:
|
|
|
|
let
|
|
|
|
pkgs = import nixpkgs { inherit system; };
|
|
|
|
inherit (pkgs) callPackage;
|
|
|
|
in
|
|
|
|
{
|
2025-01-02 03:15:46 -08:00
|
|
|
default = callPackage ./site.nix {
|
|
|
|
liminalOSDocs = inputs.liminalOS.packages.${system}.docs;
|
|
|
|
};
|
2024-12-29 03:00:01 -08:00
|
|
|
}
|
|
|
|
);
|
|
|
|
apps = forAllSystems (
|
|
|
|
system:
|
|
|
|
let
|
|
|
|
pkgs = import nixpkgs { inherit system; };
|
|
|
|
in
|
|
|
|
{
|
|
|
|
default = {
|
|
|
|
type = "app";
|
|
|
|
|
|
|
|
program =
|
|
|
|
let
|
|
|
|
caddyfile = pkgs.writeText "Caddyfile" ''
|
|
|
|
:8080 {
|
|
|
|
root * ${self.packages.${system}.default}/public/
|
|
|
|
file_server
|
|
|
|
try_files {path} {path}.html {path}/ =404
|
|
|
|
}
|
|
|
|
'';
|
|
|
|
|
|
|
|
formattedCaddyfile = pkgs.runCommand "Caddyfile" {
|
|
|
|
nativeBuildInputs = [ pkgs.caddy ];
|
|
|
|
} ''(caddy fmt ${caddyfile} || :) > "$out"'';
|
|
|
|
|
|
|
|
script = pkgs.writeShellApplication {
|
|
|
|
name = "logbook";
|
|
|
|
|
|
|
|
runtimeInputs = [ pkgs.caddy ];
|
|
|
|
|
|
|
|
text = "caddy run --config ${formattedCaddyfile} --adapter caddyfile";
|
|
|
|
};
|
|
|
|
|
|
|
|
in
|
|
|
|
"${pkgs.lib.getExe script}";
|
|
|
|
};
|
|
|
|
}
|
|
|
|
);
|
|
|
|
};
|
|
|
|
}
|