split flake into multiple files
This commit is contained in:
parent
981108e77a
commit
7a32bd5efd
15
devShells.nix
Normal file
15
devShells.nix
Normal file
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
pkgs,
|
||||
selfPkgs,
|
||||
...
|
||||
}:
|
||||
{
|
||||
default = pkgs.mkShellNoCC {
|
||||
inputsFrom = [ selfPkgs.local-content ];
|
||||
|
||||
packages = with pkgs; [
|
||||
go
|
||||
shellcheck
|
||||
];
|
||||
};
|
||||
}
|
72
flake.nix
72
flake.nix
|
@ -30,77 +30,9 @@
|
|||
);
|
||||
in
|
||||
{
|
||||
packages = forAllSystems (
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
selfPkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
mkWwwContent =
|
||||
{ domain }:
|
||||
pkgs.stdenvNoCC.mkDerivation {
|
||||
pname = "www-content";
|
||||
version = domain;
|
||||
src = ./.;
|
||||
packages = forAllSystems (import ./packages.nix);
|
||||
|
||||
# Build dependencies
|
||||
nativeBuildInputs = [
|
||||
pkgs.hugo
|
||||
pkgs.glibcLocales
|
||||
(pkgs.python3.withPackages (python-pkgs: [
|
||||
python-pkgs.icalendar
|
||||
python-pkgs.pytz
|
||||
]))
|
||||
];
|
||||
|
||||
LOCALE_ARCHIVE = "${pkgs.glibcLocales}/lib/locale/locale-archive";
|
||||
|
||||
# Build phase - run Hugo to generate the site
|
||||
buildPhase = ''
|
||||
mkdir -p public
|
||||
hugo --baseURL=https://${domain}/
|
||||
|
||||
python3 ./tools/merge_cals.py
|
||||
upcoming="$(python3 tools/gen_upcoming.py static/all.ics 20 5 | tr '\n' ' ')"
|
||||
cp static/all.ics public/all.ics
|
||||
sed -i "s#CALENDAR#$upcoming#g" public/index.html
|
||||
'';
|
||||
|
||||
# Install phase - copy the public directory to the output
|
||||
installPhase = ''
|
||||
mkdir -p $out
|
||||
cp -r public/* $out/
|
||||
'';
|
||||
};
|
||||
in
|
||||
{
|
||||
production-content = mkWwwContent { domain = "berlin.ccc.de"; };
|
||||
staging-content = mkWwwContent { domain = "staging.berlin.ccc.de"; };
|
||||
local-content = mkWwwContent { domain = "localhost"; };
|
||||
}
|
||||
);
|
||||
|
||||
devShells = forAllSystems (
|
||||
{
|
||||
pkgs,
|
||||
system,
|
||||
selfPkgs,
|
||||
...
|
||||
}:
|
||||
{
|
||||
default = pkgs.mkShellNoCC {
|
||||
inputsFrom = [ selfPkgs.local-content ];
|
||||
|
||||
packages = with pkgs; [
|
||||
go
|
||||
|
||||
shellcheck
|
||||
];
|
||||
};
|
||||
}
|
||||
);
|
||||
devShells = forAllSystems (import ./devShells.nix);
|
||||
|
||||
formatter = forAllSystems ({ pkgs, ... }: pkgs.nixfmt-rfc-style);
|
||||
};
|
||||
|
|
47
packages.nix
Normal file
47
packages.nix
Normal file
|
@ -0,0 +1,47 @@
|
|||
{
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
mkWwwContent =
|
||||
{ domain }:
|
||||
pkgs.stdenvNoCC.mkDerivation {
|
||||
pname = "www-content";
|
||||
version = domain;
|
||||
src = ./.;
|
||||
|
||||
# Build dependencies
|
||||
nativeBuildInputs = [
|
||||
pkgs.hugo
|
||||
pkgs.glibcLocales
|
||||
(pkgs.python3.withPackages (python-pkgs: [
|
||||
python-pkgs.icalendar
|
||||
python-pkgs.pytz
|
||||
]))
|
||||
];
|
||||
|
||||
LOCALE_ARCHIVE = "${pkgs.glibcLocales}/lib/locale/locale-archive";
|
||||
|
||||
# Build phase - run Hugo to generate the site
|
||||
buildPhase = ''
|
||||
mkdir -p public
|
||||
hugo --baseURL=https://${domain}/
|
||||
|
||||
python3 ./tools/merge_cals.py
|
||||
upcoming="$(python3 tools/gen_upcoming.py static/all.ics 20 5 | tr '\n' ' ')"
|
||||
cp static/all.ics public/all.ics
|
||||
sed -i "s#CALENDAR#$upcoming#g" public/index.html
|
||||
'';
|
||||
|
||||
# Install phase - copy the public directory to the output
|
||||
installPhase = ''
|
||||
mkdir -p $out
|
||||
cp -r public/* $out/
|
||||
'';
|
||||
};
|
||||
in
|
||||
{
|
||||
production-content = mkWwwContent { domain = "berlin.ccc.de"; };
|
||||
staging-content = mkWwwContent { domain = "staging.berlin.ccc.de"; };
|
||||
local-content = mkWwwContent { domain = "localhost"; };
|
||||
}
|
Loading…
Reference in a new issue