From 6bd9f1715fc2e1d4548046e3ce2bd91d64625a1e Mon Sep 17 00:00:00 2001 From: Justin Bedo Date: Thu, 29 Jul 2021 16:47:54 +1000 Subject: convert nix expressions to flakes --- biohazard.patch | 28 +++++++++++++++++++++++++++- default.nix | 14 +++++++------- flake.lock | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 15 +++++++++++++++ shell.nix | 19 ++++++++++--------- 5 files changed, 116 insertions(+), 17 deletions(-) create mode 100644 flake.lock create mode 100644 flake.nix 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 { }; +{ 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 { }; +{ 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 ]; } -- cgit v1.2.3