summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--flake.nix33
-rw-r--r--lib/kansai-pkgs.nix25
-rw-r--r--lib/overlays.nix10
3 files changed, 38 insertions, 30 deletions
diff --git a/flake.nix b/flake.nix
index b64e245..b619540 100644
--- a/flake.nix
+++ b/flake.nix
@@ -15,36 +15,9 @@
secrets = builtins.fromTOML (builtins.readFile "${self}/secrets/secrets.toml");
systemsAttributes = lib.genAttrs (import systems);
- kansaiPkgs =
- {
- nixpkgsAllowUnfree ? false,
- nixpkgsCudaSupport ? false,
- nixpkgsAllowUnfreePredicate ? [ ],
- nixpkgsExtraConfig ? { },
- }:
- (systemsAttributes (
- system:
- import inputs.nixpkgs {
- inherit system;
-
- config = {
- allowUnfree = nixpkgsAllowUnfree;
- cudaSupport = nixpkgsCudaSupport;
- allowUnfreePredicate = nixpkgsAllowUnfreePredicate;
- } // nixpkgsExtraConfig;
-
- overlays =
- let
- path = "${self}/overlays";
- in
- with builtins;
- map (n: import (path + ("/" + n))) (
- filter (n: match ".*\\.nix" n != null || pathExists (path + ("/" + n + "/default.nix"))) (
- attrNames (readDir path)
- )
- );
- }
- ));
+ kansaiPkgs = import "${self}/lib/kansai-pkgs.nix" {
+ inherit systemsAttributes nixpkgs self;
+ };
in
flake-parts.lib.mkFlake { inherit inputs; } {
systems = builtins.attrNames (systemsAttributes (system: system));
diff --git a/lib/kansai-pkgs.nix b/lib/kansai-pkgs.nix
new file mode 100644
index 0000000..dd189b8
--- /dev/null
+++ b/lib/kansai-pkgs.nix
@@ -0,0 +1,25 @@
+{
+ systemsAttributes,
+ nixpkgs,
+ self,
+}:
+{
+ nixpkgsAllowUnfree ? false,
+ nixpkgsCudaSupport ? false,
+ nixpkgsAllowUnfreePredicate ? [ ],
+ nixpkgsExtraConfig ? { },
+}:
+(systemsAttributes (
+ system:
+ import nixpkgs {
+ inherit system;
+
+ overlays = import "${self}/lib/overlays.nix" { inherit self; };
+
+ config = {
+ allowUnfree = nixpkgsAllowUnfree;
+ cudaSupport = nixpkgsCudaSupport;
+ allowUnfreePredicate = nixpkgsAllowUnfreePredicate;
+ } // nixpkgsExtraConfig;
+ }
+))
diff --git a/lib/overlays.nix b/lib/overlays.nix
new file mode 100644
index 0000000..add8fc4
--- /dev/null
+++ b/lib/overlays.nix
@@ -0,0 +1,10 @@
+{ self }:
+let
+ path = "${self}/overlays";
+in
+with builtins;
+map (n: import (path + ("/" + n))) (
+ filter (n: match ".*\\.nix" n != null || pathExists (path + ("/" + n + "/default.nix"))) (
+ attrNames (readDir path)
+ )
+)