aboutsummaryrefslogtreecommitdiff
path: root/flake.nix
diff options
context:
space:
mode:
Diffstat (limited to 'flake.nix')
-rw-r--r--flake.nix79
1 files changed, 79 insertions, 0 deletions
diff --git a/flake.nix b/flake.nix
new file mode 100644
index 0000000..cc5d30a
--- /dev/null
+++ b/flake.nix
@@ -0,0 +1,79 @@
+{
+ inputs = {
+ nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
+ flake-parts.url = "github:hercules-ci/flake-parts";
+ haskell-flake.url = "github:srid/haskell-flake";
+ };
+ outputs = inputs@{ self, nixpkgs, flake-parts, ... }:
+ flake-parts.lib.mkFlake { inherit inputs; } {
+ systems = nixpkgs.lib.systems.flakeExposed;
+ imports = [
+ inputs.haskell-flake.flakeModule
+ ];
+
+ perSystem = { self', pkgs, lib, config, ... }:
+ let
+ projectRoot = builtins.toString (lib.fileset.toSource {
+ root = ./.;
+ fileset = lib.fileset.unions [
+ ./exe
+ ./lib
+ ./specs
+ ./daffm.cabal
+ ];
+ });
+ otherFiles = [];
+ configurationFlags = [
+ "--ghc-options=-O2"
+ ];
+ buildInputs = with pkgs; [
+ pkg-config
+ ];
+
+ devPackages = with pkgs; [
+ just
+ nodemon
+ ];
+ in {
+ haskellProjects.default = {
+ inherit projectRoot;
+
+ packages = {};
+ settings = {
+ daffm = {
+ check = true;
+ deadCodeElimination = true;
+ staticLibraries = true;
+ strip = true;
+ custom = drv:
+ (pkgs.haskell.lib.compose.appendConfigureFlags configurationFlags drv).overrideAttrs (old: {
+ preBuild = ''
+ ${toString (map (f: ''cp -r ${f.source} ${f.target};'') otherFiles)}
+ '';
+ })
+ ;
+ };
+ };
+
+ devShell = {
+ hlsCheck.enable = true;
+ };
+
+ autoWire = [ "packages" "apps" "checks" ];
+ };
+
+ packages.default = self'.packages.daffm;
+ apps.default = self'.apps.daffm;
+
+ devShells.default = pkgs.mkShell {
+ inputsFrom = [
+ config.haskellProjects.default.outputs.devShell
+ ];
+ packages = devPackages;
+ inherit buildInputs;
+
+ LD_LIBRARY_PATH = "${pkgs.lib.makeLibraryPath buildInputs}";
+ };
+ };
+ };
+}