Skip to content

Commit

Permalink
Merge pull request NixOS#362 from fzakaria/faridzakaria/musl-flake
Browse files Browse the repository at this point in the history
Add support to build with musl
  • Loading branch information
Mic92 committed Dec 23, 2021
2 parents 3d0a58b + 15a12d8 commit bdb09e9
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 4 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,21 @@ libraries. In particular, it can do the following:

## Compiling and Testing

### Via Autotools
```console
./bootstrap.sh
./configure
make
make check
sudo make install
```
### Via Nix

You can build with Nix in several ways.

1. Building via `nix build` will produce the result in `./result/bin/patchelf`. If you would like to build _patchelf_ with _musl_ try `nix build .#patchelf-musl`

2. You can launch a development environment with `nix develop` and folllow the autotools steps above. If you would like to develop with _musl_ try `nix develop .#musl`

## Author

Expand Down
23 changes: 19 additions & 4 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@

{
overlay = final: prev: {
patchelf-new-musl = final.pkgsMusl.callPackage ./patchelf.nix {
inherit version;
src = self;
};
patchelf-new = final.callPackage ./patchelf.nix {
inherit version;
src = self;
Expand Down Expand Up @@ -85,12 +89,23 @@
build = self.hydraJobs.build.${system};
});

devShell = forAllSystems (system: self.devShells.${system}.glibc);

devShells = forAllSystems (system:
{
glibc = self.packages.${system}.patchelf;
musl = self.packages.${system}.patchelf-musl;
});

defaultPackage = forAllSystems (system:
(import nixpkgs {
inherit system;
overlays = [ self.overlay ];
}).patchelf-new
self.packages.${system}.patchelf
);

packages = forAllSystems (system:
{
patchelf = nixpkgsFor.${system}.patchelf-new;
patchelf-musl = nixpkgsFor.${system}.patchelf-new-musl;
});

};
}

0 comments on commit bdb09e9

Please sign in to comment.