From bf460fb581eba1bdce487c9adf791d03b2351487 Mon Sep 17 00:00:00 2001 From: Alex Mason Date: Thu, 28 Mar 2024 17:30:35 +1100 Subject: [PATCH] Add nix flake --- .gitignore | 3 ++ cabal.project | 3 +- flake.lock | 80 +++++++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 57 ++++++++++++++++++++++++++++++++++++ 4 files changed, 142 insertions(+), 1 deletion(-) create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/.gitignore b/.gitignore index a4ee41a..bc08c14 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,6 @@ cabal.sandbox.config *.eventlog .stack-work/ cabal.project.local + +# Nix build output +result diff --git a/cabal.project b/cabal.project index e6fdbad..1671440 100644 --- a/cabal.project +++ b/cabal.project @@ -1 +1,2 @@ -packages: . +packages: + . diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..ed232b5 --- /dev/null +++ b/flake.lock @@ -0,0 +1,80 @@ +{ + "nodes": { + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1709336216, + "narHash": "sha256-Dt/wOWeW6Sqm11Yh+2+t0dfEWxoMxGBvv3JpIocFl9E=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "f7b3c975cf067e56e7cda6cb098ebe3fb4d74ca2", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "haskell-flake": { + "locked": { + "lastModified": 1711568381, + "narHash": "sha256-IvVqTNcbSNh6XgyS4ikBkQio1eMmLvKTl3vAvkVPn+0=", + "owner": "srid", + "repo": "haskell-flake", + "rev": "5dcb739e9cc4e0edf5267de665fa7a905a543baa", + "type": "github" + }, + "original": { + "owner": "srid", + "repo": "haskell-flake", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1711562861, + "narHash": "sha256-ETfttWNpw5HSfC8QeGYPXkJZWnj8MPVxIVuCE3nFqKA=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "feb8fc72187e5beae47d81fc38541fae89e7eaf8", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-lib": { + "locked": { + "dir": "lib", + "lastModified": 1709237383, + "narHash": "sha256-cy6ArO4k5qTx+l5o+0mL9f5fa86tYUX3ozE1S+Txlds=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "1536926ef5621b09bba54035ae2bb6d806d72ac8", + "type": "github" + }, + "original": { + "dir": "lib", + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-parts": "flake-parts", + "haskell-flake": "haskell-flake", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..2632afa --- /dev/null +++ b/flake.nix @@ -0,0 +1,57 @@ +{ + 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, ... }: { + + # Typically, you just want a single project named "default". But + # multiple projects are also possible, each using different GHC version. + haskellProjects.default = { + # The base package set representing a specific GHC version. + # By default, this is pkgs.haskellPackages. + # You may also create your own. See https://zero-to-flakes.com/haskell-flake/package-set + # basePackages = pkgs.haskellPackages; + + # Extra package information. See https://zero-to-flakes.com/haskell-flake/dependency + # + # Note that local packages are automatically included in `packages` + # (defined by `defaults.packages` option). + # + # packages = { + # aeson.source = "1.5.0.0"; # Hackage version override + # shower.source = inputs.shower; + # }; + # settings = { + # aeson = { + # check = false; + # }; + # relude = { + # haddock = false; + # broken = false; + # }; + # }; + + devShell = { + # Enabled by default + enable = true; + + # Programs you want to make available in the shell. + # Default programs can be disabled by setting to 'null' + tools = hp: { fourmolu = hp.fourmolu; ghcid = null; }; + + hlsCheck.enable = true; + }; + }; + + # haskell-flake doesn't set the default package, but you can do it here. + packages.default = self'.packages.amazonka-s3-streaming; + }; + }; +}