diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 2f6c4218..31f6f876 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -1,4 +1,16 @@ steps: - label: check trailing whitespace commands: - - .buildkite/check-trailing-whitespace.sh + - .buildkite/check-trailing-whitespace.sh + - label: backend server + commands: + - nix-build -A packages.x86_64-linux.backend-server + - label: backend lib + commands: + - nix-build -A packages.x86_64-linux.backend-lib + - label: backend test + commands: + - nix-build -A checks.x86_64-linux.backend-test + - label: backend hlint + commands: + - nix-shell --run 'hlint backend -j' diff --git a/backend/default.nix b/backend/default.nix new file mode 100644 index 00000000..03281220 --- /dev/null +++ b/backend/default.nix @@ -0,0 +1,15 @@ +{ haskell-nix }: +let + project = haskell-nix.stackProject { + src = haskell-nix.haskellLib.cleanGit { + src = haskell-nix.cleanSourceHaskell { src = ./.; }; + }; + }; + + library = project.edna.components.library; + server = project.edna.components.exes.edna-server; + test = project.edna.checks.edna-test; + +in { + inherit server library test; +} diff --git a/default.nix b/default.nix new file mode 100644 index 00000000..1ef8a22a --- /dev/null +++ b/default.nix @@ -0,0 +1,4 @@ +(import (fetchTarball + "https://github.com/edolstra/flake-compat/archive/master.tar.gz") { + src = builtins.fetchGit ./.; + }).defaultNix diff --git a/flake.lock b/flake.lock new file mode 100644 index 00000000..b322e898 --- /dev/null +++ b/flake.lock @@ -0,0 +1,162 @@ +{ + "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1610051610, + "narHash": "sha256-U9rPz/usA1/Aohhk7Cmc2gBrEEKRzcW4nwPWMPwja4Y=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "3982c9903e93927c2164caa727cd3f6a0e6d14cc", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "hackage": { + "flake": false, + "locked": { + "lastModified": 1613956326, + "narHash": "sha256-SNctpqflg0NKecvS8FcPGQDdPnr3cDzMRLZq+MwKWp0=", + "owner": "input-output-hk", + "repo": "hackage.nix", + "rev": "0c7c981d0512a8759d5381cd8b17ea00e289517f", + "type": "github" + }, + "original": { + "owner": "input-output-hk", + "repo": "hackage.nix", + "type": "github" + } + }, + "haskell-nix": { + "inputs": { + "nixpkgs": "nixpkgs", + "nixpkgs-2003": "nixpkgs-2003", + "nixpkgs-2009": "nixpkgs-2009", + "nixpkgs-unstable": "nixpkgs-unstable" + }, + "locked": { + "lastModified": 1613996756, + "narHash": "sha256-J6JbKCqzpJhlHT3+44vjcvkoX1qJSzOzM31xpS38ysY=", + "owner": "input-output-hk", + "repo": "haskell.nix", + "rev": "c4e5aea19b2436670524a230a0e5e959c8923fd1", + "type": "github" + }, + "original": { + "owner": "input-output-hk", + "repo": "haskell.nix", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1608007629, + "narHash": "sha256-lipVFC/a2pzzA5X2ULj64je+fz1JIp2XRrB5qyoizpQ=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "f02bf8ffb9a5ec5e8f6f66f1e5544fd2aa1a0693", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "f02bf8ffb9a5ec5e8f6f66f1e5544fd2aa1a0693", + "type": "github" + } + }, + "nixpkgs-2003": { + "locked": { + "lastModified": 1607708579, + "narHash": "sha256-QyADEDydJJPa8n3xawnA82IJAcZHNNm6Pp5DU7exMr4=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "7f73e46625f508a793700f5110b86f1a53341d6e", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "7f73e46625f508a793700f5110b86f1a53341d6e", + "type": "github" + } + }, + "nixpkgs-2009": { + "locked": { + "lastModified": 1608007629, + "narHash": "sha256-lipVFC/a2pzzA5X2ULj64je+fz1JIp2XRrB5qyoizpQ=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "f02bf8ffb9a5ec5e8f6f66f1e5544fd2aa1a0693", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "f02bf8ffb9a5ec5e8f6f66f1e5544fd2aa1a0693", + "type": "github" + } + }, + "nixpkgs-unstable": { + "locked": { + "lastModified": 1612284693, + "narHash": "sha256-efzJNF1jvjK3BMl0gZ0ZaUWcFMv0nLb9AHN/++5+u0U=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "410bbd828cdc6156aecd5bc91772ad3a6b1099c7", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "410bbd828cdc6156aecd5bc91772ad3a6b1099c7", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1613641638, + "narHash": "sha256-dZM2usljlkGNU1krgBXRsQ2tHWZExFPnvecullGe504=", + "owner": "serokell", + "repo": "nixpkgs", + "rev": "8a1d9e6a3596d340636eccbbc2cdf7429d4af632", + "type": "github" + }, + "original": { + "owner": "serokell", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "hackage": "hackage", + "haskell-nix": "haskell-nix", + "nixpkgs": "nixpkgs_2", + "stackage": "stackage" + } + }, + "stackage": { + "flake": false, + "locked": { + "lastModified": 1613437366, + "narHash": "sha256-EIMjXbwx41TNR/dWEWJrKbO61h17tzLDNwTheTXrHJU=", + "owner": "input-output-hk", + "repo": "stackage.nix", + "rev": "aba6cc7066d2f5d1179284d708e11751f1c1be78", + "type": "github" + }, + "original": { + "owner": "input-output-hk", + "repo": "stackage.nix", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 00000000..718682df --- /dev/null +++ b/flake.nix @@ -0,0 +1,37 @@ +{ + inputs = { + nixpkgs.url = "github:serokell/nixpkgs"; + haskell-nix.url = "github:input-output-hk/haskell.nix"; + flake-utils.url = "github:numtide/flake-utils"; + + hackage = { + url = "github:input-output-hk/hackage.nix"; + flake = false; + }; + + stackage = { + url = "github:input-output-hk/stackage.nix"; + flake = false; + }; + }; + + outputs = { self, nixpkgs, haskell-nix, hackage, stackage, flake-utils }: + flake-utils.lib.eachSystem [ "x86_64-linux" ] (system: + let + pkgs = nixpkgs.legacyPackages.${system}.extend haskell-nix.overlay; + backend = pkgs.callPackage ./backend { }; + in { + defaultPackage = self.packages.${system}.backend-server; + packages = { + backend-lib = backend.library; + backend-server = backend.server; + }; + + checks.backend-test = backend.test; + + devShell = pkgs.mkShell { + inputsFrom = [ self.packages.${system}.backend-lib ]; + buildInputs = with pkgs.haskellPackages; [ cabal-install hpack hlint ]; + }; + }); +} diff --git a/shell.nix b/shell.nix new file mode 100644 index 00000000..9a25fabd --- /dev/null +++ b/shell.nix @@ -0,0 +1,4 @@ +(import (fetchTarball + "https://github.com/edolstra/flake-compat/archive/master.tar.gz") { + src = builtins.fetchGit ./.; + }).shellNix