Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: NixOS/nixos-homepage
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 183d2dd27f6b
Choose a base ref
...
head repository: NixOS/nixos-homepage
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: d2bc46b77206
Choose a head ref
  • 1 commit
  • 5 files changed
  • 1 contributor

Commits on Jan 20, 2021

  1. make title on the landing page bigger

    and optimize Makefile to only built things that are needed
    garbas committed Jan 20, 2021

    Verified

    This commit was signed with the committer’s verified signature.
    gaborbernat Bernát Gábor
    Copy the full SHA
    d2bc46b View commit details
Showing with 93 additions and 57 deletions.
  1. +75 −37 Makefile
  2. +1 −1 community.tt
  3. +6 −15 scripts/fix-manual-headers.sh
  4. +8 −4 scripts/run.py
  5. +3 −0 site-styles/pages/main.less
112 changes: 75 additions & 37 deletions Makefile
Original file line number Diff line number Diff line change
@@ -44,7 +44,6 @@ DEMOS = \
demos/example_5.svg \
demos/example_6.svg


NIX_DEV_MANUAL_IN ?= /no-such-path
NIX_DEV_MANUAL_OUT = guides

@@ -64,64 +63,97 @@ all: $(NIX_PILLS_MANUAL_OUT)
$(NIX_PILLS_MANUAL_OUT): $(NIX_PILLS_MANUAL_IN) scripts/bootstrapify-docbook.sh scripts/bootstrapify-docbook.xsl layout.tt common.tt
bash ./scripts/bootstrapify-docbook.sh $(NIX_PILLS_MANUAL_IN) $(NIX_PILLS_MANUAL_OUT) 'Nix Pills' nixos https://github.com/NixOS/nix-pills


### Prettify the Nix manual.

NIX_MANUAL_STABLE_IN ?= /no-such-path
NIX_MANUAL_STABLE_OUT = manual/nix/stable

all: $(NIX_MANUAL_STABLE_OUT)

$(NIX_MANUAL_STABLE_OUT): $(call rwildcard, $(NIX_MANUAL_STABLE_IN), *) scripts/bootstrapify-docbook.sh scripts/bootstrapify-docbook.xsl layout.tt common.tt
bash ./scripts/bootstrapify-docbook.sh $(NIX_MANUAL_STABLE_IN) $(NIX_MANUAL_STABLE_OUT) 'Nix $(NIX_STABLE_VERSION) manual' nix https://github.com/NixOS/nix/tree/master/doc/manual

NIX_MANUAL_UNSTABLE_IN ?= /no-such-path
NIX_MANUAL_UNSTABLE_OUT = manual/nix/unstable

all: $(NIX_MANUAL_UNSTABLE_OUT)

