diff --git a/haskell/flake.nix b/haskell/flake.nix new file mode 100644 index 0000000..10936a1 --- /dev/null +++ b/haskell/flake.nix @@ -0,0 +1,33 @@ +{ + description = "A very basic Haskell flake"; + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + }; + + + outputs = { self, nixpkgs, ...}: + let + supportedSystems = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ]; + forAllSystems = nixpkgs.lib.genAttrs supportedSystems; + pkgs = forAllSystems (system: nixpkgs.legacyPackages.${system}); + stack-wrapped = pkgs.symlinkJoin { + name = "stack"; # will be available as the usual `stack` in terminal + paths = [ pkgs.stack ]; + buildInputs = [ pkgs.makeWrapper ]; + postBuild = '' + wrapProgram $out/bin/stack \ + --add-flags "\ + --no-nix \ + --system-ghc \ + --no-install-ghc \ + " + ''; + }; + in + { + devShells = forAllSystems (system: { + default = pkgs.${system}.callPackage ./shell.nix {}; + LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath self.default.buildInputs; + }); + }; +} diff --git a/haskell/shell.nix b/haskell/shell.nix new file mode 100644 index 0000000..8fedbef --- /dev/null +++ b/haskell/shell.nix @@ -0,0 +1,13 @@ + +{ pkgs ? import {}}: + +pkgs.mkShell rec { + buildInputs = with pkgs; [ + haskell.compiler.ghc96 + haskellPackages.cabal-install + haskellPackages.stack + ] + ; + shellHook = '' + ''; +}