Skip to content

Commit

Permalink
Merge pull request #4 from planetary-social/deploy
Browse files Browse the repository at this point in the history
Dev environment and image building workflow
  • Loading branch information
cooldracula committed Mar 7, 2024
2 parents 3a42fbe + 3d252aa commit 1d20ba3
Show file tree
Hide file tree
Showing 6 changed files with 185 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ node_modules/
.env
.env.local
.env.test
.envrc
.direnv
.data

logs/
*.log
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:16-alpine
FROM node:18-alpine

RUN npm install -g pnpm

Expand Down
31 changes: 31 additions & 0 deletions flake-modules/devshell.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{ inputs, ... }: {
imports = [
inputs.devshell.flakeModule
];

perSystem = { config,pkgs, ...}: {
devshells.default = {
name = "nip05api-devshell";
env = [
{name = "NODE_ENV"; value = "development";}
{name = "AUTH_PUBKEY"; value = "6c815df9b3e7f43492c232aba075b5fa5b6a60b731ce6ccfc7c1e8bd2adcceb2";}
{name = "ROOT_DOMAIN"; value = "nos.social";}
{name = "REDIS_HOST"; value = "localhost";}
];
commands = [
{
name = "tt";
help = "runs test suite in test environment";
category = "app commands";
command = ''NODE_ENV=test pnpm test'';
}
{ package = config.packages.nodejs; category = "packages"; }
{ package = config.packages.pnpm; category = "packages"; }
{ package = pkgs.redis; category = "packages"; }
];
serviceGroups.redis = {
services.redis.command = "redis-server --loglevel notice";
};
};
};
}
6 changes: 6 additions & 0 deletions flake-modules/packages.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
perSystem = { pkgs, system, ... }: {
packages.nodejs = pkgs.nodejs_18;
packages.pnpm = pkgs.nodePackages.pnpm;
};
}
117 changes: 117 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
inputs = {
nixpkgs.url = "nixpkgs";
flake-parts = {
url = "github:hercules-ci/flake-parts";
inputs.nixpkgs-lib.follows = "nixpkgs";
};
devshell = {
url = "github:numtide/devshell";
inputs.nixpkgs.follows = "nixpkgs";
};
};

outputs = inputs@{self, nixpkgs, flake-parts, devshell, process-compose }:
flake-parts.lib.mkFlake { inherit inputs; } {
systems = [
"x86_64-linux"
"aarch64-linux"
"aarch64-darwin"
"x86_64-darwin"
];
imports = [
./flake-modules/packages.nix
./flake-modules/devshell.nix
];
};
}

0 comments on commit 1d20ba3

Please sign in to comment.