1
1
mirror of https://github.com/the-nix-way/dev-templates synced 2024-09-27 10:40:41 +02:00

Compare commits

...

26 Commits

Author SHA1 Message Date
Joel Benway
59bd19bde9
Merge a4a1c802c4 into d6bccb7908 2024-04-16 05:27:05 +00:00
Joel Benway
a4a1c802c4
Merge branch 'main' into add-c-cpp 2024-04-16 00:26:50 -05:00
Joel Benway
c6e0ffd175
Add C/C++ development flake with some sane defaults. 2024-04-16 00:24:38 -05:00
Stephen Stubbs
aa6ef95e28
feature: add python venv 2024-04-16 00:20:27 -05:00
Joel Benway
cf5b99113e
Add C/C++ development flake with some sane defaults. 2024-04-15 20:47:00 -05:00
Joel Benway
17e4a2c6fa
Add C/C++ development flake with some sane defaults. 2024-04-15 20:36:01 -05:00
Luc Perkins
a35fa248d8
Streamline scripts again 2024-04-15 20:30:22 -05:00
Luc Perkins
5ba1e69d91
Fix shellcheck issue in check script 2024-04-15 20:30:22 -05:00
Luc Perkins
4341d055be
Remove building from check script 2024-04-15 20:30:22 -05:00
Luc Perkins
080456aa69
Make scripts less janky 2024-04-15 20:30:22 -05:00
Stephen Stubbs
4314fb5858
feature: add python venv 2024-04-15 20:30:18 -05:00
Stephen Stubbs
1df4dff2e7
chore: add jdtls to readme 2024-04-15 20:28:53 -05:00
Stephen Stubbs
58d35c7e7b
feature: add jdtls 2024-04-15 20:28:53 -05:00
Luc Perkins
2d373613e6
Add check action 2024-04-15 20:28:53 -05:00
Luc Perkins
9934d2686a
Add empty template and make various updates 2024-04-15 20:28:53 -05:00
Vieta
19a9d6c42e
Update README.md 2024-04-15 20:28:52 -05:00
vieta
f1fcc3258a
vlang 2024-04-15 20:28:52 -05:00
Joel Benway
87c19f735d
gdb in nixpkgs does not currently support arm64 darwin systems so this package is now conditional. 2024-04-15 20:07:59 -05:00
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
Joel Benway
173d09515b
Provide C and C++ links in README 2024-03-23 22:02:03 -05:00
Joel Benway
5033b5dc12
Add C/C++ development flake with some sane defaults. 2024-03-22 16:02:20 -05:00
7 changed files with 160 additions and 45 deletions

View File

