This commit is contained in:
Michael Thomson 2024-09-10 12:58:55 -04:00
parent 9cb47c4c83
commit f16cb153e1
6 changed files with 73 additions and 5 deletions

1
.envrc Normal file
View File

@ -0,0 +1 @@
use flake

3
.gitignore vendored
View File

@ -1,3 +1,6 @@
.direnv
.ccls-cache
compile_commands.json
# Prerequisites
*.d

View File

@ -1,6 +1,6 @@
# ----- Variables for customization -----
CC = gcc # Compiler (you can change to clang if desired)
CFLAGS = -g3 -Wall -Wextra -fsanitize=address,undefined # Standard flags + debugging & warnings
CFLAGS = -g2 -Wall -Wextra #-fsanitize=address # Standard flags + debugging & warnings
LDFLAGS = # Linker flags, if any
# ----- Automatic dependency tracking -----
@ -19,4 +19,4 @@ server: $(OBJS)
# Phony target for cleaning
.PHONY: clean
clean:
rm -f $(OBJS) server
rm -f $(OBJS)

25
flake.lock generated Normal file
View File

@ -0,0 +1,25 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1721379653,
"narHash": "sha256-8MUgifkJ7lkZs3u99UDZMB4kbOxvMEXQZ31FO3SopZ0=",
"rev": "1d9c2c9b3e71b9ee663d11c5d298727dace8d374",
"revCount": 655136,
"type": "tarball",
"url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.1.655136%2Brev-1d9c2c9b3e71b9ee663d11c5d298727dace8d374/0190cd4f-c0eb-72cb-834b-ac854aa282dc/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
}

39
flake.nix Normal file
View File

@ -0,0 +1,39 @@
{
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
ccls
bear
] ++ (if system == "aarch64-darwin" then [ ] else [ gdb ]);
};
});
};
}

BIN
server

Binary file not shown.