$(NIX_MANUAL_UNSTABLE_OUT): $(call rwildcard, $(NIX_MANUAL_UNSTABLE_IN), *) scripts/bootstrapify-docbook.sh scripts/bootstrapify-docbook.xsl layout.tt common.tt
mkdir -p $(NIX_MANUAL_UNSTABLE_OUT)
cp --no-preserve=mode,ownership -RL $(NIX_MANUAL_UNSTABLE_IN)/* $(NIX_MANUAL_UNSTABLE_OUT)

manual/nix/index.html: $(NIX_MANUAL_STABLE_OUT) $(NIX_MANUAL_UNSTABLE_OUT)
bash ./scripts/fix-manual-headers.sh manual/nix stable
@echo "<!DOCTYPE html>" > $@
@echo "<html>" >> $@
@echo " <head>" >> $@
@echo " <meta http-equiv=\"refresh\" content=\"7; url='stable/index.html'\" />" >> $@
@echo " </head>" >> $@
@echo " <body>" >> $@
@echo " <h1>Redirecting...</h1>" >> $@
@echo " <p>Please follow <a href=\"stable/index.html\">this link</a>.</p>" >> $@
@echo " </body>" >> $@
@echo "</html>" >> $@

all: manual/nix/index.html

### Prettify the Nixpkgs manual.

NIXPKGS_MANUAL_STABLE_IN ?= /no-such-path
NIXPKGS_MANUAL_STABLE_OUT = manual/nixpkgs/stable

all: $(NIXPKGS_MANUAL_STABLE_OUT)

$(NIXPKGS_MANUAL_STABLE_OUT): $(NIXPKGS_MANUAL_STABLE_IN) scripts/bootstrapify-docbook.sh scripts/bootstrapify-docbook.xsl layout.tt common.tt
bash ./scripts/bootstrapify-docbook.sh $(NIXPKGS_MANUAL_STABLE_IN)/share/doc/nixpkgs $(NIXPKGS_MANUAL_STABLE_OUT) 'Nixpkgs $(NIXOS_STABLE_SERIES) manual' nixpkgs https://github.com/NixOS/nixpkgs/tree/master/doc

NIXPKGS_MANUAL_UNSTABLE_IN ?= /no-such-path
NIXPKGS_MANUAL_UNSTABLE_OUT = manual/nixpkgs/unstable

all: $(NIXPKGS_MANUAL_UNSTABLE_OUT)

$(NIXPKGS_MANUAL_UNSTABLE_OUT): $(NIXPKGS_MANUAL_UNSTABLE_IN) scripts/bootstrapify-docbook.sh scripts/bootstrapify-docbook.xsl layout.tt common.tt
bash ./scripts/bootstrapify-docbook.sh $(NIXPKGS_MANUAL_UNSTABLE_IN)/share/doc/nixpkgs $(NIXPKGS_MANUAL_UNSTABLE_OUT) 'Nixpkgs $(NIXOS_UNSTABLE_SERIES) manual' nixpkgs https://github.com/NixOS/nixpkgs/tree/master/doc

manual/nixpkgs/index.html: $(NIXPKGS_MANUAL_STABLE_OUT) $(NIXPKGS_MANUAL_UNSTABLE_OUT)
bash ./scripts/fix-manual-headers.sh manual/nixpkgs stable
@echo "<!DOCTYPE html>" > $@
@echo "<html>" >> $@
@echo " <head>" >> $@
@echo " <meta http-equiv=\"refresh\" content=\"7; url='stable/index.html'\" />" >> $@
@echo " </head>" >> $@
@echo " <body>" >> $@
@echo " <h1>Redirecting...</h1>" >> $@
@echo " <p>Please follow <a href=\"stable/index.html\">this link</a>.</p>" >> $@
@echo " </body>" >> $@
@echo "</html>" >> $@

all: manual/nixpkgs/index.html


### Prettify the NixOS manual.

NIXOS_MANUAL_STABLE_IN ?= /no-such-path
NIXOS_MANUAL_STABLE_OUT = manual/nixos/stable

all: $(NIXOS_MANUAL_STABLE_OUT)

$(NIXOS_MANUAL_STABLE_OUT): $(NIXOS_MANUAL_STABLE_IN) scripts/bootstrapify-docbook.sh scripts/bootstrapify-docbook.xsl layout.tt common.tt
bash ./scripts/bootstrapify-docbook.sh $(NIXOS_MANUAL_STABLE_IN)/share/doc/nixos $(NIXOS_MANUAL_STABLE_OUT) 'NixOS $(NIXOS_STABLE_SERIES) manual' nixos https://github.com/NixOS/nixpkgs/tree/master/nixos/doc/manual

NIXOS_MANUAL_UNSTABLE_IN ?= /no-such-path
NIXOS_MANUAL_UNSTABLE_OUT = manual/nixos/unstable

all: $(NIXOS_MANUAL_UNSTABLE_OUT)

$(NIXOS_MANUAL_UNSTABLE_OUT): $(NIXOS_MANUAL_UNSTABLE_IN) scripts/bootstrapify-docbook.sh scripts/bootstrapify-docbook.xsl layout.tt common.tt
bash ./scripts/bootstrapify-docbook.sh $(NIXOS_MANUAL_UNSTABLE_IN)/share/doc/nixos $(NIXOS_MANUAL_UNSTABLE_OUT) 'NixOS $(NIXOS_UNSTABLE_SERIES) manual' nixos https://github.com/NixOS/nixpkgs/tree/master/nixos/doc/manual

manual/nixos/index.html: $(NIXOS_MANUAL_STABLE_OUT) $(NIXOS_MANUAL_UNSTABLE_OUT)
bash ./scripts/fix-manual-headers.sh manual/nixos stable
@echo "<!DOCTYPE html>" > $@
@echo "<html>" >> $@
@echo " <head>" >> $@
@echo " <meta http-equiv=\"refresh\" content=\"7; url='stable/index.html'\" />" >> $@
@echo " </head>" >> $@
@echo " <body>" >> $@
@echo " <h1>Redirecting...</h1>" >> $@
@echo " <p>Please follow <a href=\"stable/index.html\">this link</a>.</p>" >> $@
@echo " </body>" >> $@
@echo "</html>" >> $@

all: manual/nixos/index.html


### Non HTML files (images/icons/etc...)

all: $(HTML) favicon.png favicon.ico robots.txt \
$(subst .png,-small.png,$(filter-out %-small.png,$(wildcard images/screenshots/*)))
@@ -141,7 +173,7 @@ favicon.ico: favicon.png
%-small.png: %.png
convert -resize 200 $< $@

%.html: %.tt layout.tt common.tt $(DEMOS) $(NIX_DEV_MANUAL_OUT) learn_guides.html.in
%.html: %.tt layout.tt common.tt
tpage \
--pre_chomp --post_chomp \
--eval_perl \
@@ -156,7 +188,7 @@ favicon.ico: favicon.png
xmllint --nonet --noout $@.tmp
mv $@.tmp $@

%: %.in common.tt $(NIX_DEV_MANUAL_OUT) learn_guides.html.in
%: %.in common.tt
echo $$PATH
tpage \
--define latestNixVersion=$(NIX_STABLE_VERSION) \
@@ -194,45 +226,51 @@ update: blogs.xml
@true
endif

all: styles


### Styles (css/svg/...)


SITE_STYLES_LESS := $(wildcard site-styles/*.less) $(wildcard site-styles/**/*.less)

