1
1
Fork 0
mirror of https://github.com/the-nix-way/dev-templates synced 2024-05-13 03:16:23 +02:00

Compare commits

...

9 Commits

Author SHA1 Message Date
Luc Perkins d6bccb7908
Streamline scripts again 2024-04-15 17:19:53 -03:00
Luc Perkins 7c3ef7b734
Fix shellcheck issue in check script 2024-04-15 17:15:36 -03:00
Luc Perkins 4a341f857d
Remove building from check script 2024-04-15 17:10:57 -03:00
Luc Perkins d0e18d08b9
Make scripts less janky 2024-04-15 16:52:35 -03:00
Luc Perkins 8f13f3a774
Merge pull request #44 from sstubbs/feature/add-python-venv
feature: add python venv
2024-04-15 16:13:04 -03:00
Stephen Stubbs b89f77d481 feature: add python venv 2024-04-15 20:01:15 +01:00
Luc Perkins 4ced0d9048
Merge pull request #42 from sstubbs/feature/add-jdtls
feature: add jdtls
2024-04-15 15:51:19 -03:00
Stephen Stubbs 9790fbe6da chore: add jdtls to readme 2024-04-15 19:37:27 +01:00
Stephen Stubbs c24a6dc989 feature: add jdtls 2024-04-14 12:58:49 +01:00
5 changed files with 66 additions and 46 deletions

View File

@ -145,6 +145,7 @@ A dev template that's fully customizable.
- [Java] 20.0.1+9
- [Maven] 3.9.2
- [Gradle] 9.0.1
- [jdtls] 1.31.0
### [`kotlin`](./kotlin/)
@ -227,7 +228,6 @@ A dev template that's fully customizable.
- [Python] 3.11.4
- [pip] 23.0.1
- [Virtualenv] 20.19.0
### [`ruby`](./ruby/)
@ -309,6 +309,7 @@ All of the templates have only the root [flake](./flake.nix) as a flake input. T
[haxe]: https://haxe.org/
[iex]: https://hexdocs.pm/iex/IEx.html
[java]: https://java.com
[jdtls]: https://projects.eclipse.org/projects/eclipse.jdt.ls
[jq]: https://jqlang.github.io/jq
[kotlin]: https://kotlinlang.org
[latex]: https://www.latex-project.org/
@ -365,7 +366,6 @@ All of the templates have only the root [flake](./flake.nix) as a flake input. T
[texlive]: https://www.tug.org/texlive/
[tflint]: https://github.com/terraform-linters/tflint
[vault]: https://www.vaultproject.io
[virtualenv]: https://pypi.org/project/virtualenv
[vulnix]: https://github.com/flyingcircusio/vulnix
[yarn]: https://yarnpkg.com
[vlang]: https://vlang.io/

1
empty/.envrc Normal file
View File

@ -0,0 +1 @@
use flake

View File

@ -8,55 +8,70 @@
overlays = [
(final: prev:
let
exec = pkg: "${prev.${pkg}}/bin/${pkg}";
getSystem = "SYSTEM=$(nix eval --impure --raw --expr 'builtins.currentSystem')";
forEachDir = exec: ''
for dir in */; do
(
cd "''${dir}"
${exec}
)
done
'';
in
{
format = prev.writeScriptBin "format" ''
${exec "nixpkgs-fmt"} **/*.nix
'';
format = final.writeShellApplication {
name = "format";
runtimeInputs = with final; [ nixpkgs-fmt ];
text = "nixpkgs-fmt '**/*.nix'";
};
check = prev.writeScriptBin "check" ''
for dir in `ls -d */`; do # Iterate through all the templates
(
cd $dir
# only run this locally, as Actions will run out of disk space
build = final.writeShellApplication {
name = "build";
text = ''
${getSystem}
nix flake check --all-systems --no-build
)
done
'';
${forEachDir ''
echo "building ''${dir}"
nix build ".#devShells.''${SYSTEM}.default"
''}
'';
};
dvt = prev.writeScriptBin "dvt" ''
if [ -z $1 ]; then
echo "no template specified"
exit 1
fi
check = final.writeShellApplication {
name = "check";
text = forEachDir ''
echo "checking ''${dir}"
nix flake check --all-systems --no-build
'';
};
TEMPLATE=$1
dvt = final.writeShellApplication {
name = "dvt";
text = ''
if [ -z $1 ]; then
echo "no template specified"
exit 1
fi
${exec "nix"} \
--experimental-features 'nix-command flakes' \
flake init \
--template \
"github:the-nix-way/dev-templates#''${TEMPLATE}"
'';
TEMPLATE=$1
update = prev.writeScriptBin "update" ''
for dir in `ls -d */`; do # Iterate through all the templates
(
cd $dir
nix \
--experimental-features 'nix-command flakes' \
flake init \
--template \
"github:the-nix-way/dev-templates#''${TEMPLATE}"
'';
};
echo "updating ''${dir}"
# Update flake.lock
nix flake update
echo "checking ''${dir}"
# Make sure things work after the update
nix flake check --all-systems --no-build
)
done
'';
update = final.writeShellApplication {
name = "update";
text = forEachDir ''
echo "updating ''${dir}"
nix flake update
'';
};
})
];
supportedSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
@ -67,7 +82,7 @@
{
devShells = forEachSupportedSystem ({ pkgs }: {
default = pkgs.mkShell {
packages = with pkgs; [ check format update ];
packages = with pkgs; [ build check format update ];
};
});

View File

@ -21,7 +21,7 @@
{
devShells = forEachSupportedSystem ({ pkgs }: {
default = pkgs.mkShell {
packages = with pkgs; [ gradle jdk maven ];
packages = with pkgs; [ gradle jdk maven jdt-language-server ];
};
});
};

View File

@ -13,8 +13,12 @@
{
devShells = forEachSupportedSystem ({ pkgs }: {
default = pkgs.mkShell {
packages = with pkgs; [ python311 virtualenv ] ++
(with pkgs.python311Packages; [ pip ]);
venvDir = "venv";
packages = with pkgs; [ python311 ] ++
(with pkgs.python311Packages; [
pip
venvShellHook
]);
};
});
};