[RFC PATCH 0/1] Nix Environment Support for GCC Development

2024-01-31 Thread Vincenzo Palazzo
I am writing to submit a revision of a patch for consideration to be included 
in the mainline GCC repository discussed in [1].

The only change is that this include the following suggestion [2]

[1] https://gcc.gnu.org/pipermail/gcc-patches/2023-December/639235.html
[2] https://gcc.gnu.org/pipermail/gcc-patches/2023-December/639308.html

Cheers,

Vincent.

Vincenzo Palazzo (1):
  nix: add a simple flake nix shell

 .gitignore|  1 +
 contrib/nix/flake.nix | 35 +++
 2 files changed, 36 insertions(+)
 create mode 100644 contrib/nix/flake.nix

-- 
2.43.0



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

2024-01-31 Thread Vincenzo Palazzo
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 
---
 .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
@@ -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 000..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
+  ];
+};
+  }
+);
+}
-- 
2.43.0



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

2024-02-01 Thread Vincenzo Palazzo
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  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 
> > ---
>
>
> 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-vincenzopalazzo...@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


[RFC PATCH v3] nix: add a simple flake nix shell

2024-02-01 Thread Vincenzo Palazzo
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 
---

v3: 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
@@ -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 000..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
+  ];
+};
+  }
+);
+}
-- 
2.43.0



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

2023-12-04 Thread Vincenzo Palazzo
However, I understand your point.

Cheers,

   Vincent.

On Tue, Dec 5, 2023 at 3:01 AM Vincenzo Palazzo
 wrote:
>
> >Distro build procedures are not something the GCC project generally gets
> involved with.
>
> I see, but to me, this do not look like a distro build procedure,
> because you can use
> with any kind of system (OSX/UNIX) by using nix.
>
> I disagree with you just because my patch is not building a package
> but is just giving
> an agnostic way to develop with GCC. OFC is most useful with NixOs because
> it does not have apt or pacman or any other kind of package manager.
>
> Cheers,
>
>Vincent.
>
> On Tue, Dec 5, 2023 at 2:54 AM Jeff Law  wrote:
> >
> >
> >
> > On 12/4/23 18:38, Vincenzo Palazzo wrote:
> > > Ciao all,
> > >
> > >> +1.  I think this is best left to the distros.
> > >
> > > What do you mean? this is not a package, it is an env shell in order
> > > to build an work on GCC on NixOS.
> > >
> > Distro build procedures are not something the GCC project generally gets
> > involved with.
> >
> > jeff


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

2023-12-04 Thread Vincenzo Palazzo
>Distro build procedures are not something the GCC project generally gets
involved with.

I see, but to me, this do not look like a distro build procedure,
because you can use
with any kind of system (OSX/UNIX) by using nix.

I disagree with you just because my patch is not building a package
but is just giving
an agnostic way to develop with GCC. OFC is most useful with NixOs because
it does not have apt or pacman or any other kind of package manager.

Cheers,

   Vincent.

On Tue, Dec 5, 2023 at 2:54 AM Jeff Law  wrote:
>
>
>
> On 12/4/23 18:38, Vincenzo Palazzo wrote:
> > Ciao all,
> >
> >> +1.  I think this is best left to the distros.
> >
> > What do you mean? this is not a package, it is an env shell in order
> > to build an work on GCC on NixOS.
> >
> Distro build procedures are not something the GCC project generally gets
> involved with.
>
> jeff


[RFC PATCH 0/1] Improved Nix Support for GCC Development

2023-12-04 Thread Vincenzo Palazzo
I am writing to submit a patch for consideration to be included 
in the mainline GCC repository. The patch aims to improve the ease of 
using Nix for GCC development, a challenge that several developers 
in our community have faced.

In the event that there is no current maintainer willing to take ownership 
of these changes, I am willing and able to assume the responsibility for 
maintaining this part of the codebase.

I believe that this patch will be a valuable addition to the GCC 
project, making it more accessible and user-friendly for a broader range 
of developers on NixOS. I appreciate your consideration of this contribution 
and am open to any feedback or suggestions for improvement.

Cheers,

Vincent

Vincenzo Palazzo (1):
  nix: add a simple flake nix shell

 flake.lock | 60 ++
 flake.nix  | 35 +++
 2 files changed, 95 insertions(+)
 create mode 100644 flake.lock
 create mode 100644 flake.nix

