113 lines
		
	
	
	
		
			2.7 KiB
		
	
	
	
		
			Nix
		
	
	
	
	
	
			
		
		
	
	
			113 lines
		
	
	
	
		
			2.7 KiB
		
	
	
	
		
			Nix
		
	
	
	
	
	
{
 | 
						|
  description = "TFC Website";
 | 
						|
 | 
						|
  inputs = {
 | 
						|
    nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
 | 
						|
    flake-utils.url = "github:numtide/flake-utils";
 | 
						|
    rust-overlay.url = "github:oxalica/rust-overlay";
 | 
						|
    naersk.url = "github:nix-community/naersk";
 | 
						|
  };
 | 
						|
 | 
						|
  outputs = inputs: with inputs;
 | 
						|
    flake-utils.lib.eachDefaultSystem
 | 
						|
      (system:
 | 
						|
        let
 | 
						|
          pkgs = nixpkgs.legacyPackages.${system};
 | 
						|
          src = ./.;
 | 
						|
 | 
						|
          naersk' = pkgs.callPackage naersk {};
 | 
						|
 | 
						|
          nbi = with pkgs; [
 | 
						|
            gcc
 | 
						|
            stdenv
 | 
						|
            gnumake
 | 
						|
            gdb
 | 
						|
            pkg-config
 | 
						|
            makeWrapper
 | 
						|
            openssl
 | 
						|
            openssl.out
 | 
						|
            openssl.dev
 | 
						|
          ];
 | 
						|
 | 
						|
          bi = with pkgs; [
 | 
						|
            git
 | 
						|
            clippy
 | 
						|
            rustc
 | 
						|
            cargo
 | 
						|
            rustfmt
 | 
						|
            rust-analyzer
 | 
						|
            just
 | 
						|
            zola
 | 
						|
 | 
						|
            # web lang tweaks
 | 
						|
            tailwindcss_4
 | 
						|
            # postcss-cli
 | 
						|
            uglify-js
 | 
						|
 | 
						|
            openssl
 | 
						|
            openssl.out
 | 
						|
            openssl.dev
 | 
						|
          ];
 | 
						|
 | 
						|
          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
 | 
						|
            #   ls themes
 | 
						|
            #   cp -r ${blowfish} themes/blowfish
 | 
						|
            #   ls themes/blowfish
 | 
						|
            # '';
 | 
						|
            buildPhase = ''
 | 
						|
              ${pkgs.tailwindcss_4}/bin/tailwindcss -i static/css/base.css -o static/css/main.css
 | 
						|
              ${pkgs.zola}/bin/zola build
 | 
						|
            '';
 | 
						|
            installPhase = ''
 | 
						|
              cp -r public $out/
 | 
						|
            '';
 | 
						|
            buildInputs = bi;
 | 
						|
            nativeBuildInputs = nbi;
 | 
						|
          };
 | 
						|
          
 | 
						|
        in 
 | 
						|
        {
 | 
						|
          devShell = pkgs.mkShell {
 | 
						|
            name = "tfc-api";
 | 
						|
            version = "0.0.1";
 | 
						|
            src = src;
 | 
						|
            nativeBuildInputs = nbi;
 | 
						|
            buildInputs = bi;
 | 
						|
            nativeLibs = nativeLibs;
 | 
						|
          };
 | 
						|
          packages.default = naersk'.buildPackage {
 | 
						|
            pname = "tfcapi";
 | 
						|
            version = "0.0.1";
 | 
						|
            src = ./.;
 | 
						|
            cargoBuildFlags = "";
 | 
						|
            doCheck = false;
 | 
						|
 | 
						|
            # cargoLock = {
 | 
						|
            #   lockFile = ./Cargo.lock;
 | 
						|
            # };
 | 
						|
            nativeBuildInputs = nbi;
 | 
						|
            buildInputs = bi;
 | 
						|
            fixupPhase = ''
 | 
						|
              ls -l
 | 
						|
              mkdir -p $out/public
 | 
						|
              ls -l $out
 | 
						|
              cp -r ${site}/* $out/public/
 | 
						|
              ls -l $out
 | 
						|
            '';
 | 
						|
          };
 | 
						|
          packages.site = site;
 | 
						|
        }
 | 
						|
      );
 | 
						|
}
 |