From 1fe7714c6b6f0e5c1f5afbdcb5b03454eaa6d3d7 Mon Sep 17 00:00:00 2001 From: "Niels G. W. Serup" Date: Thu, 12 Sep 2024 19:49:58 +0200 Subject: [PATCH] Add a default.nix for nix-build --- byg/byg.cabal | 2 +- byg/default.nix | 2 ++ byg/nix/common.nix | 9 +++++++++ byg/shell.nix | 13 ++++--------- 4 files changed, 16 insertions(+), 10 deletions(-) create mode 100644 byg/default.nix create mode 100644 byg/nix/common.nix diff --git a/byg/byg.cabal b/byg/byg.cabal index 08f8778..53eccb0 100644 --- a/byg/byg.cabal +++ b/byg/byg.cabal @@ -1,4 +1,4 @@ -cabal-version: 3.12 +cabal-version: 3.8 name: byg version: 0.1.0.0 synopsis: The website builder for mad diff --git a/byg/default.nix b/byg/default.nix new file mode 100644 index 0000000..541d5d7 --- /dev/null +++ b/byg/default.nix @@ -0,0 +1,2 @@ +with import ./nix/common.nix; +haskell.callCabal2nix "byg" ./. { } diff --git a/byg/nix/common.nix b/byg/nix/common.nix new file mode 100644 index 0000000..e9492f6 --- /dev/null +++ b/byg/nix/common.nix @@ -0,0 +1,9 @@ +let + sources = import ./sources.nix; + pkgs = import sources.nixpkgs {}; + haskell = pkgs.haskell.packages.ghc910; +in +{ + pkgs = pkgs; + haskell = haskell; +} diff --git a/byg/shell.nix b/byg/shell.nix index db57e9a..1b72266 100644 --- a/byg/shell.nix +++ b/byg/shell.nix @@ -1,12 +1,7 @@ -let - sources = import ./nix/sources.nix; - pkgs = import sources.nixpkgs {}; - haskell = pkgs.haskell.packages.ghc910; -in -pkgs.stdenv.mkDerivation { - name = "byg"; - buildInputs = with pkgs; [ +with import ./nix/common.nix; +pkgs.mkShell { + buildInputs = [ haskell.ghc - cabal-install + pkgs.cabal-install ]; }