alexandria/flake.nix
Youwen Wu 26bc081ace
Some checks are pending
Deploy Quartz site to GitHub Pages using Nix / build (push) Waiting to run
Deploy Quartz site to GitHub Pages using Nix / deploy (push) Blocked by required conditions
feat: remove useless content, add liminalOS docs
2025-01-02 03:15:46 -08:00

65 lines
1.7 KiB
Nix

{
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
inputs.liminalOS.url = "github:youwen5/liminalOS";
outputs =
inputs@{ nixpkgs, self, ... }:
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
{
default = callPackage ./site.nix {
liminalOSDocs = inputs.liminalOS.packages.${system}.docs;
};
}
);
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}";
};
}
);
};
}