@ -29,6 +29,7 @@ Once your preferred template has been initialized, you can use the provided shel
| Language/framework/tool | Template | | Language/framework/tool | Template |
| :----------------------- | :---------------------------- | | :----------------------- | :---------------------------- |
| [C]/[C++] | [`c-cpp`](./c-cpp/) |
| [Clojure] | [`clojure`](./clojure/) | | [Clojure] | [`clojure`](./clojure/) |
| [C#][csharp] | [`csharp`](./csharp/) | | [C#][csharp] | [`csharp`](./csharp/) |
| [Cue] | [`cue`](./cue/) | | [Cue] | [`cue`](./cue/) |
@ -64,6 +65,20 @@ Once your preferred template has been initialized, you can use the provided shel
The sections below list what each template includes. In all cases, you're free to add and remove packages as you see fit; the templates are just boilerplate. The sections below list what each template includes. In all cases, you're free to add and remove packages as you see fit; the templates are just boilerplate.
### [`c-cpp`](./c-cpp/)
- [clang-tools] 17.0.6
- [cmake] 3.28.3
- [codespell] 2.2.6
- [conan] 2.0.17
- [cppcheck] 2.13.4
- [doxygen] 1.10.0
- [gdb] 14.1
- [gtest] 1.12.1
- [lcov] 1.0
- [vcpkg]
- [vcpkg-tool]
### [`clojure`](./clojure/) ### [`clojure`](./clojure/)
- [Clojure] 1.11.1.1347 - [Clojure] 1.11.1.1347
@ -228,7 +243,6 @@ A dev template that's fully customizable.
- [Python] 3.11.4 - [Python] 3.11.4
- [pip] 23.0.1 - [pip] 23.0.1
- [Virtualenv] 20.19.0
### [`ruby`](./ruby/) ### [`ruby`](./ruby/)
@ -269,15 +283,22 @@ All of the templates have only the root [flake](./flake.nix) as a flake input. T
[boot]: https://www.boot-clj.com [boot]: https://www.boot-clj.com
[buf]: https://github.com/bufbuild/buf [buf]: https://github.com/bufbuild/buf
[C]: https://www.open-std.org/jtc1/sc22/wg14
[C++]: https://isocpp.org
[cabal]: https://www.haskell.org/cabal [cabal]: https://www.haskell.org/cabal
[cachix]: https://www.cachix.org [cachix]: https://www.cachix.org
[cargo]: https://doc.rust-lang.org/cargo [cargo]: https://doc.rust-lang.org/cargo
[cargo-audit]: https://crates.io/crates/cargo-audit [cargo-audit]: https://crates.io/crates/cargo-audit
[cargo-deny]: https://crates.io/crates/cargo-deny [cargo-deny]: https://crates.io/crates/cargo-deny
[clang-tools]: https://clang.llvm.org/
[clippy]: https://github.com/rust-lang/rust-clippy [clippy]: https://github.com/rust-lang/rust-clippy
[clojure]: https://clojure.org [clojure]: https://clojure.org
[cmake]: https://cmake.org/
[codespell]: https://github.com/codespell-project/codespell
[composer]: https://getcomposer.org/ [composer]: https://getcomposer.org/
[conan]: https://conan.io/
[conftest]: https://www.conftest.dev [conftest]: https://www.conftest.dev
[cppcheck]: http://cppcheck.sourceforge.net/
[csharp]: https://dotnet.microsoft.com/en-us/languages/csharp [csharp]: https://dotnet.microsoft.com/en-us/languages/csharp
[cue]: https://cuelang.org [cue]: https://cuelang.org
[damon]: https://github.com/hashicorp/damon [damon]: https://github.com/hashicorp/damon
@ -293,11 +314,13 @@ All of the templates have only the root [flake](./flake.nix) as a flake input. T
[dhall-toml]: https://github.com/dhall-lang/dhall-haskell/tree/master/dhall-toml [dhall-toml]: https://github.com/dhall-lang/dhall-haskell/tree/master/dhall-toml
[dhall-yaml]: https://github.com/dhall-lang/dhall-haskell/tree/master/dhall-yaml [dhall-yaml]: https://github.com/dhall-lang/dhall-haskell/tree/master/dhall-yaml
[dotnet]: https://dotnet.microsoft.com/en-us/ [dotnet]: https://dotnet.microsoft.com/en-us/
[doxygen]: https://www.doxygen.nl/
[dune]: https://dune.build [dune]: https://dune.build
[elixir]: https://elixir-lang.org [elixir]: https://elixir-lang.org
[elm]: https://elm-lang.org [elm]: https://elm-lang.org
[elm2nix]: https://github.com/cachix/elm2nix [elm2nix]: https://github.com/cachix/elm2nix
[flake-utils]: https://github.com/numtide/flake-utils [flake-utils]: https://github.com/numtide/flake-utils
[gdb]: https://www.gnu.org/software/gdb/
[gigalixir]: https://www.gigalixir.com [gigalixir]: https://www.gigalixir.com
[gleam]: https://gleam.run [gleam]: https://gleam.run
[go]: https://go.dev [go]: https://go.dev
@ -305,6 +328,7 @@ All of the templates have only the root [flake](./flake.nix) as a flake input. T
[goimports]: https://pkg.go.dev/golang.org/x/tools/cmd/goimports [goimports]: https://pkg.go.dev/golang.org/x/tools/cmd/goimports
[golangci-lint]: https://github.com/golangci/golangci-lint [golangci-lint]: https://github.com/golangci/golangci-lint
[gradle]: https://gradle.org [gradle]: https://gradle.org
[gtest]: https://github.com/google/googletest
[hashicorp]: https://hashicorp.com [hashicorp]: https://hashicorp.com
[haskell]: https://haskell.org [haskell]: https://haskell.org
[haxe]: https://haxe.org/ [haxe]: https://haxe.org/
@ -314,6 +338,7 @@ All of the templates have only the root [flake](./flake.nix) as a flake input. T
[jq]: https://jqlang.github.io/jq [jq]: https://jqlang.github.io/jq
[kotlin]: https://kotlinlang.org [kotlin]: https://kotlinlang.org
[latex]: https://www.latex-project.org/ [latex]: https://www.latex-project.org/
[lcov]: https://ltp.sourceforge.net/coverage/lcov.php
[leiningen]: https://leiningen.org [leiningen]: https://leiningen.org
[levant]: https://github.com/hashicorp/levant [levant]: https://github.com/hashicorp/levant
[lorri]: https://github.com/target/lorri [lorri]: https://github.com/target/lorri
@ -367,7 +392,8 @@ All of the templates have only the root [flake](./flake.nix) as a flake input. T
[texlive]: https://www.tug.org/texlive/ [texlive]: https://www.tug.org/texlive/
[tflint]: https://github.com/terraform-linters/tflint [tflint]: https://github.com/terraform-linters/tflint
[vault]: https://www.vaultproject.io [vault]: https://www.vaultproject.io
[virtualenv]: https://pypi.org/project/virtualenv [vcpkg]: https://vcpkg.io/
[vcpkg-tool]: https://github.com/microsoft/vcpkg-tool
[vulnix]: https://github.com/flyingcircusio/vulnix [vulnix]: https://github.com/flyingcircusio/vulnix
[yarn]: https://yarnpkg.com [yarn]: https://yarnpkg.com
[vlang]: https://vlang.io/ [vlang]: https://vlang.io/

1
c-cpp/.envrc Normal file
View File

@ -0,0 +1 @@
use flake

25
c-cpp/flake.lock Normal file
View File

@ -0,0 +1,25 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1711001935,
"narHash": "sha256-URtGpHue7HHZK0mrHnSf8wJ6OmMKYSsoLmJybrOLFSQ=",
"rev": "20f77aa09916374aa3141cbc605c955626762c9a",
"revCount": 600876,
"type": "tarball",
"url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.1.600876%2Brev-20f77aa09916374aa3141cbc605c955626762c9a/018e65e3-9c1d-74a8-acde-67868b074670/source.tar.gz"
},
"original": {
"type": "tarball",
"url": "https://flakehub.com/f/NixOS/nixpkgs/0.1.%2A.tar.gz"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

36
c-cpp/flake.nix Normal file
View File

@ -0,0 +1,36 @@
{
description = "A Nix-flake-based C/C++ development environment";
inputs.nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1.*.tar.gz";
outputs = { self, nixpkgs }:
let
supportedSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f {
pkgs = import nixpkgs { inherit system; };
});
in
{
devShells = forEachSupportedSystem ({ pkgs }: {
default = pkgs.mkShell.override {
# Override stdenv in order to change compiler:
# stdenv = pkgs.clangStdenv;
}
{
packages = with pkgs; [
clang-tools
cmake
codespell
conan
cppcheck
doxygen
gtest
lcov
vcpkg
vcpkg-tool
] ++ (if system == "aarch64-darwin" then [ ] else [ gdb ]);
};
});
};
}

