build(nix): updating the flake for nix build propose

This commit is contained in:
Raphael 2025-05-05 16:27:09 +02:00
parent 473e9df5d4
commit 669ab480e0

View file

@ -1,31 +1,46 @@
{ {
description = "Flake utils demo"; description = "Shell for 42 cpp";
inputs = { inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils"; flake-utils.url = "github:numtide/flake-utils";
c_formatter_42.url = "github:maix0/c_formatter_42-flake"; c_formatter_42.url = "github:maix0/c_formatter_42-flake";
}; };
outputs = { outputs = {
self, self,
nixpkgs, nixpkgs,
flake-utils, flake-utils,
c_formatter_42, c_formatter_42
}: }:
flake-utils.lib.eachDefaultSystem ( flake-utils.lib.eachDefaultSystem (system:
system: let let
pkgs = nixpkgs.legacyPackages.${system}; pkgs = import nixpkgs {
in { inherit system;
devShell = pkgs.mkShell { };
packages = [ in {
pkgs.xorg.libX11 devShells.default = pkgs.mkShell {
pkgs.xorg.libXext name = "cpp-42";
pkgs.clang buildInputs = with pkgs; [
pkgs.clang-tools c_formatter_42.packages.${system}.default
pkgs.norminette clang
c_formatter_42.packages.${system}.default clang-tools
]; norminette
}; xorg.libX11
} xorg.libXext
); ] ++ (
if pkgs.stdenv.isLinux then [
valgrind
] else []
);
shellHook = ''
export NIX_SHOW_STATS=0
export NIX_HIDE_STATS=1
export C=clang
export CFLAGS="-std=c89 -Wall -Werror -Wextra"
printf "\n\033[0;90mC w/MLX env loaded for: \033[38;5;220m${system}\033[0m\n"
'';
};
}
);
} }