Switch flake.nix architecture

This commit is contained in:
Kiana Sheibani 2022-03-11 23:01:32 -05:00
parent 6c3742e148
commit adb081fd22

View file

@ -1,7 +1,3 @@
# SPDX-FileCopyrightText: 2021 Serokell <https://serokell.io/>
#
# SPDX-License-Identifier: CC0-1.0
{
description = "Conway's Game of Life in Haskell";
@ -13,44 +9,48 @@
outputs = { self, nixpkgs, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
haskellPackages = pkgs.haskellPackages;
jailbreakUnbreak = pkg:
pkgs.haskell.lib.doJailbreak (pkg.overrideAttrs (_: { meta = { }; }));
packageName = "conways-game-of-life";
overlays = [ ];
pkgs = import nixpkgs { inherit system overlays; config.allowBroken = true; };
execName = "gol";
in {
packages.${packageName} =
haskellPackages.callCabal2nix packageName self rec {
# Dependency overrides go here
hp = pkgs.haskellPackages; # pkgs.haskell.packages.ghc921;
project = returnShellEnv:
hp.developPackage {
inherit returnShellEnv;
name = "conways-game-of-life";
root = ./.;
withHoogle = false;
overrides = self: super: with pkgs.haskell.lib; {
# Use callCabal2nix to override Haskell dependencies here
# cf. https://tek.brick.do/K3VXJd8mEKO7
# Example:
# > NanoID = self.callCabal2nix "NanoID" inputs.NanoID { };
# Assumes that you have the 'NanoID' flake input defined.
};
defaultPackage = self.packages.${system}.${packageName};
apps.${execName} = {
type = "app";
program = "${self.packages.${system}.${packageName}}/bin/${execName}";
};
defaultApp = self.apps.${system}.${execName};
devShell = pkgs.mkShell {
buildInputs = with haskellPackages; [
modifier = drv:
pkgs.haskell.lib.addBuildTools drv (with hp; [
# Specify your build/dev dependencies here.
ghc
cabal-install
hlint
pkgs.haskell-language-server
pkgs.ormolu
haskell-language-server
ormolu
pkgs.mesa
pkgs.mesa_glu
pkgs.freeglut
];
inputsFrom = builtins.attrValues self.packages.${system};
]);
};
in
{
# Used by `nix build` & `nix run` (prod exe)
defaultPackage = project false;
defaultApp = {
type = "app";
program = "${self.defaultPackage.${system}}/bin/${execName}";
};
# Used by `nix develop` (dev shell)
devShell = project true;
});
}