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 let
inherit (import ./lib {}) mkDep mkInput mkHyprDep mkSrc; inherit (import ./lib.nix) mkDep mkInput mkHyprDep mkSrc;
inherit (builtins) listToAttrs map removeAttrs; inherit (builtins) listToAttrs map removeAttrs;
# Inputs # Inputs
@ -180,6 +180,13 @@ let
}; };
}; };
bbsteamieInputs = {
jovian = mkDep {
owner = "Jovian-Experiments";
repo = "Jovian-NixOS";
};
};
srcs = [ srcs = [
# Home-assistant # Home-assistant
## Components ## Components
@ -368,7 +375,7 @@ let
in { in {
inherit mkDep mkInput mkSrc; inherit mkDep mkInput mkSrc;
otherInputs = extraInputs =
{ {
flakegen = { flakegen = {
url = "github:jorsn/flakegen"; url = "github:jorsn/flakegen";
@ -381,6 +388,7 @@ in {
// clusterInputs // clusterInputs
// serviviInputs // serviviInputs
// nosInputs // nosInputs
// bbsteamieInputs
// desktopInputs.hyprlandInputs // desktopInputs.hyprlandInputs
// desktopInputs.agsInputs // desktopInputs.agsInputs
// (listToAttrs (map (x: { // (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 (lib) attrValues findFirst foldl' hasAttr matchAttrs optionalAttrs recursiveUpdate;
inherit (builtins) removeAttrs;
recursiveUpdateList = list: foldl' recursiveUpdate {} list; recursiveUpdateList = list: foldl' recursiveUpdate {} list;
in rec { 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 * It gets information from the `flake.lock` file and can be used thanks
to `github` and has some of its inputs following this flake's input * to flakegen
of the same name.
It gets information from the `flake.lock` file and can be used thanks
to flakegen
*/ */
mkInput = {type ? "github", ...} @ info: let mkInput = {type ? "github", ...} @ info: let
input = input =

View file

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

View file

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