# Can guix download and access the source code of a package?

**URL:** <https://forum.systemcrafters.net/t/can-guix-download-and-access-the-source-code-of-a-package/1380>\
**Category:** Guix\
**Created:** [February 8, 2025, 7:28pm UTC](https://forum.systemcrafters.net/t/can-guix-download-and-access-the-source-code-of-a-package/1380 "2025-02-08T19:28:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mirkoh](https://avatars.discourse-cdn.com/v4/letter/m/eb9ed0/32.png) [@mirkoh](https://forum.systemcrafters.net/u/mirkoh)\
**Post date:** [February 8, 2025, 7:28pm UTC](https://forum.systemcrafters.net/t/can-guix-download-and-access-the-source-code-of-a-package/1380/1 "2025-02-08T19:28:14Z")

</div>

Lets say I want to compile libpng instead of using the prebuilt guix version. Can I do this using guix and get access to the source code of the libpng package?

---

<div class="post-metadata">

**Author:** ![altomcat](https://yyz1.discourse-cdn.com/flex029/user_avatar/forum.systemcrafters.net/altomcat/32/583_2.png) [@altomcat](https://forum.systemcrafters.net/u/altomcat)\
**Post date:** [February 11, 2025, 9:05pm UTC](https://forum.systemcrafters.net/t/can-guix-download-and-access-the-source-code-of-a-package/1380/2 "2025-02-11T21:05:52Z")

</div>

Hello @mirkoh,

Assuming you already have the _url_ for the source code of `libpng`, a part of the answer could be:

```shell
git clone https://github.com/pnggroup/libpng.git
guix build libpng --with-source=./libpng

```

`guix build` will apply the recipe (package definition of `libpng`) to build the package and save it into your store.

You can remove this package from the store with:

```shell
guix gc -D /gnu/store/path-to-my-libpng-1.6.39

```

You can also tweak the building process. Please take a look at the documentation about [Package Transformation Options](https://guix.gnu.org/manual/en/html_node/Package-Transformation-Options.html).  
I highly recommend reading [this post from Futurile](https://www.futurile.net/2023/11/28/guix-package-rebuilds/). It’s a very well documented and there are plenty other good ressources on Guix in general.

---

<div class="post-metadata">

**Author:** ![mirkoh](https://avatars.discourse-cdn.com/v4/letter/m/eb9ed0/32.png) [@mirkoh](https://forum.systemcrafters.net/u/mirkoh)\
**Post date:** [February 11, 2025, 10:17pm UTC](https://forum.systemcrafters.net/t/can-guix-download-and-access-the-source-code-of-a-package/1380/3 "2025-02-11T22:17:58Z")

</div>

Thank you, my use case is to compile the library using a different version of gcc (the one included in the PS2SDK , which is a modified gcc ). The build option seems really useful for that, I will explore that approach but I’m assuming that guix only works with a set of official build systems (it would be fantastic if this is not the case and custom ones can actually be created). Just extracting the source code from the package would be enough to facilitate compilation.

My other use case is to generate gtags, usually I do it using the C\_INCLUDE\_PATH variable that guix exports (using guix shell --search-paths). It works great for autocomplete with company-gtags but sometimes I would like to navigate the definitions and the complete source code is needed for that.
