feat: overhaul nix build infrastructure

This commit is contained in:
Youwen Wu 2025-02-15 13:14:22 -08:00
parent 6740bf6fac
commit 261a8763fb
Signed by: youwen5
GPG key ID: 865658ED1FE61EC3
5 changed files with 2463 additions and 37 deletions

1
.gitignore vendored
View file

@ -7,3 +7,4 @@ dist
dist-newstyle
result
.direnv
node_modules

View file

@ -5,11 +5,11 @@
"systems": "systems"
},
"locked": {
"lastModified": 1705309234,
"narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=",
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
@ -20,11 +20,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1738824222,
"narHash": "sha256-U3SNq+waitGIotmgg/Et3J7o4NvUtP2gb2VhME5QXiw=",
"lastModified": 1739446958,
"narHash": "sha256-+/bYK3DbPxMIvSL4zArkMX0LQvS7rzBKXnDXLfKyRVc=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "550e11f27ba790351d390d9eca3b80ad0f0254e7",
"rev": "2ff53fe64443980e139eaa286017f53f88336dd0",
"type": "github"
},
"original": {

View file

@ -17,21 +17,20 @@
nodejs = pkgs.nodejs;
nodeDeps = (pkgs.callPackage ./nix { inherit pkgs nodejs system; }).nodeDependencies;
hakyll-site = pkgs.haskellPackages.callCabal2nix "hakyll-site" ./ssg { };
nodeDeps = pkgs.importNpmLock.buildNodeModules {
inherit nodejs;
npmRoot = ./.;
};
website = pkgs.stdenv.mkDerivation {
name = "website";
nativeBuildInputs = [
nodejs
pkgs.nodePackages.rollup
];
src = pkgs.nix-gitignore.gitignoreSourcePure [
./.gitignore
".git"
".github"
] ./.;
pname = "website";
version = "0.1.0";
src = ./.;
nativeBuildInputs = [ pkgs.nodePackages.npm ];
# LANG and LOCALE_ARCHIVE are fixes pulled from the community:
# https://github.com/jaspervdj/hakyll/issues/614#issuecomment-411520691
@ -43,14 +42,10 @@
) "${pkgs.glibcLocales}/lib/locale/locale-archive";
buildPhase = ''
# remove the node_modules symlink
rm -rf node_modules
ln -s ${nodeDeps}/node_modules node_modules
${self.packages.${system}.hakyll-site}/bin/hakyll-site build
ln -s ${nodeDeps}/lib/node_modules ./node_modules
export PATH="${nodeDeps}/bin:$PATH"
rollup -c
npm run build
'';
installPhase = ''
@ -79,12 +74,17 @@
self.packages.${system}.hakyll-site
];
npmDeps = nodeDeps;
withHoogle = true;
nativeBuildInputs = with pkgs; [
cabal-install
haskellPackages.cabal-gild
haskellPackages.haskell-language-server
pkgs.importNpmLock.hooks.linkNodeModulesHook
nodejs
pkgs.nodePackages.npm
];
};

2438
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -3,22 +3,21 @@
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "rollup -c",
"watch": "rollup -c -w"
},
"scripts": {},
"keywords": [],
"author": "",
"license": "ISC",
"scripts": {
"build": "rollup -c"
},
"devDependencies": {
"@rollup/plugin-terser": "^0.4.4",
"@rollup/rollup-linux-arm64-gnu": "^4.34.6",
"@tailwindcss/typography": "^0.5.13",
"autoprefixer": "^10.4.19",
"postcss": "^8.4.38",
"postcss-minify": "^1.1.0",
"rollup-plugin-postcss": "^4.0.2",
"tailwindcss": "^3.4.3"
"tailwindcss": "^3.4.3",
"rollup": "^4.34.7"
}
}