Merge pull request 'lib.readFact: change order of arguments' (#1721) from Mic92-main into main

This commit is contained in:
clan-bot
2024-07-09 12:59:48 +00:00
2 changed files with 5 additions and 5 deletions

View File

@@ -4,7 +4,7 @@
perSystem = perSystem =
{ self', pkgs, ... }: { self', pkgs, ... }:
{ {
treefmt.projectRootFile = "flake.nix"; treefmt.projectRootFile = ".git/config";
treefmt.programs.shellcheck.enable = true; treefmt.programs.shellcheck.enable = true;
treefmt.programs.mypy.enable = true; treefmt.programs.mypy.enable = true;

View File

@@ -4,10 +4,10 @@ let
allMachineNames = lib.mapAttrsToList (name: _: name) (builtins.readDir clanDir); allMachineNames = lib.mapAttrsToList (name: _: name) (builtins.readDir clanDir);
getFactPath = fact: machine: "${clanDir}/${machine}/facts/${fact}"; getFactPath = machine: fact: "${clanDir}/${machine}/facts/${fact}";
readFact = readFact =
fact: machine: machine: fact:
let let
path = getFactPath fact machine; path = getFactPath fact machine;
in in
@@ -24,7 +24,7 @@ let
fact: fact:
let let
machines = allMachineNames; machines = allMachineNames;
facts = lib.genAttrs machines (readFact fact); facts = lib.genAttrs machines (machine: readFact machine fact);
filteredFacts = lib.filterAttrs (_machine: fact: fact != null) facts; filteredFacts = lib.filterAttrs (_machine: fact: fact != null) facts;
in in
filteredFacts; filteredFacts;
@@ -51,7 +51,7 @@ let
let let
# machine -> fact -> factvalue # machine -> fact -> factvalue
machinesFactsAttrs = lib.genAttrs allMachineNames ( machinesFactsAttrs = lib.genAttrs allMachineNames (
machine: lib.genAttrs facts (fact: readFact fact machine) machine: lib.genAttrs facts (fact: readFact machine fact)
); );
# remove all machines which don't have all facts set # remove all machines which don't have all facts set
filteredMachineFactAttrs = lib.filterAttrs ( filteredMachineFactAttrs = lib.filterAttrs (