Skip to content

Commit

Permalink
util via speciaArgs
Browse files Browse the repository at this point in the history
  • Loading branch information
mightyiam committed Dec 25, 2024
1 parent 0c0e839 commit 3b48732
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 39 deletions.
50 changes: 27 additions & 23 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -103,27 +103,31 @@

outputs =
inputs:
inputs.flake-parts.lib.mkFlake { inherit inputs; } {
imports = [
./boot-message.nix
./catppuccin.nix
./codeberg.nix
./drv-paths.nix
./fmt.nix
./git-hooks.nix
./home-manager-modules
./lib.nix
./meta.nix
./nix-on-droid-configurations
./nixos-configurations.nix
./nixos-modules
./nixvim
inputs.devshell.flakeModule
];

systems = [
"x86_64-linux"
"aarch64-linux"
];
};
inputs.flake-parts.lib.mkFlake
{
inherit inputs;
specialArgs.util = import ./util.nix inputs;
}
{
imports = [
./boot-message.nix
./catppuccin.nix
./codeberg.nix
./drv-paths.nix
./fmt.nix
./git-hooks.nix
./home-manager-modules
./meta.nix
./nix-on-droid-configurations
./nixos-configurations.nix
./nixos-modules
./nixvim
inputs.devshell.flakeModule
];

systems = [
"x86_64-linux"
"aarch64-linux"
];
};
}
4 changes: 2 additions & 2 deletions home-manager-modules/default.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{ lib, readModulesDir, ... }:
{ lib, util, ... }:
{
options.flake.homeManagerModules = lib.mkOption {
type = lib.types.attrsOf lib.types.anything;
};
config.flake.homeManagerModules = readModulesDir ./.;
config.flake.homeManagerModules = util.readModulesDir ./.;
}
10 changes: 0 additions & 10 deletions lib.nix

This file was deleted.

4 changes: 2 additions & 2 deletions nixos-modules/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ readModulesDir, ... }:
{ util, ... }:
{
flake.nixosModules = readModulesDir ./.;
flake.nixosModules = util.readModulesDir ./.;
}
4 changes: 2 additions & 2 deletions nixvim/default.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
lib,
self,
readModulesDir,
util,
...
}:
{
Expand All @@ -10,7 +10,7 @@
};

config = {
flake.nixvimModules = readModulesDir ./.;
flake.nixvimModules = util.readModulesDir ./.;
perSystem =
{
inputs',
Expand Down
11 changes: 11 additions & 0 deletions util.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{ nixpkgs, ... }:
let
inherit (nixpkgs) lib;
in
{
readModulesDir =
path:
builtins.readDir path
|> lib.filterAttrs (name: _: name != "default.nix")
|> lib.mapAttrs' (name: type: lib.nameValuePair (lib.removeSuffix ".nix" name) (path + "/${name}"));
}

0 comments on commit 3b48732

Please sign in to comment.