From f556f75d5fdbcb82fb6419b5ea5d30672209361a Mon Sep 17 00:00:00 2001 From: Raphael Date: Thu, 12 Jun 2025 17:27:17 +0200 Subject: [PATCH] build(nix/flake): adding the flake to build all the nix stuff --- .envrc | 1 + flake.nix | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 .envrc create mode 100644 flake.nix diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..b501c98 --- /dev/null +++ b/flake.nix @@ -0,0 +1,40 @@ +{ + description = "Shell for inception 42 project"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem (system: + let + pkgs = import nixpkgs { + inherit system; + }; + in { + devShells.default = pkgs.mkShell { + name = "inception-42"; + buildInputs = with pkgs; [ + docker + docker-compose + htop + vim + zsh + openssl + curl + ] ++ ( + if pkgs.stdenv.isLinux then [ + valgrind + ] else [] + ); + + shellHook = '' + export CXX=clang++ + export CXXFLAGS="-std=cpp98 -Wall -Werror -Wextra" + printf "\n\033[0;90mCPP env loaded for: \033[38;5;220m${system}\033[0m\n" + ''; + }; + } + ); +}