Initial commit: draft (maybe not working) flake.nix

This commit is contained in:
Danila Fedorin 2023-11-30 04:36:46 +00:00
commit 8410a2abb1
4 changed files with 84 additions and 0 deletions

27
default.nix Normal file
View File

@ -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
'';
}

24
flake.nix Normal file
View File

@ -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;
}
);
}

11
package.json Normal file
View File

@ -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"
}
}

22
yarn.lock Normal file
View File

@ -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"