[RFC,1/1] nix: add a simple flake nix shell

Message ID 20240131214520.142408-1-vincenzopalazzodev@gmail.com
State Accepted
Headers
Series Nix Environment Support for GCC Development |

Checks

Context Check Description
snail/gcc-patch-check success Github commit url

Commit Message

Vincenzo Palazzo Jan. 31, 2024, 9:43 p.m. UTC
  This commit is specifically targeting enhancements in
Nix support for GCC development. This initiative stems
from the recognized need within our community for a more
streamlined and efficient development process when using Nix.

Please not that in this case the Nix tool is used to define
what should be in the dev environment, and not as a NixOS distro
package manager.

Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
---
 .gitignore            |  1 +
 contrib/nix/flake.nix | 35 +++++++++++++++++++++++++++++++++++
 2 files changed, 36 insertions(+)
 create mode 100644 contrib/nix/flake.nix
  

Comments

Eli Schwartz Jan. 31, 2024, 10:19 p.m. UTC | #1
On 1/31/24 4:43 PM, Vincenzo Palazzo wrote:
> This commit is specifically targeting enhancements in
> Nix support for GCC development. This initiative stems
> from the recognized need within our community for a more
> streamlined and efficient development process when using Nix.
> 
> Please not that in this case the Nix tool is used to define
> what should be in the dev environment, and not as a NixOS distro
> package manager.
> 
> Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
> ---


I was originally trying to figure out what the idea behind this patch
was, as I recalled discussing the patch before. Then I double checked
the mailing list and saw:

https://inbox.sourceware.org/gcc-patches/20240131214259.142253-1-vincenzopalazzodev@gmail.com/T/#u

One thing that can potentially reduce confusion here is:

- use git send-email -v2 to mark the patch as an update to an existing
  patch.

- Use the --annotate option, and edit the patch before sending it. Right
  here, after the "---" and in the same semantic patch section as the
  diffstat, you can put arbitrary non-patch commentary. It is
  essentially comments for patches -- it won't be included in the commit
  message when the patch is applied with `git am`. It is common to
  insert something that looks like this:


v2: moved the flake to contrib/ instead of installing it at the root of
the repository



>  .gitignore            |  1 +
>  contrib/nix/flake.nix | 35 +++++++++++++++++++++++++++++++++++
>  2 files changed, 36 insertions(+)
>  create mode 100644 contrib/nix/flake.nix
> 
> diff --git a/.gitignore b/.gitignore
> index 93a16b0b950..801b1d1709e 100644
> --- a/.gitignore
> +++ b/.gitignore
  
Vincenzo Palazzo Feb. 1, 2024, 9:04 p.m. UTC | #2
Hi Eli,

Yeah sorry I forgot to tag with -v2, so I am creating a -v3, after a while that
I do not use email to send patches I get a little bit rusty.

Thanks for your useful feedback, I am sending the v3 now.

Cheers,

   Vincent.


On Wed, Jan 31, 2024 at 11:19 PM Eli Schwartz <eschwartz93@gmail.com> wrote:
>
> On 1/31/24 4:43 PM, Vincenzo Palazzo wrote:
> > This commit is specifically targeting enhancements in
> > Nix support for GCC development. This initiative stems
> > from the recognized need within our community for a more
> > streamlined and efficient development process when using Nix.
> >
> > Please not that in this case the Nix tool is used to define
> > what should be in the dev environment, and not as a NixOS distro
> > package manager.
> >
> > Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
> > ---
>
>
> I was originally trying to figure out what the idea behind this patch
> was, as I recalled discussing the patch before. Then I double checked
> the mailing list and saw:
>
> https://inbox.sourceware.org/gcc-patches/20240131214259.142253-1-vincenzopalazzodev@gmail.com/T/#u
>
> One thing that can potentially reduce confusion here is:
>
> - use git send-email -v2 to mark the patch as an update to an existing
>   patch.
>
> - Use the --annotate option, and edit the patch before sending it. Right
>   here, after the "---" and in the same semantic patch section as the
>   diffstat, you can put arbitrary non-patch commentary. It is
>   essentially comments for patches -- it won't be included in the commit
>   message when the patch is applied with `git am`. It is common to
>   insert something that looks like this:
>
>
> v2: moved the flake to contrib/ instead of installing it at the root of
> the repository
>
>
>
> >  .gitignore            |  1 +
> >  contrib/nix/flake.nix | 35 +++++++++++++++++++++++++++++++++++
> >  2 files changed, 36 insertions(+)
> >  create mode 100644 contrib/nix/flake.nix
> >
> > diff --git a/.gitignore b/.gitignore
> > index 93a16b0b950..801b1d1709e 100644
> > --- a/.gitignore
> > +++ b/.gitignore
>
>
>
> --
> Eli Schwartz
  

Patch

diff --git a/.gitignore b/.gitignore
index 93a16b0b950..801b1d1709e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,6 +2,7 @@ 
 *.patch
 *.orig
 *.rej
+*.lock
 
 *~
 .#*
diff --git a/contrib/nix/flake.nix b/contrib/nix/flake.nix
new file mode 100644
index 00000000000..b0ff1915adc
--- /dev/null
+++ b/contrib/nix/flake.nix
@@ -0,0 +1,35 @@ 
+{
+  description = "gcc compiler";
+
+  inputs = {
+    nixpkgs.url = "github:nixos/nixpkgs";
+    flake-utils.url = "github:numtide/flake-utils";
+  };
+
+  outputs = { self, nixpkgs, flake-utils }:
+    flake-utils.lib.eachDefaultSystem (system:
+      let pkgs = nixpkgs.legacyPackages.${system};
+      in {
+        packages = {
+          default = pkgs.gnumake;
+        };
+        formatter = pkgs.nixpkgs-fmt;
+
+        devShell = pkgs.mkShell {
+          buildInputs = [
+            pkgs.gnumake
+            pkgs.gcc13
+
+            pkgs.gmp
+            pkgs.libmpc
+            pkgs.mpfr
+            pkgs.isl
+            pkgs.pkg-config
+            pkgs.autoconf-archive
+            pkgs.autoconf
+            pkgs.automake
+          ];
+        };
+      }
+    );
+}