dorne/flake.nix

94 lines
2.3 KiB
Nix

{
description = "devshell-dorne";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05";
};
outputs = inputs @ {
self,
nixpkgs,
}: let
defaultSystems = ["aarch64-darwin" "aarch64-linux" "i686-linux" "x86_64-darwin" "x86_64-linux"];
forAllSystems = f:
nixpkgs.lib.genAttrs defaultSystems (system:
f system (import nixpkgs {
inherit system;
overlays = builtins.attrValues self.overlays;
}));
# list directory contents as absolute paths
lsAbsolute = with builtins;
path:
map (name: (toPath path) + "/" + name) (attrNames (readDir path));
in {
overlays.default = final: prev: {
dorne = final.haskellPackages.developPackage {
root = ./.;
modifier = drv:
final.haskell.lib.addBuildTools drv (with final.haskellPackages; [
cabal-install
ghcid
]);
};
};
devShells = forAllSystems (
system: pkgs: {
default = pkgs.mkShell {
packages = with pkgs; [
gnumake
# Compilers
gcc
ghc
# C Dependencies
glibc.dev
pipewire.dev
ncurses.dev
# Language/Development Tooling
clang-tools
bear # clang compile_commands.json
valgrind # memory debugging+profiling
haskell-language-server
ormolu
];
shell = "${pkgs.bash}/bin/bash";
# so I can easily read the glibc header files
GLIBC = "${pkgs.glibc.dev}/include";
# SPA API is provided by pipewire's "dev" derivation output
NIX_CFLAGS_COMPILE = let
# libpipewire (and libspa)
Ipipewire =
lsAbsolute "${pkgs.pipewire.dev}/include";
Ivendor =
builtins.map
(x: "-isystem ${x}")
Ipipewire;
in
builtins.concatStringsSep " " ([
(builtins.getEnv
"NIX_CFLAGS_COMPILE")
]
++ Ivendor);
DORNE_LDFLAGS = let
in "-L${pkgs.pipewire}/lib";
};
}
);
checks = self.packages;
packages = forAllSystems (system: pkgs: rec {
default = dorne;
dorne = pkgs.dorne;
});
};
}