1
1
mirror of https://github.com/srid/ema.git synced 2024-09-11 15:05:23 +03:00

nix: Switch to srid/haskell-flake

This commit is contained in:
Sridhar Ratnakumar 2022-05-30 09:32:57 -04:00
parent 50d9499db1
commit fe695a1523
5 changed files with 50 additions and 90 deletions

View File

@ -1,13 +0,0 @@
(import
(
let
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
in
fetchTarball {
url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
sha256 = lock.nodes.flake-compat.locked.narHash;
}
)
{
src = ./.;
}).defaultNix

49
flake.lock generated
View File

@ -1,44 +1,47 @@
{
"nodes": {
"flake-compat": {
"flake": false,
"flake-parts": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1650374568,
"narHash": "sha256-Z+s0J8/r907g149rllvwhb4pKi8Wam5ij0st8PwAh+E=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "b4a34015c698c7793d592d66adbab377907a2be8",
"lastModified": 1653842770,
"narHash": "sha256-hSC8FOXP7x26KHSb5nr+O1L+OEVB+KV5bwmBynGkG0A=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "7678eacc0c5cc4f0365bc1eb911f5f82ad11f0ab",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"flake-utils": {
"haskell-flake": {
"locked": {
"lastModified": 1652776076,
"narHash": "sha256-gzTw/v1vj4dOVbpBSJX4J0DwUR6LIyXo7/SuuTJp1kM=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "04c1b180862888302ddfb2e3ad9eaa63afc60cf8",
"lastModified": 1653916807,
"narHash": "sha256-/KUjc/V/kX5vzETBJZATtcuZkOd1doBsQx1ym3pK/Sw=",
"owner": "srid",
"repo": "haskell-flake",
"rev": "8e50bc13116f301e3716568f4c5723122c4c66a7",
"type": "github"
},
"original": {
"owner": "numtide",
"ref": "v1.0.0",
"repo": "flake-utils",
"owner": "srid",
"repo": "haskell-flake",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1652885393,
"narHash": "sha256-YIgvvlk4iQ1Hi7KD9o5gsojc+ApB+jiH1d5stK8uXiw=",
"lastModified": 1653581809,
"narHash": "sha256-Uvka0V5MTGbeOfWte25+tfRL3moECDh1VwokWSZUdoY=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "48037fd90426e44e4bf03e6479e88a11453b9b66",
"rev": "83658b28fe638a170a19b8933aa008b30640fbd1",
"type": "github"
},
"original": {
@ -50,8 +53,8 @@
},
"root": {
"inputs": {
"flake-compat": "flake-compat",
"flake-utils": "flake-utils",
"flake-parts": "flake-parts",
"haskell-flake": "haskell-flake",
"nixpkgs": "nixpkgs"
}
}

View File

@ -2,54 +2,27 @@
description = "Ema project";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils/v1.0.0";
flake-utils.inputs.nixpkgs.follows = "nixpkgs";
flake-compat.url = "github:edolstra/flake-compat";
flake-compat.flake = false;
flake-parts.url = "github:hercules-ci/flake-parts";
flake-parts.inputs.nixpkgs.follows = "nixpkgs";
haskell-flake.url = "github:srid/haskell-flake";
};
outputs = inputs@{ self, nixpkgs, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem
(system:
let
name = "ema";
pkgs = nixpkgs.legacyPackages.${system};
hp = pkgs.haskellPackages;
emaProject = returnShellEnv:
hp.developPackage {
inherit name returnShellEnv;
root = ./.;
withHoogle = false;
overrides = self: super: with pkgs.haskell.lib; {
# lvar = self.callCabal2nix "lvar" inputs.lvar { };
# url-slug = inputs.url-slug.defaultPackage.${system};
};
modifier = drv:
pkgs.haskell.lib.addBuildTools drv
(with hp; pkgs.lib.lists.optionals returnShellEnv [
# Specify your build/dev dependencies here.
cabal-fmt
cabal-install
ghcid
haskell-language-server
ormolu
pkgs.nixpkgs-fmt
pkgs.treefmt
]);
};
in
rec {
# Used by `nix build`
defaultPackage = packages.default;
# Used by `nix run`
defaultApp = packages.default;
# Used by `nix develop`
devShell = emaProject true;
packages = {
default = emaProject false;
outputs = { self, nixpkgs, flake-parts, haskell-flake, ... }:
flake-parts.lib.mkFlake { inherit self; } {
systems = nixpkgs.lib.systems.flakeExposed;
imports = [
haskell-flake.flakeModule
];
perSystem = { self', pkgs, ... }: {
haskellProjects.ema = {
buildTools = hp: {
inherit (pkgs)
treefmt
nixpkgs-fmt;
inherit (hp)
cabal-fmt
ormolu;
};
}) // {
herculesCI.ciSystems = [ "x86_64-linux" ];
};
};
};
}

View File

@ -1,2 +0,0 @@
cradle:
cabal:

View File

@ -1,11 +1,10 @@
# TODO: Remove this after https://github.com/srid/haskell-template/issues/23
(import
(
let
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
in
fetchTarball {
url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
sha256 = lock.nodes.flake-compat.locked.narHash;
url = "https://github.com/edolstra/flake-compat/archive/b4a34015c698c7793d592d66adbab377907a2be8.tar.gz";
sha256 = "sha256-Z+s0J8/r907g149rllvwhb4pKi8Wam5ij0st8PwAh+E=";
}
)
{