mirror of
https://git.sr.ht/~magic_rb/website
synced 2024-11-24 17:16:15 +01:00
2edfef83b3
Signed-off-by: Magic_RB <magic_rb@redalder.org>
72 lines
1.9 KiB
Nix
72 lines
1.9 KiB
Nix
{
|
|
inputs = {
|
|
nixpkgs.url = "nixpkgs";
|
|
org-thtml = {
|
|
url = "github:juanjosegarciaripoll/org-thtml";
|
|
flake = false;
|
|
};
|
|
emacs-htmlize = {
|
|
url = "github:hniksic/emacs-htmlize";
|
|
flake = false;
|
|
};
|
|
};
|
|
|
|
outputs = { self, nixpkgs, nixng, org-thtml, emacs-htmlize, ... }@inputs:
|
|
let
|
|
supportedSystems = [ "x86_64-linux" "i686-linux" "aarch64-linux" ];
|
|
forAllSystems = f: nixpkgs.lib.genAttrs supportedSystems (system: f system);
|
|
site = pkgs: which:
|
|
pkgs.stdenv.mkDerivation {
|
|
name = which;
|
|
version = "0.1";
|
|
src = ./.;
|
|
nativeBuildInputs = [ pkgs.emacs ];
|
|
|
|
buildPhase = ''
|
|
cp ${org-thtml}/ox-thtml.el ./ox-thtml.el
|
|
cp ${emacs-htmlize}/htmlize.el ./htmlize.el
|
|
mkdir tmp && export HOME=$(pwd)/tmp
|
|
emacs --script ./make.el -- ${which}
|
|
|
|
find public_html -name 'sitemap.*' -exec rm {} \;
|
|
'';
|
|
|
|
installPhase = ''
|
|
mkdir -p $out
|
|
cp -r public_html/* $out
|
|
'';
|
|
};
|
|
in
|
|
{
|
|
redalder = forAllSystems (system:
|
|
let
|
|
pkgs = import nixpkgs { inherit system; };
|
|
in
|
|
site pkgs "redalder.org"
|
|
);
|
|
|
|
nixng = forAllSystems (system:
|
|
let
|
|
pkgs = import nixpkgs { inherit system; };
|
|
in
|
|
site pkgs "nixng.org"
|
|
);
|
|
|
|
website = forAllSystems (system:
|
|
let
|
|
pkgs = import nixpkgs { inherit system; };
|
|
in
|
|
pkgs.runCommandNoCC "website" {}
|
|
''
|
|
mkdir -p $out/
|
|
ln -s ${self.redalder.${system}} $out/redalder
|
|
ln -s ${self.nixng.${system}} $out/nixng
|
|
''
|
|
);
|
|
|
|
defaultPackage = forAllSystems (system:
|
|
self.website.${system}
|
|
);
|
|
};
|
|
}
|