67
loading...
This website collects cookies to deliver better user experience
Posted on July 6, 2021 at Safely Dysfunctional Blog by Janil Garcia in Brazilian Portuguese and translated by Eduardo Pereira Garcia
consider $user_name = janilcgarcia and $project_name = blog
If name of the project follows the pattern $user_name.gitlab.io (janilcgarcia.gitlab.io in this case), the page is hosted at janilcgarcia.gitlab.io.
If the project name is different from that it is hosted at $user_name.gitlab.io/$project_name (that is janilcgarcia.gitlab.io/blog
).
$group.gitlab.io
(in my case https://safelydysfunctional.gitlab.io) to host static pages too. Using this you can use legal domains where to serve your site. The mapping for groups works as previously described for users.# You start setting the image for the runner
image: docker/base/image
# Then you define the steps to generate the pages
pages:
# on `script` you put the steps necessary to build the page
script:
- ssg compile -o public/
# on artifacts you specify files that should be kept after the execution
# the pages MUST be on the public/ directory in project root
artifacts:
paths:
- public
# with `only` you can specify which branches trigger this action
only:
- master
blog.nix
, default.nix
and shell.nix
):{ mkDerivation, base, binary, bytestring, data-default, directory
, filepath, fsnotify, hakyll, http-types, lib, pandoc, pandoc-types
, process, tagsoup, text, wai, wai-app-static, wai-extra, warp
, pythonPackages
}:
mkDerivation {
pname = "blog";
version = "0.1.0.0";
src = ./.;
isLibrary = false;
isExecutable = true;
executableHaskellDepends = [
base binary bytestring data-default directory filepath fsnotify
hakyll http-types pandoc pandoc-types process tagsoup text wai
wai-app-static wai-extra warp
];
executableSystemDepends = [ pythonPackages.pygments ];
license = lib.licenses.gpl3;
hydraPlatforms = lib.platforms.none;
}
default.nix
describes how to compile the project and defines the environment where the compilation must be done.let
pinnedPkgs = import ./pkgs-from-json.nix { json = ./release-21.05.json; };
in
pinnedPkgs.pkgs.haskellPackages.callPackage ./blog.nix { }
shell.nix
describes that nix-shell can start from inside the same environment that th compilation one. It is from here you could put hoogle and haskell-language-server if needed.{ }:
(import ./default.nix).env
blog.nix
and add the property executableSystemDepends
containing pythonPackages.pygments
, the pygments package name in Nix.shell.nix
, but until I figure this whole thing out that's how it'll remain. Most importantly: it works as is, so let's try not to go fixing what ain't broke.image: nixos/nix
pages:
before_script:
- nix-build default.nix
script:
- nix-shell --run 'result/bin/site build'
artifacts:
paths:
- public
only:
- master
nixos/nix
avaiable at Docker Hub (which is very small, containing only the package manager - not even bash
seems to be there), it compiles the site generator using the description into default.nix
and after it generates the site, storing the result in the public directory, that will be collected by GitLab Pages and goes to web."That's all folks!"