Multi system and pkgs cleanup
This commit is contained in:
@@ -39,25 +39,35 @@
|
||||
outputs = inputs:
|
||||
let
|
||||
lib = inputs.nixpkgs.lib;
|
||||
gen = import ./generator.nix { inherit inputs; };
|
||||
linuxSystems = [ "x86_64-linux" "aarch64-linux" ];
|
||||
supportedSystems = linuxSystems ++ [ "x86_64-darwin" "aarch64-darwin" ];
|
||||
overlays = import ./overlays { inherit inputs; };
|
||||
mkPkgs = system:
|
||||
import inputs.nixpkgs {
|
||||
inherit system;
|
||||
inherit overlays;
|
||||
config.allowUnfree = true;
|
||||
};
|
||||
gen = import ./generator.nix { inherit inputs mkPkgs supportedSystems; };
|
||||
systemsDir = ./systems;
|
||||
isIgnoredSystemDir = name: lib.hasPrefix "_" name || lib.hasPrefix "." name;
|
||||
systemNames = lib.attrNames (lib.filterAttrs
|
||||
(name: type:
|
||||
systemNames = lib.attrNames (
|
||||
lib.filterAttrs (
|
||||
name: type:
|
||||
type == "directory"
|
||||
&& !isIgnoredSystemDir name
|
||||
&& builtins.pathExists (systemsDir + "/${name}/cfg.nix"))
|
||||
(builtins.readDir systemsDir));
|
||||
&& builtins.pathExists (systemsDir + "/${name}/cfg.nix")
|
||||
) (builtins.readDir systemsDir)
|
||||
);
|
||||
hostsByType = systemType:
|
||||
lib.filter
|
||||
(host: (import (systemsDir + "/${host}/cfg.nix")).syscfg.type == systemType)
|
||||
systemNames;
|
||||
lib.filter (host: ((import (systemsDir + "/${host}/cfg.nix")).syscfg.type or "nixos") == systemType) systemNames;
|
||||
generateHosts = systemType:
|
||||
lib.genAttrs
|
||||
(hostsByType systemType)
|
||||
(host: gen.generate { inherit host; });
|
||||
lib.genAttrs (hostsByType systemType) (host: gen.generate { inherit host; });
|
||||
in {
|
||||
devShells = import ./shells { inherit inputs; };
|
||||
devShells = import ./shells {
|
||||
inherit inputs mkPkgs;
|
||||
supportedSystems = linuxSystems;
|
||||
};
|
||||
|
||||
nixosConfigurations = generateHosts "nixos";
|
||||
darwinConfigurations = generateHosts "macos";
|
||||
@@ -76,8 +86,8 @@
|
||||
# diyu - ?
|
||||
# tirnanog - ?
|
||||
# valhalla - ?
|
||||
# arcadia - ?
|
||||
# elysium - ?
|
||||
# arcadia - ?
|
||||
# elysium - ?
|
||||
# empyrean - ?
|
||||
# duat - ?
|
||||
# sheol - ?
|
||||
|
||||
Reference in New Issue
Block a user