dorne/flake.nix

95 lines
2.3 KiB
Nix
Raw Normal View History

2025-09-02 22:16:59 +10:00
{
2025-09-03 00:00:42 +10:00
description = "devshell-dorne";
2025-09-02 22:16:59 +10:00
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05";
};
2025-09-03 00:00:42 +10:00
outputs = inputs @ {
2025-09-02 22:16:59 +10:00
self,
nixpkgs,
}: let
2025-09-03 00:00:42 +10:00
defaultSystems = ["aarch64-darwin" "aarch64-linux" "i686-linux" "x86_64-darwin" "x86_64-linux"];
2025-09-02 22:16:59 +10:00
2025-09-03 00:00:42 +10:00
forAllSystems = f:
2025-09-03 00:55:42 +10:00
nixpkgs.lib.genAttrs defaultSystems (system:
2025-09-03 00:00:42 +10:00
f system (import nixpkgs {
inherit system;
2025-09-03 00:55:42 +10:00
overlays = builtins.attrValues self.overlays;
}));
2025-09-03 02:32:59 +10:00
# list directory contents as absolute paths
lsAbsolute = with builtins;
path:
map (name: (toPath path) + "/" + name) (attrNames (readDir path));
2025-09-02 22:16:59 +10:00
in {
2025-09-03 00:00:42 +10:00
overlays.default = final: prev: {
dorne = final.haskellPackages.developPackage {
2025-09-02 22:16:59 +10:00
root = ./.;
modifier = drv:
2025-09-03 00:00:42 +10:00
final.haskell.lib.addBuildTools drv (with final.haskellPackages; [
2025-09-02 22:16:59 +10:00
cabal-install
ghcid
]);
};
};
2025-09-03 00:00:42 +10:00
devShells = forAllSystems (
system: pkgs: {
default = pkgs.mkShell {
packages = with pkgs; [
gnumake
2025-09-03 00:56:01 +10:00
2025-09-03 01:09:46 +10:00
# Compilers
2025-09-03 00:00:42 +10:00
gcc
2025-09-03 00:56:01 +10:00
ghc
2025-09-03 02:31:09 +10:00
# C Dependencies
2025-09-09 11:20:51 +10:00
glibc.dev
pipewire.dev
2025-09-09 11:20:51 +10:00
ncurses.dev
2025-09-03 02:32:59 +10:00
2025-09-03 01:09:46 +10:00
# Language/Development Tooling
clang-tools
bear # clang compile_commands.json
2025-09-09 11:20:51 +10:00
valgrind # memory debugging+profiling
2025-09-03 00:56:01 +10:00
haskell-language-server
ormolu
2025-09-03 00:00:42 +10:00
];
shell = "${pkgs.bash}/bin/bash";
2025-09-03 02:32:59 +10:00
2025-09-09 11:20:51 +10:00
# so I can easily read the glibc header files
GLIBC = "${pkgs.glibc.dev}/include";
2025-09-03 02:32:59 +10:00
# 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";
2025-09-03 00:00:42 +10:00
};
}
);
checks = self.packages;
packages = forAllSystems (system: pkgs: rec {
default = dorne;
dorne = pkgs.dorne;
});
2025-09-02 22:16:59 +10:00
};
}