First dnf test
This commit is contained in:
commit
d481a5e669
165 changed files with 41270 additions and 0 deletions
31
dnf/lib/attrs.nix
Normal file
31
dnf/lib/attrs.nix
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
# TODO: Mettre en place la librairie
|
||||
|
||||
{ lib }:
|
||||
|
||||
with lib;
|
||||
|
||||
{
|
||||
# Merge profond d'attributs
|
||||
mergeDeep =
|
||||
lhs: rhs:
|
||||
lhs
|
||||
// mapAttrs (
|
||||
name: value:
|
||||
if isAttrs value && lhs ? ${name} && isAttrs lhs.${name} then mergeDeep lhs.${name} value else value
|
||||
) rhs;
|
||||
|
||||
# Filtre les attributs avec une condition
|
||||
filterAttrsRecursive =
|
||||
pred: set:
|
||||
listToAttrs (
|
||||
concatMap (
|
||||
name:
|
||||
let
|
||||
value = set.${name};
|
||||
in
|
||||
optional (pred name value) (
|
||||
nameValuePair name (if isAttrs value then filterAttrsRecursive pred value else value)
|
||||
)
|
||||
) (attrNames set)
|
||||
);
|
||||
}
|
||||
10
dnf/lib/default.nix
Normal file
10
dnf/lib/default.nix
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
lib ? (import <nixpkgs> { }).lib,
|
||||
}:
|
||||
|
||||
let
|
||||
attrs = import ./attrs.nix { inherit lib; };
|
||||
in
|
||||
{
|
||||
inherit (attrs) hasAttrPath;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue