aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Bedo <cu@cua0.org>2021-07-29 16:47:54 +1000
committerJustin Bedo <cu@cua0.org>2021-07-29 16:47:54 +1000
commit6bd9f1715fc2e1d4548046e3ce2bd91d64625a1e (patch)
treebb557c5ab200f0f7a691e737b59b5044177e0c04
parent7c29ef494f974b457bfef6a5af7d37fa03bb7952 (diff)
convert nix expressions to flakes
-rw-r--r--biohazard.patch28
-rw-r--r--default.nix14
-rw-r--r--flake.lock57
-rw-r--r--flake.nix15
-rw-r--r--shell.nix19
5 files changed, 116 insertions, 17 deletions
diff --git a/biohazard.patch b/biohazard.patch
index b075312..a0302b1 100644
--- a/biohazard.patch
+++ b/biohazard.patch
@@ -1,5 +1,31 @@
+diff --git a/Bio/Bam/Regions.hs b/Bio/Bam/Regions.hs
+index 43992f7..ea20144 100644
+--- a/Bio/Bam/Regions.hs
++++ b/Bio/Bam/Regions.hs
+@@ -9,7 +9,7 @@ module Bio.Bam.Regions
+ ) where
+
+ import Bio.Bam.Header ( Refseq(..) )
+-import Bio.Prelude hiding ( toList )
++import Bio.Prelude hiding ( toList, fromList )
+
+ import qualified Data.IntMap.Strict as IM
+
+diff --git a/Bio/Streaming/Bytes.hs b/Bio/Streaming/Bytes.hs
+index 0651278..7f3454a 100644
+--- a/Bio/Streaming/Bytes.hs
++++ b/Bio/Streaming/Bytes.hs
+@@ -118,7 +118,7 @@ module Bio.Streaming.Bytes (
+
+ ) where
+
+-import Bio.Prelude hiding (break,concat,drop,dropWhile,lines,splitAt,writeFile,empty,loop)
++import Bio.Prelude hiding (break,concat,drop,dropWhile,lines,splitAt,writeFile,empty,loop,hGetContents)
+ import Data.ByteString.Builder.Internal
+ (Builder,builder,runBuilder,runBuilderWith,bufferSize
+ ,AllocationStrategy,ChunkIOStream(..),buildStepToCIOS
diff --git a/Control/Monad/Log.hs b/Control/Monad/Log.hs
-index 5b6598a..de4589f 100644
+index de85bf2..7e49c4b 100644
--- a/Control/Monad/Log.hs
+++ b/Control/Monad/Log.hs
@@ -14,7 +14,7 @@ module Control.Monad.Log
diff --git a/default.nix b/default.nix
index 3314d66..638cbcc 100644
--- a/default.nix
+++ b/default.nix
@@ -1,16 +1,16 @@
-let
- pkgs = import <nixpkgs> { };
+{ stdenv, ghc, haskell, biohazardSrc }:
- ghc = with pkgs.haskell.lib;
- pkgs.ghc.withPackages (pkgs:
+let
+ ghcP = with haskell.lib;
+ ghc.withPackages (pkgs:
with pkgs;
[
(doJailbreak (markUnbroken
- (biohazard.overrideAttrs (_: { patches = [ ./biohazard.patch ]; }))))
+ (biohazard.overrideAttrs (_: { src = biohazardSrc; patches = [ ./biohazard.patch ];}))))
]);
-in pkgs.stdenv.mkDerivation {
+in stdenv.mkDerivation {
name = "xenomapper-hs";
- buildInputs = [ ghc ];
+ buildInputs = [ ghcP ];
src = ./.;
buildPhase = ''
ghc -O3 xenomapper.hs -o xenomapper
diff --git a/flake.lock b/flake.lock
new file mode 100644
index 0000000..7a62bf2
--- /dev/null
+++ b/flake.lock
@@ -0,0 +1,57 @@
+{
+ "nodes": {
+ "biohazard": {
+ "flake": false,
+ "locked": {
+ "lastModified": 1620395427,
+ "narHash": "sha256-OKzCw/YU2XKGwszE6s1LXAJ/IX4GdjjXpNG/alDSq+g=",
+ "ref": "master",
+ "rev": "41e9b940d5ec422f5097b029b3a2e11a5ac4768f",
+ "revCount": 732,
+ "type": "git",
+ "url": "https://bitbucket.org/ustenzel/biohazard/"
+ },
+ "original": {
+ "type": "git",
+ "url": "https://bitbucket.org/ustenzel/biohazard/"
+ }
+ },
+ "flake-utils": {
+ "locked": {
+ "lastModified": 1623875721,
+ "narHash": "sha256-A8BU7bjS5GirpAUv4QA+QnJ4CceLHkcXdRp4xITDB0s=",
+ "owner": "numtide",
+ "repo": "flake-utils",
+ "rev": "f7e004a55b120c02ecb6219596820fcd32ca8772",
+ "type": "github"
+ },
+ "original": {
+ "owner": "numtide",
+ "repo": "flake-utils",
+ "type": "github"
+ }
+ },
+ "nixpkgs": {
+ "locked": {
+ "lastModified": 1626852498,
+ "narHash": "sha256-lOXUJvi0FJUXHTVSiC5qsMRtEUgqM4mGZpMESLuGhmo=",
+ "path": "/nix/store/g2g13rv513i8z8rav2imcfk49fm8bac1-source",
+ "rev": "16105403bdd843540cbef9c63fc0f16c1c6eaa70",
+ "type": "path"
+ },
+ "original": {
+ "id": "nixpkgs",
+ "type": "indirect"
+ }
+ },
+ "root": {
+ "inputs": {
+ "biohazard": "biohazard",
+ "flake-utils": "flake-utils",
+ "nixpkgs": "nixpkgs"
+ }
+ }
+ },
+ "root": "root",
+ "version": 7
+}
diff --git a/flake.nix b/flake.nix
new file mode 100644
index 0000000..51c9048
--- /dev/null
+++ b/flake.nix
@@ -0,0 +1,15 @@
+{
+ inputs.flake-utils.url = "github:numtide/flake-utils";
+ inputs.biohazard = {
+ url = "git+https://bitbucket.org/ustenzel/biohazard/";
+ flake = false;
+ };
+
+ outputs = { self, nixpkgs, flake-utils, biohazard }:
+ flake-utils.lib.eachDefaultSystem (system:
+ let pkgs = nixpkgs.legacyPackages.${system};
+ in {
+ devShell = pkgs.callPackage ./shell.nix { biohazardSrc = biohazard; };
+ defaultPackage = pkgs.callPackage ./default.nix { biohazardSrc = biohazard; };
+ });
+}
diff --git a/shell.nix b/shell.nix
index 40ee189..339bb5d 100644
--- a/shell.nix
+++ b/shell.nix
@@ -1,12 +1,13 @@
-let
- pkgs = import <nixpkgs> { };
+{ mkShell, ghc, haskell, biohazardSrc }:
- ghc = with pkgs.haskell.lib;
- pkgs.ghc.withPackages (pkgs:
- with pkgs;
- [
+let
+ ghcP = with haskell.lib;
+ ghc.withPackages (pkgs:
+ with pkgs; [
hlint
- (doJailbreak (markUnbroken
- (biohazard.overrideAttrs (_: { patches = [ ./biohazard.patch ]; }))))
+ (doJailbreak (markUnbroken (biohazard.overrideAttrs (_: {
+ src = biohazardSrc;
+ patches = [ ./biohazard.patch ];
+ }))))
]);
-in pkgs.mkShell { buildInputs = [ ghc ]; }
+in mkShell { buildInputs = [ ghcP ]; }