Skip to content

Commit

Permalink
Merge pull request #40 from joelbenway/add-c-cpp
Browse files Browse the repository at this point in the history
Add C/C++ development flake with some sane defaults.
  • Loading branch information
lucperkins authored Apr 26, 2024
2 parents d6bccb7 + a4a1c80 commit 615e7e8
Show file tree
Hide file tree
Showing 5 changed files with 97 additions and 0 deletions.
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Once your preferred template has been initialized, you can use the provided shel

| Language/framework/tool | Template |
| :----------------------- | :---------------------------- |
| [C]/[C++] | [`c-cpp`](./c-cpp/) |
| [Clojure] | [`clojure`](./clojure/) |
| [C#][csharp] | [`csharp`](./csharp/) |
| [Cue] | [`cue`](./cue/) |
Expand Down Expand Up @@ -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.

### [`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] 1.11.1.1347
Expand Down Expand Up @@ -268,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
[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
[cachix]: https://www.cachix.org
[cargo]: https://doc.rust-lang.org/cargo
[cargo-audit]: https://crates.io/crates/cargo-audit
[cargo-deny]: https://crates.io/crates/cargo-deny
[clang-tools]: https://clang.llvm.org/
[clippy]: https://github.com/rust-lang/rust-clippy
[clojure]: https://clojure.org
[cmake]: https://cmake.org/
[codespell]: https://github.com/codespell-project/codespell
[composer]: https://getcomposer.org/
[conan]: https://conan.io/
[conftest]: https://www.conftest.dev
[cppcheck]: http://cppcheck.sourceforge.net/
[csharp]: https://dotnet.microsoft.com/en-us/languages/csharp
[cue]: https://cuelang.org
[damon]: https://github.com/hashicorp/damon
Expand All @@ -292,18 +314,21 @@ 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-yaml]: https://github.com/dhall-lang/dhall-haskell/tree/master/dhall-yaml
[dotnet]: https://dotnet.microsoft.com/en-us/
[doxygen]: https://www.doxygen.nl/
[dune]: https://dune.build
[elixir]: https://elixir-lang.org
[elm]: https://elm-lang.org
[elm2nix]: https://github.com/cachix/elm2nix
[flake-utils]: https://github.com/numtide/flake-utils
[gdb]: https://www.gnu.org/software/gdb/
[gigalixir]: https://www.gigalixir.com
[gleam]: https://gleam.run
[go]: https://go.dev
[godoc]: https://pkg.go.dev/golang.org/x/tools/cmd/godoc
[goimports]: https://pkg.go.dev/golang.org/x/tools/cmd/goimports
[golangci-lint]: https://github.com/golangci/golangci-lint
[gradle]: https://gradle.org
[gtest]: https://github.com/google/googletest
[hashicorp]: https://hashicorp.com
[haskell]: https://haskell.org
[haxe]: https://haxe.org/
Expand All @@ -313,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
[kotlin]: https://kotlinlang.org
[latex]: https://www.latex-project.org/
[lcov]: https://ltp.sourceforge.net/coverage/lcov.php
[leiningen]: https://leiningen.org
[levant]: https://github.com/hashicorp/levant
[lorri]: https://github.com/target/lorri
Expand Down Expand Up @@ -366,6 +392,8 @@ 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
[vcpkg]: https://vcpkg.io/
[vcpkg-tool]: https://github.com/microsoft/vcpkg-tool
[vulnix]: https://github.com/flyingcircusio/vulnix
[yarn]: https://yarnpkg.com
[vlang]: https://vlang.io/
Expand Down
1 change: 1 addition & 0 deletions c-cpp/.envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake
25 changes: 25 additions & 0 deletions c-cpp/flake.lock

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

36 changes: 36 additions & 0 deletions c-cpp/flake.nix
Original file line number Diff line number Diff line change
@@ -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 ]);
};
});
};
}

7 changes: 7 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,11 @@

{
templates = rec {
c-cpp = {
path = ./c-cpp;
description = "C/C++ development environment";
};

clojure = {
path = ./clojure;
description = "Clojure development environment";
Expand Down Expand Up @@ -253,6 +258,8 @@

# Aliases
rt = rust-toolchain;
c = c-cpp;
cpp = c-cpp;
};
};
}

0 comments on commit 615e7e8

Please sign in to comment.