Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 0 additions & 17 deletions .env.example

This file was deleted.

3 changes: 2 additions & 1 deletion biome.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@
},
"recommended": true
}
}
},
"extends": ["@nedcloarbr/biome-config/react"]
}
95 changes: 84 additions & 11 deletions devenv.nix
Original file line number Diff line number Diff line change
@@ -1,63 +1,136 @@
{ pkgs, lib, config, inputs, ... }:
{
pkgs,
lib,
config,
inputs,
...
}:

{
# https://devenv.sh/basics/
env.GREET = "devenv";
# Rec just means "recursive" and is a special Nix function that allows you to access variables defined in the same scope.
env = {
GREET = "devenv";
DB_PASSWORD = "password";
DB_USER = "postgres";
DB_PORT = 5432;
DB_NAME = "cwrunix";
#DATABASE_URL = "postgresql://${DB_USER}:${DB_PASSWORD}@${DB_CONTAINER_NAME}:${DB_PORT}/${DB_NAME}";
DATABASE_URL =
let
postgres = config.services.postgres;
database = builtins.elemAt (config.services.postgres.initialDatabases) 0;
in
"postgresql://${database.user}:${database.pass}@localhost:${toString postgres.port}/${database.name}";
};

# https://devenv.sh/packages/
packages = [ pkgs.git ];
packages = [
pkgs.git
];

# https://devenv.sh/languages/
languages.javascript.pnpm.enable = true;
languages.javascript = {
enable = true;
pnpm.enable = true;
};
languages.typescript.enable = true;

# Launches on `devenv up`
# https://devenv.sh/processes/
# processes.cargo-watch.exec = "cargo-watch";
processes = {
serve-website = {
exec = "pnpm install && pnpm build && pnpx serve out";
process-compose = {
depends_on.postgres.condition = "process_healthy";
readiness_probe = {
http_get = {
host = "localhost";
scheme = "http";
path = "/";
port = 3000;
};
initial_delay_seconds = 1;
};
};
};
};

# Launches in the background on `devenv up`
# https://devenv.sh/services/
# Does not seem to work :(
#services.postgres.enable = true;

services.postgres = {
enable = true;
listen_addresses = "*"; # Listen on all available network interfaces. This is only for developers, so we are not concerned about database security.
# https://devenv.sh/reference/options/#servicespostgreslisten_addresses
initialDatabases = [
{
name = config.env.DB_NAME;
user = config.env.DB_USER;
pass = config.env.DB_PASSWORD;
}
];
port = config.env.DB_PORT;
};

# Create bash scripts here.
# "Define scripts that can be invoked inside the environment, using all the packages and environment variables."
# https://devenv.sh/scripts/
# Running `hello` will run the script
scripts.hello.exec = ''
echo hello from $GREET
'';

# This is run on `devenv shell`, or if you have direnv enabled, it will run when you `cd` into the directory.
enterShell = ''
hello
git --version
pnpm install
'';

# "Form dependencies between automation code, executed in parallel and written in your favorite language."
# https://devenv.sh/tasks/
# tasks = {
# "myproj:setup".exec = "mytool build";
# "devenv:enterShell".after = [ "myproj:setup" ];
# };

# Runs on `devenv test`. Will run after `devenv up`.
# Runtime tests should go here, commmit tests should go in the git-hooks.
# https://devenv.sh/tests/
# Not working right now
enterTest = ''
echo "Running tests"
git --version | grep --color=auto "${pkgs.git.version}"
pnpm build
'';

# Runs on commit. Prevents commits if the tests fail.
# Pick from builtin and language-specific linters and formatters using git-hooks.nix; https://github.com/cachix/git-hooks.nix?tab=readme-ov-file#hooks
# https://devenv.sh/git-hooks/
git-hooks.hooks = {
# lint shell scripts (need to figure out how to ignore)
#shellcheck.enable = true;
# format code
biome.enable = true;
biome = {
enable = true;
settings = {
configPath = "./biome.jsonc";
};
};
# typecheck
typecheck = {
enable = true;
name = "Typescript typecheck";
entry = "pnpm tsc --noEmit";
pass_filenames = false;
types = [
"ts"
"tsx"
];
};
};

# See full reference at https://devenv.sh/reference/options/

# dotenv integration
dotenv.enable = true;
#dotenv.enable = true;
}
17 changes: 0 additions & 17 deletions next.config.js

This file was deleted.

37 changes: 37 additions & 0 deletions next.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import type { NextConfig } from "next";
// ./src/env.ts
import { env } from "src/env.js";
// See https://github.com/gregrickaby/nextjs-github-pages
const nextConfig: NextConfig = {
typescript: {
ignoreBuildErrors: true,
},
eslint: {
ignoreDuringBuilds: true,
},
/**
* Enable static exports.
*
* @see https://nextjs.org/docs/app/building-your-application/deploying/static-exports
*/
output: "export",

/**
* Set base path. This is the slug of your GitHub repository.
*
* @see https://nextjs.org/docs/app/api-reference/next-config-js/basePath
*/
//basePath: "/nextjs-github-pages",

/**
* Disable server-based image optimization. Next.js does not support
* dynamic features with static exports.
*
* @see https://nextjs.org/docs/app/api-reference/components/image#unoptimized
*/
images: {
unoptimized: true,
},
};

export default nextConfig;
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,12 @@
"postgres": "^3.4.4",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"serve": "^14.2.4",
"zod": "^3.24.2"
},
"devDependencies": {
"@biomejs/biome": "1.9.4",
"@nedcloarbr/biome-config": "1.9.1",
"@tailwindcss/postcss": "^4.0.15",
"@types/node": "^20.14.10",
"@types/react": "^19.0.0",
Expand Down
Loading
Loading