From e8e382f111b7775370cdfc3d970508854aea00ef Mon Sep 17 00:00:00 2001 From: ChUrl Date: Sun, 2 Apr 2023 15:18:43 +0200 Subject: [PATCH] Update envs: C/C++ and LaTeX --- env/c_cxx.nix | 4 +-- env/c_cxx_libs.nix | 82 ++++++++++++++++++++++++++++++++++++++++++++++ env/latex.nix | 31 ++++++++++++++++++ 3 files changed, 115 insertions(+), 2 deletions(-) create mode 100644 env/c_cxx_libs.nix create mode 100644 env/latex.nix diff --git a/env/c_cxx.nix b/env/c_cxx.nix index 36e027c5..c1bc2d31 100644 --- a/env/c_cxx.nix +++ b/env/c_cxx.nix @@ -1,5 +1,5 @@ { - description = ""; + description = "C/C++ Environment"; inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; inputs.flake-utils.url = "github:numtide/flake-utils"; @@ -52,7 +52,7 @@ in { # devShell = pkgs.devshell.mkShell ... devShell = pkgs.devshell.mkShell { - name = ""; + name = "C/C++ Environment"; packages = with pkgs; [ # Compilers diff --git a/env/c_cxx_libs.nix b/env/c_cxx_libs.nix new file mode 100644 index 00000000..7470c761 --- /dev/null +++ b/env/c_cxx_libs.nix @@ -0,0 +1,82 @@ +{ + description = "C/C++ Environment with Libraries"; + + inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + inputs.flake-utils.url = "github:numtide/flake-utils"; + inputs.devshell.url = "github:numtide/devshell"; + + outputs = { + self, + nixpkgs, + flake-utils, + devshell, + }: + flake-utils.lib.eachDefaultSystem (system: let + pkgs = import nixpkgs { + inherit system; + config.allowUnfree = true; # For clion + overlays = [devshell.overlays.default]; + }; + + # NOTE: Usual 64 bit compilers that don't collide + bintools = pkgs.wrapBintoolsWith { + bintools = pkgs.bintools.bintools; + libc = pkgs.glibc; + }; + gcc12 = pkgs.hiPrio (pkgs.wrapCCWith { + cc = pkgs.gcc12.cc; + libc = pkgs.glibc; + bintools = bintools; + }); + clang15 = pkgs.wrapCCWith { + cc = pkgs.clang_15.cc; + libc = pkgs.glibc; + bintools = bintools; + }; + + # NOTE: Multilib compilers that don't collide + bintools_multi = pkgs.wrapBintoolsWith { + bintools = pkgs.bintools.bintools; # Get the unwrapped bintools from the wrapper + libc = pkgs.glibc_multi; + }; + gcc12_multi = pkgs.hiPrio (pkgs.wrapCCWith { + cc = pkgs.gcc12.cc; # Get the unwrapped gcc from the wrapper + libc = pkgs.glibc_multi; + bintools = bintools_multi; + }); + clang15_multi = pkgs.wrapCCWith { + cc = pkgs.clang_15.cc; + libc = pkgs.glibc_multi; + bintools = bintools_multi; + }; + in { + # NOTE: We cannot use devshell, as it doesn't propagate library paths (yet?) + devShells.default = pkgs.mkShell { + buildInputs = with pkgs; [ + # Compilers + bintools + gcc12 + clang15 + # bintools_multi + # gcc12_multi + # clang14_multi + + # Native buildinputs + gnumake + cmake + # nasm + + # Development + # bear # To generate compilation database + gdb + cling # To try out my bullshit implementations + # doxygen # Generate docs + graphs + + # Libraries + # boost181 + # raylib + # sfml + ]; + }; + }); +} diff --git a/env/latex.nix b/env/latex.nix new file mode 100644 index 00000000..51746569 --- /dev/null +++ b/env/latex.nix @@ -0,0 +1,31 @@ +{ + description = "LaTeX Environment"; + + inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + inputs.flake-utils.url = "github:numtide/flake-utils"; + inputs.devshell.url = "github:numtide/devshell"; + + outputs = { + self, + nixpkgs, + flake-utils, + devshell, + }: + flake-utils.lib.eachDefaultSystem (system: let + pkgs = import nixpkgs { + inherit system; + config.allowUnfree = true; + overlays = [devshell.overlays.default]; + }; + + # TODO: Custom LaTeX "distribution"? With curated packages? + in { + devShell = pkgs.devshell.mkShell { + name = "LaTeX Environment"; + + packages = with pkgs; [ + texlab + ]; + }; + }); +}