Channel | @@ -85,7 +76,70 @@
---|
diff --git a/.gitignore b/.gitignore index c4a847d..42f87a3 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /result +/output/ diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..f481f71 --- /dev/null +++ b/Makefile @@ -0,0 +1,86 @@ +out = output + +default: all + + +# -- HTML and other static stuff (just copy) + +all: \ + $(out)/index.html \ + $(out)/jquery.min.js \ + $(out)/index.js \ + $(out)/netlify.toml + +$(out)/index.html: index.html + mkdir -p $(out) + cp index.html $(out)/index.html + +$(out)/index.js: index.js + mkdir -p $(out) + cp index.js $(out)/index.js + +$(out)/jquery.min.js: jquery.min.js + mkdir -p $(out) + cp jquery.min.js $(out)/jquery.min.js + +$(out)/netlify.toml: netlify.toml + mkdir -p $(out) + cp netlify.toml $(out)/netlify.toml + + +# -- CSS (convert via less) + +STYLES_LESS := $(wildcard styles/*.less) $(wildcard styles/**/*.less) +STYLES_FONTS := $(wildcard styles/common-styles/fonts/*) + +all: \ + $(out)/styles/fonts/*.ttf \ + $(out)/index.css + +$(out)/styles/fonts/%.ttf: $(STYLES_FONTS) + rm -rf $(out)/fonts + mkdir -p $(out)/fonts + cp styles/common-styles/fonts/*.ttf $(out)/fonts + +$(out)/index.css: $(STYLES_LESS) + mkdir -p $(out)/ + lessc \ + --verbose \ + --math=always \ + --source-map=$(out)/index.css.map \ + styles/index.less $(out)/index.css + +# -- Images + +all: \ + $(out)/logo.png \ + $(out)/favicon.png \ + $(out)/favicon.ico \ + $(out)/robots.txt + +$(out)/logo.png: images/logo.png + mkdir -p $(out) + cp images/logo.png $(out)/logo.png + +$(out)/favicon.png: images/nixos-logo-only-hires.png + mkdir -p $(out) + convert \ + -resize 16x16 \ + -background none \ + -gravity center \ + -extent 16x16 \ + images/nixos-logo-only-hires.png $(out)/favicon.png + +$(out)/favicon.ico: $(out)/favicon.png + mkdir -p $(out) + convert \ + -resize x16 \ + -gravity center \ + -crop 16x16+0+0 \ + -flatten -colors 256 \ + -background transparent \ + $(out)/favicon.png $(out)/favicon.ico + +$(out)/robots.txt: $(HTML) + mkdir -p $(out) + echo "User-agent: *" > $(out)/robots.txt diff --git a/flake.lock b/flake.lock index 7003e06..ce19eaa 100644 --- a/flake.lock +++ b/flake.lock @@ -1,12 +1,61 @@ { "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1642700792, + "narHash": "sha256-XqHrk7hFb+zBvRg6Ghl+AZDq03ov6OshJLiSWOoX5es=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "846b2ae0fc4cc943637d3d1def4454213e203cba", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixos-common-styles": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1646208612, + "narHash": "sha256-2u1S2PyWSj8AuhqtOqHwg0zy4cnnTBAS5SwCYkaYUWE=", + "owner": "NixOS", + "repo": "nixos-common-styles", + "rev": "f21154e65385d8d92095f4de44caa5517156bad5", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixos-common-styles", + "type": "github" + } + }, "nixpkgs": { "locked": { - "lastModified": 1606725183, - "narHash": "sha256-QIdgDJUnT/Gq8vURmQqy1tTVpI0cWryoD9/auCAkQbE=", + "lastModified": 1642635915, + "narHash": "sha256-vabPA32j81xBO5m3+qXndWp5aqepe+vu96Wkd9UnngM=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "24eb3f87fc610f18de7076aee7c5a84ac5591e3e", + "rev": "6d8215281b2f87a5af9ed7425a26ac575da0438f", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "ref": "nixos-unstable", + "type": "indirect" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1646159311, + "narHash": "sha256-ILKckkiG074t3a0pwaPLjio8zVWgowpEp7AUwI5HjHE=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "18bd82edcc752d6a0e6cce1401ba0c81353a03ca", "type": "github" }, "original": { @@ -17,7 +66,8 @@ }, "root": { "inputs": { - "nixpkgs": "nixpkgs" + "nixos-common-styles": "nixos-common-styles", + "nixpkgs": "nixpkgs_2" } } }, diff --git a/flake.nix b/flake.nix index 53119f1..d5e1f16 100644 --- a/flake.nix +++ b/flake.nix @@ -1,16 +1,30 @@ { description = "The status.nixos.org website."; - inputs.nixpkgs = { url = "nixpkgs/nixos-unstable"; }; + inputs.nixpkgs.url = "nixpkgs/nixos-unstable"; + inputs.nixos-common-styles.url = "github:NixOS/nixos-common-styles"; outputs = { self , nixpkgs + , nixos-common-styles }: let system = "x86_64-linux"; + pkgs = import nixpkgs { inherit system; }; + mkPyScript = dependencies: name: + let + pythonEnv = pkgs.python3.buildEnv.override { + extraLibs = dependencies; + }; + in + pkgs.writeShellScriptBin name ''exec "${pythonEnv}/bin/python" "${toString ./.}/scripts/${name}.py" "$@"''; + + serve = + mkPyScript (with pkgs.python3Packages; [ click livereload ]) "serve"; + in rec { defaultPackage."${system}" = packages."${system}".status-nixos-org; @@ -18,21 +32,42 @@ checks."${system}".build = defaultPackage."${system}"; packages."${system}".status-nixos-org = pkgs.stdenv.mkDerivation { - name = "nixos-homepage-${self.lastModifiedDate}"; + name = "nixos-status-${self.lastModifiedDate}"; src = self; + preferLocalBuild = true; enableParallelBuilding = true; + buildInputs = with pkgs; [ + imagemagick + nodePackages.less + serve + ]; + + preBuild = '' + rm -f styles/common-styles + ln -s ${nixos-common-styles.packages."${system}".commonStyles} styles/common-styles + ''; + installPhase = '' mkdir $out - cp index.html \ - status.css \ - status.js \ - netlify.toml \ - $out/ + cp -R output/* $out/ ''; - }; + shellHook = '' + rm -f styles/common-styles + ln -s ${nixos-common-styles.packages."${system}".commonStyles} styles/common-styles + echo "" + echo " To start developing run:" + echo " serve" + echo "" + echo " and go to the following URL in your browser:" + echo " https://127.0.0.1:8000/" + echo "" + echo " It will rebuild the website on each change." + echo "" + ''; + }; }; } diff --git a/images/logo.png b/images/logo.png new file mode 100644 index 0000000..54c838e Binary files /dev/null and b/images/logo.png differ diff --git a/images/nixos-logo-only-hires.png b/images/nixos-logo-only-hires.png new file mode 100644 index 0000000..ce0c98c Binary files /dev/null and b/images/nixos-logo-only-hires.png differ diff --git a/index.html b/index.html index 19372e4..8f0a044 100644 --- a/index.html +++ b/index.html @@ -7,72 +7,63 @@ + + + - - - - - - - - - - - + + + + + + + + +
-