refactor lib

This commit is contained in:
Sean Buckley 2021-11-29 02:05:40 -05:00
parent cea56aa037
commit 9b28154273

View file

@ -6,6 +6,12 @@
let let
mypkgs = import ./pkgs; mypkgs = import ./pkgs;
getHosts = import lib/hosts.nix;
morphHosts = import lib/morph.nix;
forAllSystems = f: builtins.listToAttrs (map
(name: { inherit name; value = f name; })
(with nixpkgs.lib.systems.supported; tier1 ++ tier2));
pins = { pins = {
nix.registry.nixpkgs.flake = nixpkgs; nix.registry.nixpkgs.flake = nixpkgs;
@ -18,6 +24,8 @@
in in
{ {
lib = { inherit forAllSystems getHosts morphHosts; };
nixosModules = nixosModules =
{ {
inherit pins; inherit pins;
@ -35,24 +43,16 @@
nixpkgs.overlays = [ (_: mypkgs) ]; nixpkgs.overlays = [ (_: mypkgs) ];
}; };
nixosConfigurations = self.lib.getHosts { nixosConfigurations = getHosts {
path = ./hosts; path = ./hosts;
inherit nixpkgs; inherit nixpkgs;
inherit (self) nixosModule; inherit (self) nixosModule;
}; };
lib = { packages = forAllSystems
getHosts = import lib/hosts.nix;
morphHosts = import lib/morph.nix;
forAllSystems = f: builtins.listToAttrs (map
(name: { inherit name; value = f name; })
(with nixpkgs.lib.systems.supported; tier1 ++ tier2));
};
packages = self.lib.forAllSystems
(system: mypkgs nixpkgs.legacyPackages.${system}); (system: mypkgs nixpkgs.legacyPackages.${system});
apps = self.lib.forAllSystems (system: apps = forAllSystems (system:
with nixpkgs.legacyPackages.${system}; with nixpkgs.legacyPackages.${system};
{ {
gnome-extensions = writeShellScriptBin "gnome-extensions" '' gnome-extensions = writeShellScriptBin "gnome-extensions" ''