diff options
| author | Fuwn <[email protected]> | 2024-10-03 16:11:24 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2024-10-03 16:11:24 -0700 |
| commit | df7061f558858acc0a77f72b6534f147ac87706b (patch) | |
| tree | fa757db3bce9a55fa04af861913da2e1171235ff | |
| parent | ebisu: move nixpkgs configuration to kansaiPkgs (diff) | |
| download | nixos-config-df7061f558858acc0a77f72b6534f147ac87706b.tar.xz nixos-config-df7061f558858acc0a77f72b6534f147ac87706b.zip | |
flake: move kansai-pkgs and overlays to lib
| -rw-r--r-- | flake.nix | 33 | ||||
| -rw-r--r-- | lib/kansai-pkgs.nix | 25 | ||||
| -rw-r--r-- | lib/overlays.nix | 10 |
3 files changed, 38 insertions, 30 deletions
@@ -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) + ) +) |