This commit is contained in:
Smaug123
2023-10-01 10:35:01 +01:00
parent 1f3e107106
commit dd3713f40e
2 changed files with 40 additions and 91 deletions

87
flake.lock generated
View File

@@ -25,7 +25,9 @@
"flake-utils": [ "flake-utils": [
"flake-utils" "flake-utils"
], ],
"nixpkgs": "nixpkgs_2", "nixpkgs": [
"nixpkgs"
],
"scripts": "scripts" "scripts": "scripts"
}, },
"locked": { "locked": {
@@ -96,7 +98,9 @@
"flake-utils": [ "flake-utils": [
"flake-utils" "flake-utils"
], ],
"nixpkgs": "nixpkgs_3", "nixpkgs": [
"nixpkgs"
],
"scripts": "scripts_2" "scripts": "scripts_2"
}, },
"locked": { "locked": {
@@ -110,20 +114,27 @@
"type": "path" "type": "path"
} }
}, },
"katex-source": { "katex": {
"flake": false, "inputs": {
"flake-utils": [
"flake-utils"
],
"nixpkgs": [
"nixpkgs"
]
},
"locked": { "locked": {
"lastModified": 1691244098, "lastModified": 1696151934,
"narHash": "sha256-hDHo7JQAo+fGxQvY5OtXlfh+e6PjlVIQPTyCa3Fjg0Y=", "narHash": "sha256-8kihcqdgYjoVuGozfgfcWh81yqMUvns4+C/fgkn+RNQ=",
"owner": "KaTeX", "owner": "Smaug123",
"repo": "KaTeX", "repo": "KaTeX",
"rev": "4f1d9166749ca4bd669381b84b45589f1500a476", "rev": "ac1f9b30441f63ea20216a36ffa7148dc0e9a9b3",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "KaTeX", "owner": "Smaug123",
"ref": "nix",
"repo": "KaTeX", "repo": "KaTeX",
"rev": "4f1d9166749ca4bd669381b84b45589f1500a476",
"type": "github" "type": "github"
} }
}, },
@@ -158,60 +169,14 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs_3": {
"locked": {
"lastModified": 1688392541,
"narHash": "sha256-lHrKvEkCPTUO+7tPfjIcb7Trk6k31rz18vkyqmkeJfY=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "ea4c80b39be4c09702b0cb3b42eab59e2ba4f24b",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-22.11",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_4": {
"locked": {
"lastModified": 1688392541,
"narHash": "sha256-lHrKvEkCPTUO+7tPfjIcb7Trk6k31rz18vkyqmkeJfY=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "ea4c80b39be4c09702b0cb3b42eab59e2ba4f24b",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-22.11",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_5": {
"locked": {
"lastModified": 1688392541,
"narHash": "sha256-lHrKvEkCPTUO+7tPfjIcb7Trk6k31rz18vkyqmkeJfY=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "ea4c80b39be4c09702b0cb3b42eab59e2ba4f24b",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-22.11",
"repo": "nixpkgs",
"type": "github"
}
},
"pdfs": { "pdfs": {
"inputs": { "inputs": {
"flake-utils": [ "flake-utils": [
"flake-utils" "flake-utils"
], ],
"nixpkgs": "nixpkgs_5", "nixpkgs": [
"nixpkgs"
],
"scripts": "scripts_3" "scripts": "scripts_3"
}, },
"locked": { "locked": {
@@ -234,8 +199,8 @@
"extra-content": "extra-content", "extra-content": "extra-content",
"flake-utils": "flake-utils_2", "flake-utils": "flake-utils_2",
"images": "images", "images": "images",
"katex-source": "katex-source", "katex": "katex",
"nixpkgs": "nixpkgs_4", "nixpkgs": "nixpkgs_2",
"pdfs": "pdfs", "pdfs": "pdfs",
"scripts": "scripts_4" "scripts": "scripts_4"
} }

View File

@@ -9,20 +9,24 @@
url = "path:/Users/patrick/Desktop/website/extra-site-content"; url = "path:/Users/patrick/Desktop/website/extra-site-content";
flake = false; flake = false;
}; };
katex-source = { katex = {
url = "github:KaTeX/KaTeX/4f1d9166749ca4bd669381b84b45589f1500a476"; url = "github:Smaug123/KaTeX/nix";
flake = false; inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils";
}; };
images = { images = {
url = "path:/Users/patrick/Desktop/website/static-site-images"; url = "path:/Users/patrick/Desktop/website/static-site-images";
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils"; inputs.flake-utils.follows = "flake-utils";
}; };
pdfs = { pdfs = {
url = "github:Smaug123/static-site-pdfs"; url = "github:Smaug123/static-site-pdfs";
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils"; inputs.flake-utils.follows = "flake-utils";
}; };
anki-decks = { anki-decks = {
url = "github:Smaug123/anki-decks"; url = "github:Smaug123/anki-decks";
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils"; inputs.flake-utils.follows = "flake-utils";
}; };
}; };
@@ -31,7 +35,7 @@
self, self,
nixpkgs, nixpkgs,
flake-utils, flake-utils,
katex-source, katex,
images, images,
pdfs, pdfs,
anki-decks, anki-decks,
@@ -48,36 +52,16 @@
let let
buildHugo = scripts.lib.createShellScript pkgs "hugo" ./docker/hugo/build.sh; buildHugo = scripts.lib.createShellScript pkgs "hugo" ./docker/hugo/build.sh;
in let in let
katex = pkgs.stdenv.mkDerivation { katex-parts = pkgs.stdenv.mkDerivation {
__contentAddressed = true; __contentAddressed = true;
pname = "katex"; pname = "katex";
version = "0.1.0"; version = "0.1.0";
src = katex-source; src = katex.outputs.packages.${system}.default;
buildInputs = [pkgs.nodejs pkgs.yarn];
buildPhase = ''
export HOME=$(mktemp -d)
yarn --immutable
yarn build
'';
installPhase = '' installPhase = ''
mkdir -p "$out/fonts" mkdir "$out"
cp ./fonts/* "$out/fonts" ls -la .
cp -r ./dist "$out/dist" cp -r ./libexec/katex/dist "$out/dist"
'';
};
in let
extraContent = pkgs.stdenv.mkDerivation {
__contentAddressed = true;
pname = "patrickstevens.co.uk-extraContent";
version = "0.1.0";
src = extra-content;
buildInputs = [];
installPhase = ''
mkdir -p $out
cp -r ./. $out
''; '';
}; };
in in
@@ -94,7 +78,7 @@
]; ];
buildPhase = '' buildPhase = ''
${scripts.lib.createShellScript pkgs "all" ./build/all.sh}/run.sh "${pdfs.packages.${system}.default}" "${images}" "${anki-decks.packages.${system}.default}" "${buildHugo}" "${katex}" "${extraContent}" ${scripts.lib.createShellScript pkgs "all" ./build/all.sh}/run.sh "${pdfs.packages.${system}.default}" "${images}" "${anki-decks.packages.${system}.default}" "${buildHugo}" "${katex-parts}" "${extra-content}"
''; '';
checkPhase = '' checkPhase = ''