Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add WordPress template #6

Open
wants to merge 26 commits into
base: main
Choose a base branch
from
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
34 changes: 5 additions & 29 deletions flutter-create/dev.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@
pkgs.nodePackages.firebase-tools
pkgs.jdk17
pkgs.unzip
pkgs.flutter
];
# Sets environment variables in the workspace
env = {};
env = {
PATH = ["/home/user/.pub-cache/bin" "/home/user/flutter/bin" "./.flutter-sdk/flutter/bin"];
};
idx = {
# Search for the extensions you want on https://open-vsx.org/ and use "publisher.id"
extensions = [
Expand All @@ -22,32 +23,7 @@
# Runs when a workspace is first created with this `dev.nix` file
onCreate = {
installDependencies = "flutter pub get";
build-flutter = ''
cd /home/user/myapp/android

./gradlew \
--parallel \
-Pverbose=true \
-Ptarget-platform=android-x86 \
-Ptarget=/home/user/myapp/lib/main.dart \
-Pbase-application-name=android.app.Application \
-Pdart-defines=RkxVVFRFUl9XRUJfQ0FOVkFTS0lUX1VSTD1odHRwczovL3d3dy5nc3RhdGljLmNvbS9mbHV0dGVyLWNhbnZhc2tpdC85NzU1MDkwN2I3MGY0ZjNiMzI4YjZjMTYwMGRmMjFmYWMxYTE4ODlhLw== \
-Pdart-obfuscation=false \
-Ptrack-widget-creation=true \
-Ptree-shake-icons=false \
-Pfilesystem-scheme=org-dartlang-root \
assembleDebug

# TODO: Execute web build in debug mode.
# flutter run does this transparently either way
# https://github.com/flutter/flutter/issues/96283#issuecomment-1144750411
# flutter build web --profile --dart-define=Dart2jsOptimization=O0

adb -s localhost:5555 wait-for-device
'';
};

# To run something each time the workspace is (re)started, use the `onStart` hook
};
# Enable previews and customize configuration
previews = {
Expand All @@ -58,10 +34,10 @@
manager = "flutter";
};
android = {
command = ["flutter" "run" "--machine" "-d" "android" "-d" "localhost:5555"];
command = ["flutter" "run" "--machine" "-d" "android" "-d" "emulator-5554"];
manager = "flutter";
};
};
};
};
}
}
1,928 changes: 963 additions & 965 deletions flutter-create/idx-template.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions flutter-create/idx-template.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@
mkdir "$out"/.idx
cp ${./dev.nix} "$out"/.idx/dev.nix
install --mode u+rw ${./dev.nix} "$out"/.idx/dev.nix
chmod -R u+w "$out"
'';
}
9 changes: 9 additions & 0 deletions wordpress/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# WordPress

https://wordpress.org/

The open source publishing platform of choice for millions of websites worldwide—from creators and small businesses to enterprises.

<a href="https://idx.google.com/new?template=https://github.com/project-idx/community-templates/tree/main/wordpress">
<img height="32" alt="Try in IDX" src="https://cdn.idx.dev/btn/try_dark_32.svg">
</a>
40 changes: 40 additions & 0 deletions wordpress/dev.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# To learn more about how to use Nix to configure your environment
# see: https://developers.google.com/idx/guides/customize-idx-env
{ config, lib, pkgs, ... }: {
# Which nixpkgs channel to use.
channel = "stable-23.11"; # or "unstable"
# Use https://search.nixos.org/packages to find packages
packages = [
pkgs.wordpress
pkgs.sqlite
pkgs.git
pkgs.wp-cli
];

# Sets environment variables in the workspace
env = {
WORDPRESS_DB_NAME = "wordpress";
WORDPRESS_DB_USER = "example username";
WORDPRESS_DB_PASSWORD = "example password";
};

services = { };

idx = {
# Search for the extensions you want on https://open-vsx.org/ and use "publisher.id"
extensions = [
# "vscodevim.vim"
];
# Workspace lifecycle hooks
workspace = {
# Runs when a workspace is first created
onCreate = {
default.openFiles = [ ".idx/dev.nix" "README.md" ];
};
# Runs when the workspace is (re)started
onStart = {
# start-server = "wp server --port=$PORT --host=0.0.0.0";
};
};
};
}
13 changes: 13 additions & 0 deletions wordpress/dev/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# WordPress

The open source publishing platform of choice for millions of websites worldwide—from creators and small businesses to enterprises.

## Getting Started

Open up the terminal and run the following command:

```bash
wp server --port=$PORT --host=0.0.0.0
```

Next click on the url in the terminal console to open up the url in another tab and you should see the wordpress setup page.
Loading