{ description = "TaskLine Fullstack (Backend + Frontend)"; inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; }; outputs = { self, nixpkgs }: let system = "x86_64-linux"; version = "3.4.1"; pnpm = pkgs.pnpm_12; pkgs = import nixpkgs { inherit system; }; mkBackend = { enablePostgres ? false, enableSqlite ? false, }: assert (enablePostgres || enableSqlite) || throw "taskline-backend: At least one database feature must be enabled (set enablePostgres = true or enableSqlite = true)."; pkgs.rustPlatform.buildRustPackage { pname = "taskline-backend"; inherit version; doCheck = false; src = pkgs.lib.fileset.toSource { root = ./.; fileset = pkgs.lib.fileset.unions [ ./api ./cli ./rpi-checker ./libs ./Cargo.toml ./Cargo.lock ]; }; buildAndTestSubdir = "api"; buildNoDefaultFeatures = true; buildFeatures = (pkgs.lib.optional enablePostgres "postgres") ++ (pkgs.lib.optional enableSqlite "sqlite"); cargoHash = "sha256-fHVgFyBhOz6LH+UB/C9I7PLF5CQZiEzOHD4Ms5jIC00="; nativeBuildInputs = [ pkgs.pkg-config ]; buildInputs = [ pkgs.openssl pkgs.cacert ]; }; in { devShells.${system}.default = pkgs.mkShell { packages = [ pkgs.pkg-config pkgs.openssl pkgs.sea-orm-cli pkgs.cargo-nextest ]; }; packages.${system} = { frontend = pkgs.stdenv.mkDerivation (finalAttrs: { pname = "taskline-frontend"; inherit version; src = pkgs.lib.fileset.toSource { root = ./.; fileset = pkgs.lib.fileset.unions [ ./app ./i18n ./public ./server ./.npmrc ./.nuxtrc ./nuxt.config.ts ./package.json ./pnpm-lock.yaml ./pnpm-workspace.yaml ]; }; nativeBuildInputs = [ pkgs.nodejs pkgs.pnpmConfigHook pnpm ]; pnpmDeps = pkgs.fetchPnpmDeps { inherit (finalAttrs) pname version src; inherit pnpm; fetcherVersion = 4; hash = "sha256-eTcmGt/BnOPar7SLRyUYUrgu5J4o4Ly76XoYSZoONL0="; }; buildPhase = '' runHook preBuild export NUXT_TELEMETRY_DISABLED=1 pnpm build runHook postBuild ''; installPhase = '' runHook preInstall mkdir -p $out cp -r .output/* $out/ runHook postInstall ''; }); backend-postgres = mkBackend { enablePostgres = true; enableSqlite = false; }; backend-sqlite = mkBackend { enablePostgres = false; enableSqlite = true; }; }; }; }