refactor: move inputs nix code to folder
All checks were successful
Discord / discord commits (push) Has been skipped

This commit is contained in:
matt1432 2024-11-20 15:01:58 -05:00
parent c648667ef3
commit 4f38557364
4 changed files with 26 additions and 18 deletions

View file

@ -1,5 +1,5 @@
let
inherit (import ./lib {}) mkDep mkInput mkHyprDep mkSrc;
inherit (import ./lib.nix) mkDep mkInput mkHyprDep mkSrc;
inherit (builtins) listToAttrs map removeAttrs;
# Inputs
@ -180,6 +180,13 @@ let
};
};
bbsteamieInputs = {
jovian = mkDep {
owner = "Jovian-Experiments";
repo = "Jovian-NixOS";
};
};
srcs = [
# Home-assistant
## Components
@ -368,7 +375,7 @@ let
in {
inherit mkDep mkInput mkSrc;
otherInputs =
extraInputs =
{
flakegen = {
url = "github:jorsn/flakegen";
@ -381,6 +388,7 @@ in {
// clusterInputs
// serviviInputs
// nosInputs
// bbsteamieInputs
// desktopInputs.hyprlandInputs
// desktopInputs.agsInputs
// (listToAttrs (map (x: {

View file

@ -1,17 +1,23 @@
lib: lock: let
let
inherit (builtins) fetchTarball fromJSON readFile removeAttrs;
lock = fromJSON (readFile ../flake.lock);
lib = import "${fetchTarball {
url = "https://github.com/NixOS/nixpkgs/archive/${lock.nodes.nixpkgs.locked.rev}.tar.gz";
sha256 = lock.nodes.nixpkgs.locked.narHash;
}}/lib";
inherit (lib) attrValues findFirst foldl' hasAttr matchAttrs optionalAttrs recursiveUpdate;
inherit (builtins) removeAttrs;
recursiveUpdateList = list: foldl' recursiveUpdate {} list;
in rec {
/*
* From an attrset, returns a flake input that has its type defaulted
* to `github` and has some of its inputs following this flake's input
* of the same name.
*
From an attrset, returns a flake input that has its type defaulted
to `github` and has some of its inputs following this flake's input
of the same name.
It gets information from the `flake.lock` file and can be used thanks
to flakegen
* It gets information from the `flake.lock` file and can be used thanks
* to flakegen
*/
mkInput = {type ? "github", ...} @ info: let
input =

View file

@ -16,6 +16,5 @@
capitalise = str: (toUpper (substring 0 1 str) + (concatStringsSep "" (tail (stringToCharacters str))));
in
{inherit lib mkVersion capitalise;}
// (import ./inputs.nix lib lock)
// optionalAttrs (inputs != {}) (import ./flake-lib.nix inputs)
// optionalAttrs (pkgs != {}) (import ./pkgs.nix {inherit pkgs mkVersion capitalise self;})

View file

@ -1,6 +1,6 @@
{
inputs = let
inherit (import ./inputs.nix) mkDep mkInput otherInputs;
inherit (import ./inputs) mkDep mkInput extraInputs;
mainInputs = {
systems = mkInput {
@ -37,14 +37,9 @@
inputs.sops-nix.follows = "sops-nix";
};
jovian = mkDep {
owner = "Jovian-Experiments";
repo = "Jovian-NixOS";
};
};
in
mainInputs // otherInputs;
mainInputs // extraInputs;
outputs = inputs @ {
nixpkgs,