-- 
2.43.0



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

2023-12-04 Thread Vincenzo Palazzo
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.

Signed-off-by: Vincenzo Palazzo 
---
 flake.lock | 60 ++
 flake.nix  | 35 +++
 2 files changed, 95 insertions(+)
 create mode 100644 flake.lock
 create mode 100644 flake.nix

diff --git a/flake.lock b/flake.lock
new file mode 100644
index 000..de713ff0da9
--- /dev/null
+++ b/flake.lock
@@ -0,0 +1,60 @@
+{
+  "nodes": {
+"flake-utils": {
+  "inputs": {
+"systems": "systems"
+  },
+  "locked": {
+"lastModified": 1694529238,
+"narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=",
+"owner": "numtide",
+"repo": "flake-utils",
+"rev": "ff7b65b44d01cf9ba6a71320833626af21126384",
+"type": "github"
+  },
+  "original": {
+"owner": "numtide",
+"repo": "flake-utils",
+"type": "github"
+  }
+},
+"nixpkgs": {
+  "locked": {
+"lastModified": 1696095070,
+"narHash": "sha256-iDx02dT+OHYYgaRGJxp2HXvzSHkA9l8/3O8GJB2wttU=",
+"owner": "nixos",
+"repo": "nixpkgs",
+"rev": "1f0e8ac1f9a783c4cfa0515483094eeff4315fe2",
+"type": "github"
+  },
+  "original": {
+"owner": "nixos",
+"repo": "nixpkgs",
+"type": "github"
+  }
+},
+"root": {
+  "inputs": {
+"flake-utils": "flake-utils",
+"nixpkgs": "nixpkgs"
+  }
+},
+"systems": {
+  "locked": {
+"lastModified": 1681028828,
+"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
+"owner": "nix-systems",
+"repo": "default",
+"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
+"type": "github"
+  },
+  "original": {
+"owner": "nix-systems",
+"repo": "default",
+"type": "github"
+  }
+}
+  },
+  "root": "root",
+  "version": 7
+}
diff --git a/flake.nix b/flake.nix
new file mode 100644
index 000..b0ff1915adc
--- /dev/null
+++ b/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
+  ];
+};
+  }
+);
+}
-- 
2.43.0



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

2023-12-04 Thread Vincenzo Palazzo
Ciao all,

>+1.  I think this is best left to the distros.

What do you mean? this is not a package, it is an env shell in order
to build an work on GCC on NixOS.

NixOS has already the packages for GCC

Cheers,

   Vincent.

On Tue, Dec 5, 2023 at 2:07 AM Jeff Law  wrote:
>
>
>
> On 12/4/23 18:02, Andrew Pinski wrote:
> > On Mon, Dec 4, 2023 at 4:58 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.
> >
> > I think this is wrong place for this.
> +1.  I think this is best left to the distros.
>
> jeff


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

2023-12-05 Thread Vincenzo Palazzo
Hi all,

>Generally we have various stuff in contrib/, one of it scripts like
gcc_build.  IMHO the flake.nix file (or a script to create it) could be
put there as well.

I was not sure about that, I will try to see what if I can put in there


>But you can do the same with various other distro build procedures too?
>e.g. Gentoo Prefix allows you to install a full-blown Gentoo anywhere
you like, "by using portage".

With a single difference on Gentoo you are allowed to put stuff in the
global path and use
it from a terminal like `$ pacman -Sy foo`. On nix os you do not,
because the development environment
is used for that.

So all the nice dependencies that gcc required to build can not be
installed in NixOS global pat (e.g libc)
so in NixOS you should define the development environment otherwise
you can do the build. Instead in all
the other systems that you mention you can do.

Please note that the flake.nix does not define how to build gcc, but
just what are the dependencies
that gcc is required in order to contribute to the compiler. In other
words, is you run the flake.nix
on NixOS or any other system you do not have gcc installed on your
system, this is the job of the
distro.

Cheers,

   Vincent.

On Tue, Dec 5, 2023 at 10:03 AM Richard Biener
 wrote:
