Try rewrite code to improve service configuration
This commit is contained in:
parent
78c30ffc51
commit
30bd041431
18
flake.nix
18
flake.nix
|
@ -18,23 +18,11 @@
|
|||
};
|
||||
|
||||
outputs = { self, blog-source, blog-source-localized, nixpkgs, flake-utils }:
|
||||
flake-utils.lib.eachDefaultSystem (
|
||||
system:
|
||||
let
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
blog = import ./default.nix {
|
||||
inherit blog-source blog-source-localized pkgs;
|
||||
};
|
||||
in
|
||||
{
|
||||
packages = {
|
||||
english = blog.english;
|
||||
"drafts/russian" = blog.drafts.russian;
|
||||
"drafts/english" = blog.drafts.english;
|
||||
buildersFor = system: import ./lib.nix {
|
||||
inherit blog-source blog-source-localized;
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
};
|
||||
defaultPackage = blog.english;
|
||||
}
|
||||
) // {
|
||||
nixosModule = (import ./module.nix);
|
||||
};
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ let
|
|||
name = "blog-static";
|
||||
version = settings.source.rev;
|
||||
src = settings.source;
|
||||
ssl = settings.ssl;
|
||||
urlSub =
|
||||
let
|
||||
regexEscape = lib.escape [ "/" "(" ")" "[" "]" "+" "*" "\\" ];
|
||||
|
@ -28,31 +29,27 @@ let
|
|||
(ruby.withPackages (ps: [ ps.nokogiri ]))
|
||||
];
|
||||
};
|
||||
wrapHost = ssl: host: (if ssl then "https" else "http") + "//${host}";
|
||||
in
|
||||
{
|
||||
english = website {
|
||||
lib = {
|
||||
english = settings: website {
|
||||
inherit (settings) drafts;
|
||||
ssl = settings.ssl or false;
|
||||
source = blog-source;
|
||||
path = ".";
|
||||
drafts = false;
|
||||
};
|
||||
drafts = {
|
||||
english = website {
|
||||
source = blog-source;
|
||||
path = ".";
|
||||
drafts = true;
|
||||
replaceUrl = {
|
||||
from = "https://danilafe.com";
|
||||
to = "http://drafts.danilafe.com";
|
||||
to = wrapHost settings.ssl settings.host;
|
||||
};
|
||||
};
|
||||
russian = website {
|
||||
russian = settings: website {
|
||||
inherit (settings) drafts;
|
||||
ssl = settings.ssl or false;
|
||||
source = blog-source-localized;
|
||||
path = "ru";
|
||||
drafts = true;
|
||||
replaceUrl = {
|
||||
from = "https://ru.danilafe.com";
|
||||
to = "http://drafts.ru.danilafe.com";
|
||||
to = wrapHost settings.ssl settings.host;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue
Block a user