summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFuwn <[email protected]>2024-10-03 16:11:24 -0700
committerFuwn <[email protected]>2024-10-03 16:11:24 -0700
commitdf7061f558858acc0a77f72b6534f147ac87706b (patch)
treefa757db3bce9a55fa04af861913da2e1171235ff
parentebisu: move nixpkgs configuration to kansaiPkgs (diff)
downloadnixos-config-df7061f558858acc0a77f72b6534f147ac87706b.tar.xz
nixos-config-df7061f558858acc0a77f72b6534f147ac87706b.zip
flake: move kansai-pkgs and overlays to lib
-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)
+ )
+)