diff options
| author | Mel <mel@rnrd.eu> | 2025-02-28 18:08:37 +0100 |
|---|---|---|
| committer | Mel <mel@rnrd.eu> | 2025-02-28 18:10:18 +0100 |
| commit | 8fe5a3fbcf39a72084aa44d1eb6f43df9f28707c (patch) | |
| tree | 1860db373abace0588193529a57811affd294dd9 /flake.nix | |
| parent | 66adbe28c7b7e714b18c4c21def4a7470fdd79a9 (diff) | |
| download | catskill-8fe5a3fbcf39a72084aa44d1eb6f43df9f28707c.tar.zst catskill-8fe5a3fbcf39a72084aa44d1eb6f43df9f28707c.zip | |
Add Makefile and Nix build environment
Signed-off-by: Mel <mel@rnrd.eu>
Diffstat (limited to 'flake.nix')
| -rw-r--r-- | flake.nix | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..9021e96 --- /dev/null +++ b/flake.nix @@ -0,0 +1,65 @@ +{ + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + }; + + outputs = + { self, nixpkgs }: + let + systems = [ + "x86_64-linux" + "x86_64-darwin" + "aarch64-linux" + "aarch64-darwin" + "riscv64-linux" + ]; + + eachSystem = + f: + nixpkgs.lib.genAttrs systems ( + system: + f { + inherit system; + pkgs = import nixpkgs { inherit system; }; + } + ); + in + { + devShells = eachSystem ( + { system, pkgs }: + with pkgs; + let + stdenv = llvmPackages.stdenv; + shell = mkShell.override { inherit stdenv; }; + + musl-src = runCommand "musl-src" { } '' + mkdir $out + tar -xf ${musl.src} -C $out + ''; + + musl-static = musl.overrideAttrs (attrs: { + # this HAS the be fixed in upstream nixpkgs one day, right? + CFLAGS = attrs.CFLAGS ++ [ + "-fdebug-prefix-map=/build=${musl-src}" + ]; + seperateDebugInfo = false; + dontStrip = true; + }); + in + { + default = shell { + buildInputs = [ + musl-static + ]; + + nativeBuildInputs = [ + pkg-config + gnumake + lldb + llvmPackages.bintools + ]; + }; + } + ); + }; +} |