>
> On Tue, Dec 5, 2023 at 5:26 AM Eli Schwartz  wrote:
> >
> > On 12/4/23 9:01 PM, Vincenzo Palazzo wrote:
> > > On Tue, Dec 5, 2023 at 2:54 AM Jeff Law  wrote:
> > >> Distro build procedures are not something the GCC project generally gets
> > >> involved with.
> > >
> > > I see, but to me, this do not look like a distro build procedure,
> > > because you can use
> > > with any kind of system (OSX/UNIX) by using nix.
> >
> >
> > But you can do the same with various other distro build procedures too?
> >
> > e.g. Gentoo Prefix allows you to install a full-blown gentoo anywhere
> > you like, "by using portage".
> >
> > But also by the same token, I can just install pacman or rpm or dpkg on
> > any system, and use the recipe executor just without requiring a
> > database of installed packages.
> >
> >
> > > I disagree with you just because my patch is not building a package
> > > but is just giving
> > > an agnostic way to develop with GCC. OFC is most useful with NixOs because
> > > it does not have apt or pacman or any other kind of package manager.
> >
> >
> > I'm not entirely sure what this statement means (unless you are saying
> > that nix isn't a package manager and NixOS doesn't have any package
> > manager)?
> >
> > But I'd actually go one step further. It looks like this "flake.nix"
> > file is the NixOS specific equivalent of a README.md which says "to
> > install the software, you must first install XX, YY, and ZZ using your
> > system package manager. Often they will have names such as XX-devel and
> > suchlike".
> >
> > Which for GCC would be https://gcc.gnu.org/install/prerequisites.html --
> > this page actually lists a bunch of things I don't see mentioned in your
> > "flake.nix" file so I suspect that it won't, in fact, produce a good
> > development environment for developing GCC.
> >
> > I don't think it's the job of the GCC maintainers to maintain special
> > snowflake integrations with niche linux distros, whether those
> > integrations work or not. But, if it *was* the job of the GCC
> > maintainers, perhaps it would be better to make a script:
> >
> > `tools/setup-development-env.sh $distro`
> >
> > which could abstract away all of this for any distro, not just a niche one.
>
> Generally we have various stuff in contrib/, one of it scripts like
> gcc_build.  IMHO the flake.nix file (or a script to create it) could be
> put there as well.
>
> Richard.
>
> >
> > --
> > Eli Schwartz
> >


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

2023-12-11 Thread Vincenzo Palazzo
Hi all,

>Are you backing down from that opinion and deciding that this proposal
is, indeed, after all specific to NixOS and only NixOS and is neither
needed nor used on any other distro?

I may be misreading the conversation, so let's restart it.

Why should my RFC be inside the distro's repository? What makes this a distro
build package? and not a developer configuration for building a
development environment?

Cheers,

   Vincent.

On Tue, Dec 5, 2023 at 1:43 PM Eli Schwartz  wrote:
>
> On 12/5/23 5:35 AM, Vincenzo Palazzo wrote:
> >>> I see, but to me, this do not look like a distro build procedure,
> >>> because you can use
> >>> with any kind of system (OSX/UNIX) by using nix.
> >>
> >> But you can do the same with various other distro build procedures too?
> >> e.g. Gentoo Prefix allows you to install a full-blown Gentoo anywhere
> >> you like, "by using portage".
> >
> > With a single difference on Gentoo you are allowed to put stuff in the
> > global path and use
> > it from a terminal like `$ pacman -Sy foo`. On nix os you do not,
> > because the development environment
> > is used for that.
> >
> > So all the nice dependencies that gcc required to build can not be
> > installed in NixOS global pat (e.g libc)
> > so in NixOS you should define the development environment otherwise
> > you can do the build. Instead in all
> > the other systems that you mention you can do.
>
>
> And yet, it seems your original point was that this doesn't qualify as a
> "distro build procedure" because nix isn't specific to NixOS.
>
> Are you backing down from that opinion and deciding that this proposal
> is, indeed, after all specific to NixOS and only NixOS and is neither
> needed nor used on any other distro?
>
>
> > Please note that the flake.nix does not define how to build gcc, but
> > just what are the dependencies
> > that gcc is required in order to contribute to the compiler. In other
> > words, is you run the flake.nix
> > on NixOS or any other system you do not have gcc installed on your
> > system, this is the job of the
> > distro.
>
>
> Its lack of completeness is surely an issue, but not the issue at hand
> *here*. Why do you think the lack of completeness is a supporting
> argument, rather than an opposing argument?
>
>
> --
> Eli Schwartz
>