working nix build

This commit is contained in:
Chris Cochrun 2024-12-06 16:14:02 -06:00
parent 8fc3685200
commit 9038bb05ef
2 changed files with 76 additions and 6 deletions

View file

@ -1,5 +1,22 @@
{
"nodes": {
"blowfish": {
"flake": false,
"locked": {
"lastModified": 1702560004,
"narHash": "sha256-6Ovd1ACYq0/NRsMbQN0Lt8xGbCKJ4EKM7qiU2Y+6pP4=",
"owner": "nunocoracao",
"repo": "blowfish",
"rev": "b6744efbf2d76023084498552a916b49d5a764d8",
"type": "github"
},
"original": {
"owner": "nunocoracao",
"repo": "blowfish",
"rev": "b6744efbf2d76023084498552a916b49d5a764d8",
"type": "github"
}
},
"cl-nix-lite": {
"locked": {
"lastModified": 1720140845,
@ -67,6 +84,7 @@
},
"root": {
"inputs": {
"blowfish": "blowfish",
"cl-nix-lite": "cl-nix-lite",
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs",

View file

@ -6,6 +6,10 @@
flake-utils.url = "github:numtide/flake-utils";
cl-nix-lite.url = "github:hraban/cl-nix-lite";
rust-overlay.url = "github:oxalica/rust-overlay";
blowfish = {
url = "github:nunocoracao/blowfish?rev=b6744efbf2d76023084498552a916b49d5a764d8";
flake = false;
};
};
outputs = inputs: with inputs;
@ -48,6 +52,7 @@
];
bi = with pkgs; [
git
hugo
go
nodejs
@ -63,12 +68,36 @@
openssl.dev
];
blowfish = inputs.blowfish;
nativeLibs = with pkgs; [
openssl
openssl.out
openssl.dev
];
site = pkgs.stdenv.mkDerivation rec {
name = "site";
version = "2.0.0";
src = ./.;
configurePhase = ''
ls
mkdir -p themes
cp -r ${blowfish} themes/blowfish
ls themes/blowfish
'';
buildPhase = ''
NODE_ENV=production ./themes/blowfish/node_modules/tailwindcss/lib/cli.js -c ./themes/blowfish/tailwind.config.js -i ./themes/blowfish/assets/css/main.css -o ./assets/css/compiled/main.css --jit && hugo --gc --minify
${pkgs.hugo}/bin/hugo --minify
'';
installPhase = ''
mkdir -p $out/public
cp -r public $out/public
'';
buildInputs = bi;
nativeBuildInputs = nbi;
};
in
{
devShell = pkgs.mkShell {
@ -78,21 +107,44 @@
nativeBuildInputs = nbi;
buildInputs = bi;
nativeLibs = nativeLibs;
shellHook = ''
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${pkgs.lib.makeLibraryPath nativeLibs}"
'';
};
packages.default = pkgs.rustPlatform.buildRustPackage {
pname = "api";
packages.default = pkgs.rustPlatform.buildRustPackage rec {
pname = "tfcapi";
version = "0.0.1";
src = src;
src = ./.;
cargoBuildFlags = "";
doCheck = false;
cargoLock = {
lockFile = ./Cargo.lock;
};
nativeBuildInputs = nbi;
buildInputs = bi;
fixupPhase = ''
ls -l
ls -l $out
cp -r ${site}/public $out/public
'';
};
packages.site = pkgs.stdenv.mkDerivation rec {
name = "site";
version = "2.0.0";
src = src;
configurePhase = ''
ls
mkdir -p themes
cp -r ${blowfish} themes/blowfish
ls themes/blowfish
'';
buildPhase = ''
NODE_ENV=production ./themes/blowfish/node_modules/tailwindcss/lib/cli.js -c ./themes/blowfish/tailwind.config.js -i ./themes/blowfish/assets/css/main.css -o ./assets/css/compiled/main.css --jit && hugo --gc --minify
${pkgs.hugo}/bin/hugo --minify
'';
installPhase = ''
cp -r public $out
'';
buildInputs = bi;
nativeBuildInputs = nbi;
};
}
);