mirror of
https://github.com/youwen5/blog.git
synced 2025-02-21 18:01:10 -08:00
feat: overhaul nix build infrastructure
This commit is contained in:
parent
6740bf6fac
commit
261a8763fb
5 changed files with 2463 additions and 37 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -7,3 +7,4 @@ dist
|
||||||
dist-newstyle
|
dist-newstyle
|
||||||
result
|
result
|
||||||
.direnv
|
.direnv
|
||||||
|
node_modules
|
||||||
|
|
12
flake.lock
12
flake.lock
|
@ -5,11 +5,11 @@
|
||||||
"systems": "systems"
|
"systems": "systems"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1705309234,
|
"lastModified": 1731533236,
|
||||||
"narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=",
|
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
|
||||||
"owner": "numtide",
|
"owner": "numtide",
|
||||||
"repo": "flake-utils",
|
"repo": "flake-utils",
|
||||||
"rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26",
|
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -20,11 +20,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1738824222,
|
"lastModified": 1739446958,
|
||||||
"narHash": "sha256-U3SNq+waitGIotmgg/Et3J7o4NvUtP2gb2VhME5QXiw=",
|
"narHash": "sha256-+/bYK3DbPxMIvSL4zArkMX0LQvS7rzBKXnDXLfKyRVc=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "550e11f27ba790351d390d9eca3b80ad0f0254e7",
|
"rev": "2ff53fe64443980e139eaa286017f53f88336dd0",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
36
flake.nix
36
flake.nix
|
@ -17,21 +17,20 @@
|
||||||
|
|
||||||
nodejs = pkgs.nodejs;
|
nodejs = pkgs.nodejs;
|
||||||
|
|
||||||
nodeDeps = (pkgs.callPackage ./nix { inherit pkgs nodejs system; }).nodeDependencies;
|
|
||||||
|
|
||||||
hakyll-site = pkgs.haskellPackages.callCabal2nix "hakyll-site" ./ssg { };
|
hakyll-site = pkgs.haskellPackages.callCabal2nix "hakyll-site" ./ssg { };
|
||||||
|
|
||||||
|
nodeDeps = pkgs.importNpmLock.buildNodeModules {
|
||||||
|
inherit nodejs;
|
||||||
|
npmRoot = ./.;
|
||||||
|
};
|
||||||
|
|
||||||
website = pkgs.stdenv.mkDerivation {
|
website = pkgs.stdenv.mkDerivation {
|
||||||
name = "website";
|
pname = "website";
|
||||||
nativeBuildInputs = [
|
version = "0.1.0";
|
||||||
nodejs
|
|
||||||
pkgs.nodePackages.rollup
|
src = ./.;
|
||||||
];
|
|
||||||
src = pkgs.nix-gitignore.gitignoreSourcePure [
|
nativeBuildInputs = [ pkgs.nodePackages.npm ];
|
||||||
./.gitignore
|
|
||||||
".git"
|
|
||||||
".github"
|
|
||||||
] ./.;
|
|
||||||
|
|
||||||
# LANG and LOCALE_ARCHIVE are fixes pulled from the community:
|
# LANG and LOCALE_ARCHIVE are fixes pulled from the community:
|
||||||
# https://github.com/jaspervdj/hakyll/issues/614#issuecomment-411520691
|
# https://github.com/jaspervdj/hakyll/issues/614#issuecomment-411520691
|
||||||
|
@ -43,14 +42,10 @@
|
||||||
) "${pkgs.glibcLocales}/lib/locale/locale-archive";
|
) "${pkgs.glibcLocales}/lib/locale/locale-archive";
|
||||||
|
|
||||||
buildPhase = ''
|
buildPhase = ''
|
||||||
# remove the node_modules symlink
|
ln -s ${nodeDeps}/node_modules node_modules
|
||||||
rm -rf node_modules
|
|
||||||
|
|
||||||
${self.packages.${system}.hakyll-site}/bin/hakyll-site build
|
${self.packages.${system}.hakyll-site}/bin/hakyll-site build
|
||||||
ln -s ${nodeDeps}/lib/node_modules ./node_modules
|
|
||||||
|
|
||||||
export PATH="${nodeDeps}/bin:$PATH"
|
npm run build
|
||||||
rollup -c
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
|
@ -79,12 +74,17 @@
|
||||||
self.packages.${system}.hakyll-site
|
self.packages.${system}.hakyll-site
|
||||||
];
|
];
|
||||||
|
|
||||||
|
npmDeps = nodeDeps;
|
||||||
|
|
||||||
withHoogle = true;
|
withHoogle = true;
|
||||||
|
|
||||||
nativeBuildInputs = with pkgs; [
|
nativeBuildInputs = with pkgs; [
|
||||||
cabal-install
|
cabal-install
|
||||||
haskellPackages.cabal-gild
|
haskellPackages.cabal-gild
|
||||||
haskellPackages.haskell-language-server
|
haskellPackages.haskell-language-server
|
||||||
|
pkgs.importNpmLock.hooks.linkNodeModulesHook
|
||||||
|
nodejs
|
||||||
|
pkgs.nodePackages.npm
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
2438
package-lock.json
generated
2438
package-lock.json
generated
File diff suppressed because it is too large
Load diff
13
package.json
13
package.json
|
@ -3,22 +3,21 @@
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {},
|
||||||
"test": "echo \"Error: no test specified\" && exit 1",
|
|
||||||
"build": "rollup -c",
|
|
||||||
"watch": "rollup -c -w"
|
|
||||||
},
|
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
"author": "",
|
"author": "",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
|
"scripts": {
|
||||||
|
"build": "rollup -c"
|
||||||
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@rollup/plugin-terser": "^0.4.4",
|
"@rollup/plugin-terser": "^0.4.4",
|
||||||
"@rollup/rollup-linux-arm64-gnu": "^4.34.6",
|
|
||||||
"@tailwindcss/typography": "^0.5.13",
|
"@tailwindcss/typography": "^0.5.13",
|
||||||
"autoprefixer": "^10.4.19",
|
"autoprefixer": "^10.4.19",
|
||||||
"postcss": "^8.4.38",
|
"postcss": "^8.4.38",
|
||||||
"postcss-minify": "^1.1.0",
|
"postcss-minify": "^1.1.0",
|
||||||
"rollup-plugin-postcss": "^4.0.2",
|
"rollup-plugin-postcss": "^4.0.2",
|
||||||
"tailwindcss": "^3.4.3"
|
"tailwindcss": "^3.4.3",
|
||||||
|
"rollup": "^4.34.7"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue