From b8499c812a09954c411420ea64e110abcf51f012 Mon Sep 17 00:00:00 2001
From: Jens Nolte <git@queezle.net>
Date: Thu, 11 Feb 2021 18:45:55 +0100
Subject: [PATCH] Get qd package and module from flakeInput

---
 configuration.nix   | 12 ++++++++++--
 machine-manager.nix |  2 +-
 pkgs/default.nix    |  2 --
 pkgs/qd/default.nix | 11 -----------
 pkgs/qd/repo.json   | 11 -----------
 pkgs/qd/update      |  7 -------
 6 files changed, 11 insertions(+), 34 deletions(-)
 delete mode 100644 pkgs/qd/default.nix
 delete mode 100644 pkgs/qd/repo.json
 delete mode 100755 pkgs/qd/update

diff --git a/configuration.nix b/configuration.nix
index bf25141..0b41b6b 100644
--- a/configuration.nix
+++ b/configuration.nix
@@ -1,5 +1,5 @@
 # This is the entry point for my NixOS configuration.
-{ name, path, channel, isIso, extraLayersDir, flakeInputs, flakeOutputs }:
+{ name, path, channel, isIso, extraLayersDir, flakeInputs, flakeOutputs, system }:
 { lib, config, pkgs, ... }:
 
 let
@@ -45,6 +45,7 @@ in
     (path + "/configuration.nix")
     normalSystemConfiguration
     flakeInputs.homemanager.nixosModules.home-manager
+    flakeInputs.qd.nixosModules.qd
   ] ++ layerImports;
 
   home-manager = {
@@ -55,7 +56,14 @@ in
 
   _module.args.isIso = lib.mkDefault false;
 
-  nixpkgs.overlays = [ (import ./pkgs) ];
+  nixpkgs.overlays = [
+    (import ./pkgs)
+    (self: super:
+      {
+        qd = flakeInputs.qd.packages."${system}".qd;
+      }
+    )
+  ];
 
   # Pin channel in nix path
   nix.nixPath = [ "nixpkgs=${channel}" ];
diff --git a/machine-manager.nix b/machine-manager.nix
index 7f35df8..0f07840 100644
--- a/machine-manager.nix
+++ b/machine-manager.nix
@@ -40,7 +40,7 @@ let
       mkMachineConfig = { name, path, isIso }: {
         imports = [
           (import ./configuration.nix {
-            inherit name path isIso extraLayersDir flakeInputs flakeOutputs;
+            inherit name path isIso extraLayersDir flakeInputs flakeOutputs system;
             channel = machineChannels.${name};
           })
         ];
diff --git a/pkgs/default.nix b/pkgs/default.nix
index 8d7db29..a7386e0 100644
--- a/pkgs/default.nix
+++ b/pkgs/default.nix
@@ -18,7 +18,6 @@ rec {
       #net-mqtt = self.haskell.lib.doJailbreak hsuper.net-mqtt;
       net-mqtt = self.haskell.lib.unmarkBroken hsuper.net-mqtt;
       q = hself.callPackage ./q {};
-      qd = hself.callPackage ./qd {};
       qbar = hself.callPackage ./qbar {};
     };
   };
@@ -39,6 +38,5 @@ rec {
   };
 
   q = self.haskellPackages.q;
-  qd = self.haskellPackages.qd;
   qbar = self.haskellPackages.qbar;
 }
diff --git a/pkgs/qd/default.nix b/pkgs/qd/default.nix
deleted file mode 100644
index 8b245c8..0000000
--- a/pkgs/qd/default.nix
+++ /dev/null
@@ -1,11 +0,0 @@
-{ haskell, fetchgit, callCabal2nix }:
-
-let
-  repo = with builtins; fromJSON ( readFile ./repo.json );
-  src = fetchgit {
-    inherit (repo) url rev sha256;
-  };
-in
-haskell.lib.generateOptparseApplicativeCompletions ["qd" "qctl"] (
-  callCabal2nix "qd" src {}
-)
diff --git a/pkgs/qd/repo.json b/pkgs/qd/repo.json
deleted file mode 100644
index 0a4f831..0000000
--- a/pkgs/qd/repo.json
+++ /dev/null
@@ -1,11 +0,0 @@
-{
-  "ref": "refs/heads/master",
-  "url": "https://git.c3pb.de/jens/qd.git",
-  "rev": "ec42f49c3c12855022fcaaff007ff9172472f63e",
-  "date": "2020-12-05T23:21:18+01:00",
-  "path": "/nix/store/da49nck17db2gi95lcmwq09cxdaiyy65-qd",
-  "sha256": "16vjnh2x0pqvfzy32rc97gza0ixmr8447jd8s5ippwkf0rc7krns",
-  "fetchSubmodules": false,
-  "deepClone": false,
-  "leaveDotGit": false
-}
diff --git a/pkgs/qd/update b/pkgs/qd/update
deleted file mode 100755
index 15576a3..0000000
--- a/pkgs/qd/update
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/usr/bin/env nix-shell
-#! nix-shell -i sh -p nix-prefetch-git jq
-
-url="https://git.c3pb.de/jens/qd.git"
-ref="refs/heads/master"
-
-nix-prefetch-git --rev "$ref" --no-deepClone "$url" | jq --arg ref "$ref" '{ref: $ref} + .' > repo.json
-- 
GitLab