commit 8410a2abb1dc172287ddb8f7f8b2b7eddc7685c1 Author: Danila Fedorin Date: Thu Nov 30 04:36:46 2023 +0000 Initial commit: draft (maybe not working) flake.nix diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..df7ea64 --- /dev/null +++ b/default.nix @@ -0,0 +1,27 @@ +{ mkYarnModules, bergamot-elm }: + +let + # Generate a Nix expression from the yarn.lock file + yarnModules = pkgs.mkYarnModules { + src = ./.; + packageJson = ./package.json; + yarnLock = ./yarn.lock; + }; + +in +pkgs.stdenv.mkDerivation { + name = "web-files"; + + # Use the generated yarnModules + buildInputs = [ yarnModules bergamot-elm ]; + + buildPhase = '' + ''; + + installPhase = '' + mkdir -p $out $out/katex $out/katex-expression $out/bergamot + cp ${yarnModules}/node_modules/katex/dist/katex.min.css $out/katex + cp ${yarnModules}/node_modules/@navsnpm/katex-expression/dist/katex-expression/katex-expression.esm.js $out/katex-expression + cp ${bergamot-elm}/Main.min.js $out/bergamot/bergamot.js + ''; +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..4fb142d --- /dev/null +++ b/flake.nix @@ -0,0 +1,24 @@ +{ + inputs = { + nixpkgs.url = "github:nixos/nixpkgs"; + flake-utils.url = "github:numtide/flake-utils"; + bergamot-elm.url = "git+https://dev.danilafe.com/Everything-I-Know-About-Types/bergamot-elm.git?ref=main"; + }; + + outputs = { self, nixpkgs, flake-utils, bergamot-elm }: + flake-utils.lib.eachDefaultSystem ( + system: + let + pkgs = import nixpkgs { inherit system; }; + web-files = import ./default.nix { + inherit (pkgs) mkYarnModules; + bergamot-elm = bergamot-elm.defaultPackage.${system}; + }; + in + { + packages = { inherit web-files; }; + defaultPackage = web-files; + } + ); +} + diff --git a/package.json b/package.json new file mode 100644 index 0000000..7fee9d3 --- /dev/null +++ b/package.json @@ -0,0 +1,11 @@ +{ + "name": "web-files", + "version": "1.0.0", + "description": "A package to build and provide CSS and JavaScript files my site depends on", + "author": "Danila Fedorin", + "private": true, + "dependencies": { + "@navsnpm/katex-expression": "^1.1.0", + "katex": "^0.16.9" + } +} diff --git a/yarn.lock b/yarn.lock new file mode 100644 index 0000000..3190f33 --- /dev/null +++ b/yarn.lock @@ -0,0 +1,22 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +"@navsnpm/katex-expression@^1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@navsnpm/katex-expression/-/katex-expression-1.1.0.tgz#8be09aa8455c24d23ebf0ceaa00b145a318eec8f" + integrity sha512-KmnMPtJEAVqjpTncAv2yLtCqOIlijmOdVWo2LadON8ZcYx2ww8OpdFF8AitabaRdnmXdI4yLFWI4NHgG8UJLHw== + dependencies: + katex "^0.16.7" + +commander@^8.3.0: + version "8.3.0" + resolved "https://registry.yarnpkg.com/commander/-/commander-8.3.0.tgz#4837ea1b2da67b9c616a67afbb0fafee567bca66" + integrity sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww== + +katex@^0.16.7, katex@^0.16.9: + version "0.16.9" + resolved "https://registry.yarnpkg.com/katex/-/katex-0.16.9.tgz#bc62d8f7abfea6e181250f85a56e4ef292dcb1fa" + integrity sha512-fsSYjWS0EEOwvy81j3vRA8TEAhQhKiqO+FQaKWp0m39qwOzHVBgAUBIXWj1pB+O2W3fIpNa6Y9KSKCVbfPhyAQ== + dependencies: + commander "^8.3.0"