From e061bf4db9f74c2a3868c3f9fde4c58fed1719ab Mon Sep 17 00:00:00 2001 From: reo101 Date: Fri, 17 Feb 2023 02:42:11 +0200 Subject: [PATCH] chore(helpers): clean up --- flake.nix | 4 +--- helpers.nix => lib/default.nix | 23 ++++++++++++----------- 2 files changed, 13 insertions(+), 14 deletions(-) rename helpers.nix => lib/default.nix (90%) diff --git a/flake.nix b/flake.nix index 1b75699..bdd070d 100644 --- a/flake.nix +++ b/flake.nix @@ -74,10 +74,8 @@ } @ inputs: let inherit (self) outputs; - inherit (nixpkgs) lib; - helpers = import ./helpers.nix { inherit inputs outputs lib; }; in - with helpers; rec { + with (import ./lib { inherit inputs outputs; }); rec { # Packages (`nix build`) packages = forEachPkgs (pkgs: import ./pkgs { inherit pkgs; } diff --git a/helpers.nix b/lib/default.nix similarity index 90% rename from helpers.nix rename to lib/default.nix index d0705ba..86324cf 100644 --- a/helpers.nix +++ b/lib/default.nix @@ -1,7 +1,8 @@ -{ inputs, outputs, lib, ... }: +{ inputs, outputs, ... }: let inherit (inputs) nixpkgs; + inherit (nixpkgs) lib; inherit (lib) mapAttrs; inherit (lib.attrsets) filterAttrs; in @@ -51,13 +52,13 @@ rec { f nixpkgs.legacyPackages.${system}); # Modules - nixosModules = import ./modules/nixos; - nixOnDroidModules = import ./modules/nix-on-droid; - nixDarwinModules = import ./modules/nix-darwin; - homeManagerModules = import ./modules/home-manager; + nixosModules = import ../modules/nixos; + nixOnDroidModules = import ../modules/nix-on-droid; + nixDarwinModules = import ../modules/nix-darwin; + homeManagerModules = import ../modules/home-manager; # Machines - machines = recurseDir ./machines; + machines = recurseDir ../machines; homeManagerMachines = machines.home-manager or { }; nixDarwinMachines = machines.nix-darwin or { }; nixOnDroidMachines = machines.nix-on-droid or { }; @@ -77,7 +78,7 @@ rec { users = lib.attrsets.genAttrs users (user: import (root + "/home/${user}.nix")); - + sharedModules = builtins.attrValues homeManagerModules; extraSpecialArgs = { inherit inputs outputs; }; @@ -171,7 +172,7 @@ rec { config) (system: host: config: mkNixosHost - ./machines/nixos/${system}/${host} + ../machines/nixos/${system}/${host} system host (builtins.map @@ -187,7 +188,7 @@ rec { config) (system: host: config: mkNixOnDroidHost - ./machines/nix-on-droid/${system}/${host} + ../machines/nix-on-droid/${system}/${host} system host) nixOnDroidMachines; @@ -200,7 +201,7 @@ rec { config) (system: host: config: mkNixDarwinHost - ./machines/nix-darwin/${system}/${host} + ../machines/nix-darwin/${system}/${host} system host (builtins.map @@ -216,7 +217,7 @@ rec { config) (system: host: config: mkHomeManagerHost - ./machines/home-manager/${system}/${host} + ../machines/home-manager/${system}/${host} system host) homeManagerMachines;