STYLES = \
styles/fonts/*.ttf \
styles/community.css \
styles/index.css

tmp.svg.less: $(wildcard site-styles/assets/*)
embed-svg site-styles/assets tmp.svg.less

tmp.styles: tmp.svg.less $(wildcard site-styles/*.less)
tmp.styles: tmp.svg.less $(SITE_STYLES_LESS)
rm -rf tmp.styles

mkdir -p tmp.styles
cp -R site-styles/* tmp.styles/
cp -fR site-styles/* tmp.styles/

rm -rf tmp.styles/assets/*
cp tmp.svg.less tmp.styles/assets/svg.less

styles/fonts: $(wildcard site-styles/common-styles/fonts/*)
styles/fonts/%.ttf: $(wildcard site-styles/common-styles/fonts/*)
rm -rf styles/fonts
mkdir -p styles/fonts
cp site-styles/common-styles/fonts/*.ttf styles/fonts

styles/index.css: tmp.styles $(wildcard site-styles/*.less)
styles/community.css: tmp.styles $(SITE_STYLES_LESS)
mkdir -vp styles
lessc --verbose --source-map=styles/index.css.map tmp.styles/index.less styles/index.css

styles/pages/community.css: tmp.styles $(wildcard site-styles/*.less)
mkdir -vp styles/pages
lessc --verbose \
--source-map=styles/pages/community.css.map \
--source-map=styles/community.css.map \
tmp.styles/pages/community.private.less \
styles/pages/community.css;
styles/community.css;

styles: $(wildcard site-styles/*.less) \
tmp.styles \
styles/fonts \
styles/index.css \
styles/pages/community.css
styles/index.css: tmp.styles $(SITE_STYLES_LESS)
mkdir -vp styles
lessc --verbose --source-map=styles/index.css.map tmp.styles/index.less styles/index.css

all: manuals
all: $(STYLES)

manuals:
bash ./scripts/fix-manual-headers.sh manual/nix stable
bash ./scripts/fix-manual-headers.sh manual/nixpkgs stable
bash ./scripts/fix-manual-headers.sh manual/nixos stable


### Asciinema demos

all: $(DEMOS)

2 changes: 1 addition & 1 deletion community.tt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[% WRAPPER atHead %]
<link rel="stylesheet" href="[% root %]styles/pages/community.css" type="text/css" />
<link rel="stylesheet" href="[% root %]styles/community.css" type="text/css" />
[% END %]
[% WRAPPER layout.tt title="Community" handlesLayout=1 %]

21 changes: 6 additions & 15 deletions scripts/fix-manual-headers.sh
Original file line number Diff line number Diff line change
@@ -17,7 +17,6 @@ for path in $dir/*; do
fileName=${htmlFile#"./"}
filePath="$path/$fileName"

echo -n "Patching <head> of $filePath ..."
canonicalFileName="$dir/$canonical/$fileName"
canonicalUrl=$baseUrl
if [ -e $canonicalFileName ]; then
@@ -26,23 +25,17 @@ for path in $dir/*; do
fi
fi
canonicalTag="<link rel=\"canonical\" url=\"$canonicalUrl\" />"
if grep -Fq "$canonicalTag" $filePath; then
echo " Already patched!"
else
if ! grep -Fq "$canonicalTag" $filePath; then
sed -i -e "s|</head>| $canonicalTag\n</head>|" $filePath
echo " Patched!"
echo "Patched <head> of $filePath."
fi

echo -n "Injecting channel switcher for $filePath ..."
injectedTag="<script src=\"/js/manual-version-switch.js\"></script>"
if grep -Fq "$injectedTag" $filePath; then
echo " Already injected!"
else
if ! grep -Fq "$injectedTag" $filePath; then
sed -i -e "s|</body>|\n $injectedTag\n</body>|" $filePath
echo " Injected!"
echo "Injected channel switcher for $filePath."
fi

echo -n "Injecting list of channels in $filePath ..."
injectedTag="data-$project-channels='["
if [[ "$project" == "nix" ]]; then
injectedTag+="{\"channel\":\"unstable\",\"version\":\"$NIX_UNSTABLE_VERSION\"},"
@@ -52,11 +45,9 @@ for path in $dir/*; do
injectedTag+="{\"channel\":\"stable\",\"version\":\"$NIXOS_STABLE_SERIES\"}"
fi
injectedTag+="]'"
if grep -Fq "$injectedTag" $filePath; then
echo " Already injected!"
else
if ! grep -Fq "$injectedTag" $filePath; then
sed -i -e "s|<body|<body $injectedTag|" $filePath
echo " Injected!"
echo "Injected list of channels in $filePath."
fi
fi
done
12 changes: 8 additions & 4 deletions scripts/run.py
Original file line number Diff line number Diff line change
@@ -19,13 +19,15 @@ def main(common_styles):
server = livereload.Server()

paths_to_watch = [
"./*.xml",
"./*.tt",
"./**/*.tt",
"./images/*",
"./js/*",
"./*.tt",
"./*.xml",
"./Makefile",
"./css/*",
"./demos/*.scenario",
"./images/*",
"./js/*",
"./scripts/*",
"./site-styles/*",
"./site-styles/**/*",
"./site-styles/**/**/*",
@@ -37,6 +39,8 @@ def main(common_styles):
for path in paths_to_watch:
server.watch(path, lambda: os.system("make"))

os.system("make")

server.serve(root="./", port=8000)

if __name__ == "__main__":
3 changes: 3 additions & 0 deletions site-styles/pages/main.less
Original file line number Diff line number Diff line change
@@ -45,6 +45,9 @@
}

.blurb {
h1 {
font-size: 320%;
}
p {
font-size: 120%;
line-height: 1.5;