From 1da3202fe3468b5d78fe6a352ed5048621460c8b Mon Sep 17 00:00:00 2001
From: Jens Nolte <git@queezle.net>
Date: Fri, 9 Jul 2021 23:05:13 +0200
Subject: [PATCH] Extract library from `qd`-project

All commits before this point are extracted from the `qd` repository.

The commits have been filtered to only include relevant files. I hope
this is a good compromise between squashing all history and having the
full history of another project attached to this repository.
---
 .gitignore   |  3 +++
 README.md    |  1 +
 default.nix  |  7 +++++
 flake.lock   | 24 +++++++++++++++++
 flake.nix    | 25 +++++++++++++++++
 quasar.cabal | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 6 files changed, 136 insertions(+)
 create mode 100644 .gitignore
 create mode 100644 README.md
 create mode 100644 default.nix
 create mode 100644 flake.lock
 create mode 100644 flake.nix
 create mode 100644 quasar.cabal

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..0feadf9
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,3 @@
+*~
+dist-newstyle
+result*
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..2e1c0b1
--- /dev/null
+++ b/README.md
@@ -0,0 +1 @@
+# quasar
diff --git a/default.nix b/default.nix
new file mode 100644
index 0000000..5fe474a
--- /dev/null
+++ b/default.nix
@@ -0,0 +1,7 @@
+{ pkgs ? import <nixpkgs> {}, haskellPackages ? pkgs.haskellPackages, args ? {} }:
+
+let
+  drv = haskellPackages.callCabal2nix "quasar" ./. args;
+
+in
+  if pkgs.lib.inNixShell then drv.env else drv
diff --git a/flake.lock b/flake.lock
new file mode 100644
index 0000000..1984b43
--- /dev/null
+++ b/flake.lock
@@ -0,0 +1,24 @@
+{
+  "nodes": {
+    "nixpkgs": {
+      "locked": {
+        "lastModified": 1623154001,
+        "narHash": "sha256-KxsIXg5ez5SveGayOKcW+MnofqVuLnwZHE5mZgtRAJo=",
+        "path": "/nix/store/r35z76cadipjzjrjik06gp1kfbqlhdck-source",
+        "rev": "3bc8e5cd23b84b2e149e7aaad57117da16a19e6f",
+        "type": "path"
+      },
+      "original": {
+        "id": "nixpkgs",
+        "type": "indirect"
+      }
+    },
+    "root": {
+      "inputs": {
+        "nixpkgs": "nixpkgs"
+      }
+    }
+  },
+  "root": "root",
+  "version": 7
+}
diff --git a/flake.nix b/flake.nix
new file mode 100644
index 0000000..e530c0a
--- /dev/null
+++ b/flake.nix
@@ -0,0 +1,25 @@
+{
+  outputs = { self, nixpkgs }:
+  with nixpkgs.lib;
+  let
+    forAllSystems = genAttrs ["x86_64-linux" "aarch64-linux"];
+    pkgs = forAllSystems (system: import nixpkgs { inherit system; overlays = [ self.overlay ]; });
+  in {
+
+    devShell = forAllSystems (system: pkgs.${system}.haskellPackages.quasar.env);
+
+    defaultPackage = forAllSystems (system: pkgs.${system}.haskellPackages.quasar);
+
+    overlay = final: prev: {
+      haskell = prev.haskell // {
+        packageOverrides = hfinal: hprev: prev.haskell.packageOverrides hfinal hprev // {
+          quasar = import ./. {
+            pkgs = final;
+            haskellPackages = hfinal;
+          };
+        };
+      };
+    };
+
+  };
+}
diff --git a/quasar.cabal b/quasar.cabal
new file mode 100644
index 0000000..5b08e1d
--- /dev/null
+++ b/quasar.cabal
@@ -0,0 +1,76 @@
+cabal-version: 3.0
+
+name:           quasar
+version:        0.1.0.0
+license:        NONE
+build-type:     Simple
+extra-source-files:
+    README.md
+
+--source-repository head
+--  type: git
+--  location: https://git.c3pb.de/jens/quasar.git
+
+common shared-properties
+  default-extensions:
+    AllowAmbiguousTypes
+    BangPatterns
+    DataKinds
+    DefaultSignatures
+    DeriveAnyClass
+    DeriveGeneric
+    DerivingStrategies
+    DuplicateRecordFields
+    ExistentialQuantification
+    FlexibleContexts
+    FlexibleInstances
+    FunctionalDependencies
+    GADTs
+    GeneralizedNewtypeDeriving
+    InstanceSigs
+    LambdaCase
+    MultiParamTypeClasses
+    NamedFieldPuns
+    NoImplicitPrelude
+    OverloadedStrings
+    RankNTypes
+    ScopedTypeVariables
+    StandaloneDeriving
+    TemplateHaskell
+    TupleSections
+    TypeApplications
+    TypeFamilies
+    TypeOperators
+  build-depends:
+    base >=4.7 && <5,
+    binary,
+    ghc-prim,
+    hashable,
+    microlens-platform,
+    mtl,
+    template-haskell,
+    transformers,
+    unordered-containers,
+  default-language: Haskell2010
+  ghc-options: -fwarn-unused-do-bind -fwarn-tabs -Wall -Wincomplete-uni-patterns -Wpartial-fields
+
+common shared-executable-properties
+  import: shared-properties
+  ghc-options: -fwarn-unused-do-bind -fwarn-tabs -Wall -Wincomplete-uni-patterns -Wpartial-fields -threaded -rtsopts "-with-rtsopts=-N -I0"
+
+library
+  import: shared-properties
+  exposed-modules:
+  hs-source-dirs:
+    src
+
+test-suite quasar-test
+  import: shared-executable-properties
+  type: exitcode-stdio-1.0
+  build-depends:
+    quasar,
+    hspec,
+  main-is: Spec.hs
+  other-modules:
+  hs-source-dirs:
+    test
-- 
GitLab