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