refactor(inputs): integrate mkDep into mkInput and improve mkHyprDep
All checks were successful
Discord / discord commits (push) Has been skipped
All checks were successful
Discord / discord commits (push) Has been skipped
This commit is contained in:
parent
d89900c4be
commit
1981620f46
5 changed files with 74 additions and 73 deletions
10
_outputs.nix
10
_outputs.nix
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
inputs = let
|
||||
inherit (import ./inputs) mkDep mkInput extraInputs;
|
||||
inherit (import ./inputs) mkInput extraInputs;
|
||||
|
||||
mainInputs = {
|
||||
systems = mkInput {
|
||||
|
@ -14,24 +14,24 @@
|
|||
ref = "nixos-unstable-small";
|
||||
};
|
||||
|
||||
home-manager = mkDep {
|
||||
home-manager = mkInput {
|
||||
owner = "nix-community";
|
||||
repo = "home-manager";
|
||||
};
|
||||
|
||||
nix-on-droid = mkDep {
|
||||
nix-on-droid = mkInput {
|
||||
owner = "nix-community";
|
||||
repo = "nix-on-droid";
|
||||
|
||||
inputs.home-manager.follows = "home-manager";
|
||||
};
|
||||
|
||||
sops-nix = mkDep {
|
||||
sops-nix = mkInput {
|
||||
owner = "Mic92";
|
||||
repo = "sops-nix";
|
||||
};
|
||||
|
||||
secrets = mkDep {
|
||||
secrets = mkInput {
|
||||
type = "git";
|
||||
url = "ssh://git@git.nelim.org/matt1432/nixos-secrets";
|
||||
|
||||
|
|
BIN
flake.lock
BIN
flake.lock
Binary file not shown.
BIN
flake.nix
BIN
flake.nix
Binary file not shown.
|
@ -1,31 +1,31 @@
|
|||
# TODO: add README
|
||||
let
|
||||
inherit (import ./lib.nix) mkDep mkInput mkHyprDep mkSrc;
|
||||
inherit (import ./lib.nix) mkInput mkHyprDep mkSrc;
|
||||
inherit (builtins) listToAttrs map removeAttrs;
|
||||
|
||||
# Inputs
|
||||
nixTools = {
|
||||
nix-fast-build = mkDep {
|
||||
nix-fast-build = mkInput {
|
||||
owner = "Mic92";
|
||||
repo = "nix-fast-build";
|
||||
};
|
||||
|
||||
nix-eval-jobs = mkDep {
|
||||
nix-eval-jobs = mkInput {
|
||||
owner = "nix-community";
|
||||
repo = "nix-eval-jobs";
|
||||
};
|
||||
|
||||
nix-index-db = mkDep {
|
||||
nix-index-db = mkInput {
|
||||
owner = "Mic92";
|
||||
repo = "nix-index-database";
|
||||
};
|
||||
|
||||
nh = mkDep {
|
||||
nh = mkInput {
|
||||
owner = "viperML";
|
||||
repo = "nh";
|
||||
};
|
||||
|
||||
nurl = mkDep {
|
||||
nurl = mkInput {
|
||||
owner = "nix-community";
|
||||
repo = "nurl";
|
||||
};
|
||||
|
@ -44,7 +44,7 @@ let
|
|||
repo = "flake-parts";
|
||||
inputs.nixpkgs-lib.follows = "nixpkgs";
|
||||
};
|
||||
treefmt-nix = mkDep {
|
||||
treefmt-nix = mkInput {
|
||||
owner = "numtide";
|
||||
repo = "treefmt-nix";
|
||||
};
|
||||
|
@ -52,11 +52,11 @@ let
|
|||
owner = "nix-community";
|
||||
repo = "lib-aggregate";
|
||||
};
|
||||
nix-github-actions = mkDep {
|
||||
nix-github-actions = mkInput {
|
||||
owner = "nix-community";
|
||||
repo = "nix-github-actions";
|
||||
};
|
||||
pre-commit-hooks = mkDep {
|
||||
pre-commit-hooks = mkInput {
|
||||
owner = "cachix";
|
||||
repo = "git-hooks.nix";
|
||||
inputs.flake-compat.follows = "flake-compat";
|
||||
|
@ -64,55 +64,55 @@ let
|
|||
};
|
||||
|
||||
overlays = {
|
||||
nixpkgs-wayland = mkDep {
|
||||
nixpkgs-wayland = mkInput {
|
||||
owner = "nix-community";
|
||||
repo = "nixpkgs-wayland";
|
||||
};
|
||||
|
||||
nix-gaming = mkDep {
|
||||
nix-gaming = mkInput {
|
||||
owner = "fufexan";
|
||||
repo = "nix-gaming";
|
||||
};
|
||||
};
|
||||
|
||||
nvimInputs = {
|
||||
nixd = mkDep {
|
||||
nixd = mkInput {
|
||||
owner = "nix-community";
|
||||
repo = "nixd";
|
||||
};
|
||||
};
|
||||
|
||||
clusterInputs = {
|
||||
pcsd = mkDep {
|
||||
pcsd = mkInput {
|
||||
owner = "matt1432";
|
||||
repo = "nixos-pcsd";
|
||||
};
|
||||
};
|
||||
|
||||
serviviInputs = {
|
||||
minix = mkDep {
|
||||
minix = mkInput {
|
||||
owner = "matt1432";
|
||||
repo = "Minix";
|
||||
};
|
||||
|
||||
pr-tracker = mkDep {
|
||||
pr-tracker = mkInput {
|
||||
owner = "matt1432";
|
||||
repo = "pr-tracker";
|
||||
};
|
||||
};
|
||||
|
||||
nosInputs = {
|
||||
khepri = mkDep {
|
||||
khepri = mkInput {
|
||||
owner = "matt1432";
|
||||
repo = "khepri";
|
||||
};
|
||||
|
||||
jellyfin-flake = mkDep {
|
||||
jellyfin-flake = mkInput {
|
||||
owner = "matt1432";
|
||||
repo = "nixos-jellyfin";
|
||||
};
|
||||
|
||||
bazarr-bulk = mkDep {
|
||||
bazarr-bulk = mkInput {
|
||||
owner = "mateoradman";
|
||||
repo = "bazarr-bulk";
|
||||
};
|
||||
|
@ -120,16 +120,9 @@ let
|
|||
|
||||
desktopInputs = {
|
||||
hyprlandInputs = {
|
||||
hyprutils = mkDep {
|
||||
owner = "hyprwm";
|
||||
repo = "hyprutils";
|
||||
};
|
||||
|
||||
hyprland = mkDep {
|
||||
hyprland = mkInput {
|
||||
owner = "hyprwm";
|
||||
repo = "Hyprland";
|
||||
|
||||
inputs.hyprutils.follows = "hyprutils";
|
||||
};
|
||||
|
||||
hyprland-plugins = mkHyprDep {
|
||||
|
@ -142,36 +135,29 @@ let
|
|||
repo = "hyprgrass";
|
||||
};
|
||||
|
||||
hyprpaper = mkDep {
|
||||
hyprpaper = mkHyprDep {
|
||||
owner = "hyprwm";
|
||||
repo = "hyprpaper";
|
||||
|
||||
inputs = {
|
||||
hyprgraphics.follows = "hyprland/hyprgraphics";
|
||||
hyprlang.follows = "hyprland/hyprlang";
|
||||
hyprutils.follows = "hyprland/hyprutils";
|
||||
hyprwayland-scanner.follows = "hyprland/hyprwayland-scanner";
|
||||
};
|
||||
};
|
||||
|
||||
grim-hyprland = mkDep {
|
||||
grim-hyprland = mkInput {
|
||||
owner = "eriedaberrie";
|
||||
repo = "grim-hyprland";
|
||||
};
|
||||
|
||||
nixcord = mkDep {
|
||||
nixcord = mkInput {
|
||||
owner = "kaylorben";
|
||||
repo = "nixcord";
|
||||
};
|
||||
};
|
||||
|
||||
agsInputs = {
|
||||
astal = mkDep {
|
||||
astal = mkInput {
|
||||
owner = "Aylur";
|
||||
repo = "astal";
|
||||
};
|
||||
|
||||
ags = mkDep {
|
||||
ags = mkInput {
|
||||
owner = "Aylur";
|
||||
repo = "ags";
|
||||
|
||||
|
@ -185,12 +171,12 @@ let
|
|||
inputs.astal.follows = "astal";
|
||||
};
|
||||
|
||||
gtk-session-lock = mkDep {
|
||||
gtk-session-lock = mkInput {
|
||||
owner = "Cu3PO42";
|
||||
repo = "gtk-session-lock";
|
||||
};
|
||||
|
||||
virtualkeyboard-adapter = mkDep {
|
||||
virtualkeyboard-adapter = mkInput {
|
||||
owner = "horriblename";
|
||||
repo = "fcitx-virtualkeyboard-adapter";
|
||||
};
|
||||
|
@ -198,7 +184,7 @@ let
|
|||
};
|
||||
|
||||
bbsteamieInputs = {
|
||||
jovian = mkDep {
|
||||
jovian = mkInput {
|
||||
owner = "Jovian-Experiments";
|
||||
repo = "Jovian-NixOS";
|
||||
};
|
||||
|
@ -400,7 +386,7 @@ let
|
|||
}
|
||||
];
|
||||
in {
|
||||
inherit mkDep mkInput mkSrc;
|
||||
inherit mkInput mkSrc;
|
||||
|
||||
extraInputs =
|
||||
{
|
||||
|
|
|
@ -7,10 +7,20 @@ let
|
|||
sha256 = lock.nodes.nixpkgs.locked.narHash;
|
||||
}}/lib";
|
||||
|
||||
inherit (lib) attrValues findFirst foldl' hasAttr matchAttrs optionalAttrs recursiveUpdate;
|
||||
inherit (lib) attrNames attrValues findFirst foldl' hasAttr matchAttrs optionalAttrs optionals recursiveUpdate;
|
||||
in rec {
|
||||
recursiveUpdateList = list: foldl' recursiveUpdate {} list;
|
||||
|
||||
findInput = info:
|
||||
findFirst
|
||||
(x: matchAttrs (removeAttrs info ["inputs"]) (x.original or {})) {}
|
||||
(attrValues lock.nodes);
|
||||
|
||||
mkFollowsFrom = info: target: follows:
|
||||
optionalAttrs
|
||||
(hasAttr target ((findInput info).inputs or {}))
|
||||
{inputs.${target} = {inherit follows;};};
|
||||
|
||||
/*
|
||||
* 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
|
||||
|
@ -19,20 +29,18 @@ in rec {
|
|||
* It gets information from the `flake.lock` file and can be used thanks
|
||||
* to flakegen
|
||||
*/
|
||||
mkInput = {type ? "github", ...} @ info: let
|
||||
input =
|
||||
findFirst
|
||||
(x: matchAttrs (removeAttrs info ["inputs"]) (x.original or {})) {}
|
||||
(attrValues lock.nodes);
|
||||
|
||||
mkOverride = i:
|
||||
optionalAttrs
|
||||
(hasAttr i (input.inputs or {}))
|
||||
{inputs.${i}.follows = i;};
|
||||
mkInput = {
|
||||
type ? "github",
|
||||
overrideNixpkgs ? true,
|
||||
...
|
||||
} @ info: let
|
||||
mkOverride = i: mkFollowsFrom info i i;
|
||||
in
|
||||
recursiveUpdateList [
|
||||
info
|
||||
recursiveUpdateList ([
|
||||
(removeAttrs info ["overrideNixpkgs"])
|
||||
{inherit type;}
|
||||
|
||||
# Generic inputs
|
||||
(mkOverride "systems")
|
||||
(mkOverride "flake-compat")
|
||||
(mkOverride "flake-utils")
|
||||
|
@ -42,11 +50,18 @@ in rec {
|
|||
(mkOverride "nix-github-actions")
|
||||
(mkOverride "pre-commit-hooks")
|
||||
(mkOverride "treefmt-nix")
|
||||
];
|
||||
]
|
||||
# Specify if we can't make an input use this flake's nixpkgs
|
||||
++ optionals overrideNixpkgs [(mkOverride "nixpkgs")]);
|
||||
|
||||
mkDep = info: mkInput (recursiveUpdate info {inputs.nixpkgs.follows = "nixpkgs";});
|
||||
mkHyprDep = info: let
|
||||
inherit (lock.nodes) hyprland;
|
||||
|
||||
mkHyprDep = info: mkInput (recursiveUpdate info {inputs.hyprland.follows = "hyprland";});
|
||||
mkOverride = i: mkFollowsFrom info i i;
|
||||
mkHyprOverride = i: mkFollowsFrom info i "hyprland/${i}";
|
||||
in
|
||||
mkInput (recursiveUpdateList ([info (mkOverride "hyprland")]
|
||||
++ (map mkHyprOverride (attrNames hyprland.inputs))));
|
||||
|
||||
mkSrc = info: mkInput (info // {flake = false;});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue