Enable flakes support

This commit is contained in:
Mats Rauhala 2021-11-15 20:50:03 +02:00
parent 8233419e19
commit 5cff649141
3 changed files with 129 additions and 35 deletions

75
flake.lock Normal file
View File

@ -0,0 +1,75 @@
{
"nodes": {
"easy-hls-src": {
"inputs": {
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1636606878,
"narHash": "sha256-rLxYl7iYP9vQhSvVlV2uRCdgrqKDz/vN1Z8ZmA8itkM=",
"owner": "jkachmar",
"repo": "easy-hls-nix",
"rev": "edd5710946d46ea40810ef9a708b084d7e05a118",
"type": "github"
},
"original": {
"owner": "jkachmar",
"repo": "easy-hls-nix",
"type": "github"
}
},
"flake-utils": {
"locked": {
"lastModified": 1634851050,
"narHash": "sha256-N83GlSGPJJdcqhUxSCS/WwW5pksYf3VP1M13cDRTSVA=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "c91f3de5adaf1de973b797ef7485e441a65b8935",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1636983198,
"narHash": "sha256-ductPDqewBTMB0ZWSJo3wc99RaR6MzbRf6wjWsMjqoM=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "d04b41c582c69405f1fb1272711967f777cca883",
"type": "github"
},
"original": {
"owner": "nixos",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1636979576,
"narHash": "sha256-Iy2J3T7xyHk43cVj4gGv74MKvVOCOqoqzffO3k5mbpU=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "4ea0167baf7126e424edb7ed2be27c0f6008dafb",
"type": "github"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
"root": {
"inputs": {
"easy-hls-src": "easy-hls-src",
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs_2"
}
}
},
"root": "root",
"version": 7
}

46
flake.nix Normal file
View File

@ -0,0 +1,46 @@
{
description = "FeedMonad";
inputs = {
easy-hls-src = { url = "github:jkachmar/easy-hls-nix"; };
flake-utils = { url = "github:numtide/flake-utils"; };
};
outputs = { self, nixpkgs, flake-utils, easy-hls-src }:
flake-utils.lib.eachSystem ["x86_64-linux" "x86_64-darwin"] ( system:
let
pkgs = nixpkgs.legacyPackages.${system};
hp = pkgs.haskellPackages.extend (self: super: {
FeedMonad = self.callPackage ./FeedMonad {};
FeedMonad-demo = self.callPackage ./FeedMonad-demo {};
});
easy-hls = pkgs.callPackage easy-hls-src { ghcVersions = [ hp.ghc.version ]; };
in
rec {
packages = { inherit (hp) FeedMonad FeedMonad-demo; };
defaultPackage = packages.FeedMonad;
apps.FeedMonad-demo = {
type = "app";
program = "${hp.FeedMonad-demo}/bin/FeedMonad-demo";
};
devShell = hp.shellFor {
packages = h: [h.FeedMonad h.FeedMonad-demo];
withHoogle = true;
buildInputs = with pkgs; [
entr
cabal-install
hp.hlint
stylish-haskell
ghcid
easy-hls
sqlite-interactive
hp.graphmod
];
};
}
);
}

View File

@ -1,35 +1,8 @@
{ nixpkgs ? import <nixpkgs> {} }:
with nixpkgs;
let
easy-hls-src = fetchFromGitHub {
owner = "ssbothwell";
repo = "easy-hls-nix";
inherit (builtins.fromJSON (builtins.readFile ./easy-hls-nix.json)) rev sha256;
};
easy-hls = callPackage easy-hls-src { ghcVersions = [ hp.ghc.version ]; };
hp = haskellPackages.extend (self: super: {
FeedMonad = self.callPackage ./FeedMonad {};
FeedMonad-demo = self.callPackage ./FeedMonad-demo {};
});
in
hp.shellFor {
packages = h: [h.FeedMonad h.FeedMonad-demo];
withHoogle = true;
buildInputs = [
entr
cabal-install
haskellPackages.hlint
stylish-haskell
ghcid
easy-hls
sqlite-interactive
haskellPackages.graphmod
];
}
# https://nixos.wiki/wiki/Flakes#Using_flakes_project_from_a_legacy_Nix
(import (
fetchTarball {
url = "https://github.com/edolstra/flake-compat/archive/99f1c2157fba4bfe6211a321fd0ee43199025dbf.tar.gz";
sha256 = "0x2jn3vrawwv9xp15674wjz9pixwjyj3j771izayl962zziivbx2"; }
) {
src = ./.;
}).defaultNix