Skip to content

Commit

Permalink
feat(pg): add postgresql to templates
Browse files Browse the repository at this point in the history
  • Loading branch information
r17x committed Jun 24, 2023
1 parent 62a8060 commit 217814b
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 53 deletions.
92 changes: 39 additions & 53 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,69 +8,55 @@

outputs = { self, nixpkgs, utils }: {

templates = {
go = {
path = ./go;
description = "Go development environment";
};

node = {
path = ./node;
description = "Nodejs development environment";
};

node14 = {
path = ./node14;
description = "Nodejs (v14) and pnpm (v5) development environment";
};

react-native = {
path = ./react-native;
description = "React Native development environment";
};
};
templates = import ./templates.nix;

} // utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };

inherit (pkgs) mkShell writeScriptBin;

run = pkg: "${pkgs.${pkg}}/bin/${pkg}";

dvt = writeScriptBin "dvt" ''
if [ -z $1 ]; then
echo "no template specified"
exit 1
fi
TEMPLATE=$1
${run "nix"} \
--experimental-features 'nix-command flakes' \
flake init \
--template \
"github:efishery/dvt#''${TEMPLATE}"
'';
dvt = writeScriptBin "dvt"
''
if [ -z $1 ]; then
echo "no template specified"
exit 1
fi
TEMPLATE=$1
${run "nix"} \
--experimental-features 'nix-command flakes' \
flake init \
--template \
"github:efishery/dvt#''${TEMPLATE}"
'';

format = writeScriptBin "format" ''
${run "nixpkgs-fmt"} **/*.nix
'';
format = writeScriptBin "format"
''
${run "nixpkgs-fmt"} **/*.nix
'';

update = writeScriptBin "update" ''
for dir in `ls -d */`; do
(
cd $dir
${run "nix"} flake update # Update flake.lock
${run "nix"} develop $dir # Make sure this work after update
)
done
'';
update = writeScriptBin "update"
''
for dir in `ls -d */`; do
(
cd $dir
${run "nix"} flake update # Update flake.lock
${run "nix"} develop $dir # Make sure this work after update
)
done
'';

test-develop = writeScriptBin "test-develop" ''
for dir in `ls -d */`; do
(
${run "nix"} develop $dir # Make sure this work after update
sleep 0.2
)
done
'';
test-develop = writeScriptBin "test-develop"
''
for dir in `ls -d */`; do
(
${run "nix"} develop $dir # Make sure this work after update
sleep 0.2
)
done
'';
in
{
devShells.default = mkShell { buildInputs = [ format update ]; };
Expand Down
26 changes: 26 additions & 0 deletions templates.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
go = {
path = ./go;
description = "Go development environment";
};

node = {
path = ./node;
description = "Nodejs development environment";
};

node14 = {
path = ./node14;
description = "Nodejs (v14) and pnpm (v5) development environment";
};

react-native = {
path = ./react-native;
description = "React Native development environment";
};

pg = {
path = ./pg;
description = "PostgreSQL development environment";
};
}

0 comments on commit 217814b

Please sign in to comment.