ctucx.git: nixfiles

ctucx' nixfiles

commit 63193b387424da3705bf255acc4ea107c4d6099c
parent dd4e3a37f0092ead3de5e4bffd700bcbb264dbda
Author: Leah (ctucx) <git@ctu.cx>
Date: Sat, 10 Dec 2022 20:41:57 +0100

flake: refactor overlay handling
8 files changed, 133 insertions(+), 107 deletions(-)
M
configurations/common/default.nix
|
1
-
M
configurations/darwin/default.nix
|
1
-
M
flake.lock
|
17
+++++++++++++++++
M
flake.nix
|
93
++++++++++++++++++++++++++++++++++++++++++++++++++++++++-----------------------
M
hive.nix
|
21
++-------------------
A
pkgs/darwin-overlay.nix
|
27
+++++++++++++++++++++++++++
D
pkgs/default.nix
|
59
-----------------------------------------------------------
A
pkgs/overlay.nix
|
21
+++++++++++++++++++++
diff --git a/configurations/common/default.nix b/configurations/common/default.nix
@@ -4,7 +4,6 @@
 
   imports = (builtins.concatLists [
     [
-      ../../pkgs
       ../../modules
 
       ./programs/bash.nix
diff --git a/configurations/darwin/default.nix b/configurations/darwin/default.nix
@@ -11,7 +11,6 @@
     ./finder.nix
     ./skhd.nix
     ./yabai.nix
-    ./speakers.nix
     ./syncthing.nix
     ./dock.nix
 
diff --git a/flake.lock b/flake.lock
@@ -442,6 +442,22 @@
         "type": "indirect"
       }
     },
+    "nixpkgsDarwin": {
+      "locked": {
+        "lastModified": 1670607846,
+        "narHash": "sha256-2tT5sXWs884FJZxZNcsm+6gAvWJeHZ8ilfhvykL4YMo=",
+        "owner": "NixOS",
+        "repo": "nixpkgs",
+        "rev": "fd26d2bd8d0e4f3248a3cca0f405fb60117ab988",
+        "type": "github"
+      },
+      "original": {
+        "owner": "NixOS",
+        "ref": "nixpkgs-22.11-darwin",
+        "repo": "nixpkgs",
+        "type": "github"
+      }
+    },
     "nixpkgsUnstable": {
       "locked": {
         "lastModified": 1669261230,

@@ -524,6 +540,7 @@
         "mqtt-webui": "mqtt-webui",
         "nix-std": "nix-std",
         "nixpkgs": "nixpkgs",
+        "nixpkgsDarwin": "nixpkgsDarwin",
         "nixpkgsUnstable": "nixpkgsUnstable",
         "oeffi-web": "oeffi-web",
         "oeffisearch": "oeffisearch",
diff --git a/flake.nix b/flake.nix
@@ -2,6 +2,65 @@
 
   description = "A flake for building Hello World";
 
+  outputs = inputs: rec {
+    overlays = [
+      (import ./pkgs/overlay.nix)
+
+      (final: prev: {
+        dns = inputs.dns;
+        unstable = inputs.nixpkgsUnstable.legacyPackages.${prev.system};
+      })
+
+      inputs.agenix.overlay
+      inputs.colmena.overlay
+
+      inputs.stagit.overlay
+
+      inputs.bikemap.overlay
+      inputs.mobile-coverage-map.overlay
+
+      inputs.sdm2mqtt.overlay
+      inputs.lacrosse2mqtt.overlay
+      inputs.mqtt-webui.overlay
+
+      inputs.ctucx-things.overlay
+      inputs.ctucx-gallery.overlay
+
+      inputs.oeffisearch.overlay
+      inputs.oeffi-web.overlay
+
+      inputs.flauschehorn-sexy.overlay
+    ];
+
+    darwinConfigurations = {
+
+      blechbuechse = let
+        system = "aarch64-darwin";
+      in inputs.darwin.lib.darwinSystem {
+        inherit system;
+        pkgs = import inputs.nixpkgsDarwin {
+          inherit system;
+          overlays = overlays ++ [(import ./pkgs/darwin-overlay.nix)];
+        };
+        specialArgs = {
+          currentSystem = system;
+          inherit inputs;
+        };
+        modules = [ ./machines/blechbuechse/darwin-configuration.nix ];
+      };
+
+    };
+
+    colmena = import ./hive.nix inputs overlays;
+
+    nixosConfigurations = (import (inputs.colmena + "/src/nix/hive/eval.nix") {
+      rawFlake = inputs.self;
+      colmenaOptions = import (inputs.colmena + "/src/nix/hive/options.nix");
+      colmenaModules = import (inputs.colmena + "/src/nix/hive/modules.nix");
+    }).nodes;
+
+  };
+
   inputs = {
     nixpkgs = {
       type  = "github";

@@ -10,6 +69,13 @@
       ref   = "nixos-22.11";
     };
 
+    nixpkgsDarwin = {
+      type  = "github";
+      owner = "NixOS";
+      repo  = "nixpkgs";
+      ref   = "nixpkgs-22.11-darwin";
+    };
+
     nixpkgsUnstable = {
       type  = "github";
       owner = "NixOS";

@@ -169,31 +235,4 @@
     local-secrets.url = "/tmp/nix-secrets";
   };
 
-  outputs = inputs: {
-
-    darwinConfigurations = {
-
-      blechbuechse = inputs.darwin.lib.darwinSystem rec {
-        system = "aarch64-darwin";
-        specialArgs = {
-          currentSystem = system;
-          inherit inputs;
-        };
-        modules = [ ./machines/blechbuechse/darwin-configuration.nix ];
-      };
-
-    };
-
-    colmena = import ./hive.nix inputs;
-
-    nixosConfigurations = (import (inputs.colmena + "/src/nix/hive/eval.nix") {
-      rawFlake = inputs.self;
-      colmenaOptions = import (inputs.colmena + "/src/nix/hive/options.nix");
-      colmenaModules = import (inputs.colmena + "/src/nix/hive/modules.nix");
-    }).nodes;
-
-    inherit (inputs.colmena) packages;
-
-  };
-
 }
diff --git a/hive.nix b/hive.nix
@@ -1,28 +1,11 @@
-inputs:
+inputs: overlays:
 
 {
 
   meta = rec {
     nixpkgs = import inputs.nixpkgs {
       system   = "x86_64-linux";
-      overlays = [
-        inputs.stagit.overlay
-
-        inputs.bikemap.overlay
-        inputs.mobile-coverage-map.overlay
-
-        inputs.sdm2mqtt.overlay
-        inputs.lacrosse2mqtt.overlay
-        inputs.mqtt-webui.overlay
-
-        inputs.ctucx-things.overlay
-        inputs.ctucx-gallery.overlay
-
-        inputs.oeffisearch.overlay
-        inputs.oeffi-web.overlay
-
-        inputs.flauschehorn-sexy.overlay
-      ];
+      overlays = overlays;
     };
 
     specialArgs = {
diff --git a/pkgs/darwin-overlay.nix b/pkgs/darwin-overlay.nix
@@ -0,0 +1,26 @@
+final: prev:
+
+{
+
+  yabai                  = final.callPackage ./yabai.nix {};
+  asitop                 = final.callPackage ./asitop.nix {};
+  bgiparser              = final.callPackage ./bgiparser.nix {};
+  XPCEventStreamHandler  = final.callPackage ./XPCEventStreamHandler {};
+
+  # jemalloc depends on llvm10 which is doesn't supports darwin-aarch64
+  # however bind seems to build fine w/o jemalloc
+  bind = prev.bind.override { jemalloc = null; };
+
+  # disable pyopenssl-dependency on cloudscraper since it is broken on aarch64
+  python3 = prev.python3.override {
+    packageOverrides = python3-final: python3-prev: {
+      cloudscraper = python3-prev.cloudscraper.override {
+        requests-toolbelt = (python3-prev.requests-toolbelt.override {
+          pyopenssl = null;
+        }).overridePythonAttrs (old: {
+          doCheck = false;
+        });
+      };
+    };
+  };
+}+
\ No newline at end of file
diff --git a/pkgs/default.nix b/pkgs/default.nix
@@ -1,59 +0,0 @@
-{ inputs, lib, currentSystem, ... }:
-
-{
-
-  nixpkgs.overlays = [
-    (final: prev: {
-
-      unstable               = inputs.nixpkgsUnstable.legacyPackages.${prev.system};
-
-      writePythonScriptBin   = (final.callPackage ./writePythonScriptBin.nix {}).writePythonScriptBin;
-      dns                    = inputs.dns;
-
-      agenix                 = inputs.agenix.defaultPackage."${currentSystem}";
-
-      pleroma                = prev.pleroma.overrideAttrs (old: {
-        patches = [
-         ./0001-PATCH-Separate-webfinger-domain-from-host-domain.patch
-        ];
-      });
-
-      garminexport           = final.callPackage ./garminexport.nix {};
-      phockup                = final.callPackage ./phockup.nix {};
-      gotosocial             = final.callPackage ./gotosocial {};
-      AirSane                = final.callPackage ./AirSane {};
-      cinny                  = final.callPackage ./cinny.nix {};
-      mbusd                  = final.callPackage ./mbusd.nix {};
-
-      kvg-station-departures = final.callPackage ./kvg-station-departures.nix {};
-
-    })
-    (if (currentSystem == "aarch64-darwin") then (final: prev: {
-
-      yabai                  = final.callPackage ./yabai.nix {};
-      asitop                 = final.callPackage ./asitop.nix {};
-      bgiparser              = final.callPackage ./bgiparser.nix {};
-      XPCEventStreamHandler  = final.callPackage ./XPCEventStreamHandler {};
-      SpeakerDaemon          = final.callPackage ./SpeakerDaemon {inherit inputs;};
-
-      # jemalloc depends on llvm10 which is doesn't supports darwin-aarch64
-      # however bind seems to build fine w/o jemalloc
-      bind = prev.bind.override { jemalloc = null; };
-
-      # disable pyopenssl-dependency on cloudscraper since it is broken on aarch64
-      python3 = prev.python3.override {
-        packageOverrides = python3-final: python3-prev: {
-          cloudscraper = python3-prev.cloudscraper.override {
-            requests-toolbelt = (python3-prev.requests-toolbelt.override {
-              pyopenssl = null;
-            }).overridePythonAttrs (old: {
-              doCheck = false;
-            });
-          };
-        };
-       };
-
-    }) else (final: prev: {}))
-  ];
-
-}
diff --git a/pkgs/overlay.nix b/pkgs/overlay.nix
@@ -0,0 +1,21 @@
+final: prev:
+
+{
+
+  writePythonScriptBin   = (final.callPackage ./writePythonScriptBin.nix {}).writePythonScriptBin;
+
+  pleroma                = prev.pleroma.overrideAttrs (old: {
+    patches = [
+     ./0001-PATCH-Separate-webfinger-domain-from-host-domain.patch
+    ];
+  });
+
+  garminexport           = final.callPackage ./garminexport.nix {};
+  phockup                = final.callPackage ./phockup.nix {};
+  gotosocial             = final.callPackage ./gotosocial {};
+  AirSane                = final.callPackage ./AirSane {};
+  cinny                  = final.callPackage ./cinny.nix {};
+  mbusd                  = final.callPackage ./mbusd.nix {};
+
+  kvg-station-departures = final.callPackage ./kvg-station-departures.nix {};
+}