1
empty/.envrc Normal file
View File

@ -0,0 +1 @@
use flake

104
flake.nix
View File

@ -8,55 +8,70 @@
overlays = [ overlays = [
(final: prev: (final: prev:
let 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 in
{ {
format = prev.writeScriptBin "format" '' format = final.writeShellApplication {
${exec "nixpkgs-fmt"} **/*.nix name = "format";
''; runtimeInputs = with final; [ nixpkgs-fmt ];
text = "nixpkgs-fmt '**/*.nix'";
};
check = prev.writeScriptBin "check" '' # only run this locally, as Actions will run out of disk space
for dir in `ls -d */`; do # Iterate through all the templates build = final.writeShellApplication {
( name = "build";
cd $dir text = ''
${getSystem}
nix flake check --all-systems --no-build ${forEachDir ''
) echo "building ''${dir}"
done nix build ".#devShells.''${SYSTEM}.default"
''; ''}
'';
};
dvt = prev.writeScriptBin "dvt" '' check = final.writeShellApplication {
if [ -z $1 ]; then name = "check";
echo "no template specified" text = forEachDir ''
exit 1 echo "checking ''${dir}"
fi 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"} \ TEMPLATE=$1
--experimental-features 'nix-command flakes' \
flake init \
--template \
"github:the-nix-way/dev-templates#''${TEMPLATE}"
'';
update = prev.writeScriptBin "update" '' nix \
for dir in `ls -d */`; do # Iterate through all the templates --experimental-features 'nix-command flakes' \
( flake init \
cd $dir --template \
"github:the-nix-way/dev-templates#''${TEMPLATE}"
'';
};
echo "updating ''${dir}" update = final.writeShellApplication {
name = "update";
# Update flake.lock text = forEachDir ''
nix flake update echo "updating ''${dir}"
nix flake update
echo "checking ''${dir}" '';
};
# Make sure things work after the update
nix flake check --all-systems --no-build
)
done
'';
}) })
]; ];
supportedSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ]; supportedSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
@ -67,7 +82,7 @@
{ {
devShells = forEachSupportedSystem ({ pkgs }: { devShells = forEachSupportedSystem ({ pkgs }: {
default = pkgs.mkShell { default = pkgs.mkShell {
packages = with pkgs; [ check format update ]; packages = with pkgs; [ build check format update ];
}; };
}); });
@ -81,6 +96,11 @@
{ {
templates = rec { templates = rec {
c-cpp = {
path = ./c-cpp;
description = "C/C++ development environment";
};
clojure = { clojure = {
path = ./clojure; path = ./clojure;
description = "Clojure development environment"; description = "Clojure development environment";
@ -238,6 +258,8 @@
# Aliases # Aliases
rt = rust-toolchain; rt = rust-toolchain;
c = c-cpp;
cpp = c-cpp;
}; };
}; };
} }

View File

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