Skip to content

Commit

Permalink
chore: update locks
Browse files Browse the repository at this point in the history
  • Loading branch information
GTrunSec committed Feb 19, 2024
1 parent bdcc27c commit 2ede5bd
Show file tree
Hide file tree
Showing 49 changed files with 424 additions and 513 deletions.
Empty file modified .envrc
100644 → 100755
Empty file.
Empty file modified local/cells/dev/configs.nix
100644 → 100755
Empty file.
Empty file modified local/cells/dev/shells.nix
100644 → 100755
Empty file.
Empty file modified local/flake.lock
100644 → 100755
Empty file.
Empty file modified local/flake.nix
100644 → 100755
Empty file.
32 changes: 16 additions & 16 deletions local/lock/flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 4 additions & 7 deletions src/errors/inputsSource.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,9 @@
list:
let
sources = (import ../../local/lock/flake.nix).inputs;
listSources =
map
(x: {
name = x;
url = sources.${x}.url;
})
(lib.attrNames sources);
listSources = map (x: {
name = x;
url = sources.${x}.url;
}) (lib.attrNames sources);
in
lib.filter (pair: lib.elem pair.name list) listSources
16 changes: 7 additions & 9 deletions src/errors/requiredInputs.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,13 @@ let
);
isFound = (lib.length notFoundInputs == 0);
msg = (
lib.concatMapStringsSep "\n "
(
{ name, url }:
''
# please get the input from `${name}.url = "${url}"`
${name} = inputs.${name};
''
)
(super.inputsSource notFoundInputs)
lib.concatMapStringsSep "\n " (
{ name, url }:
''
# please get the input from `${name}.url = "${url}"`
${name} = inputs.${name};
''
) (super.inputsSource notFoundInputs)
);

noSysNixpkgs =
Expand Down
36 changes: 17 additions & 19 deletions src/lib/attrsets/filterAttrsOnlyRecursive.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,21 @@
{ lib, super }:
pred: set:
lib.listToAttrs (
lib.concatMap
(
name:
let
v = set.${name};
in
if pred name v then
[
(lib.nameValuePair name (
if lib.isAttrs v && !lib.isDerivation v then
super.filterAttrsOnlyRecursive pred v
else
v
))
]
else
[ ]
)
(lib.attrNames set)
lib.concatMap (
name:
let
v = set.${name};
in
if pred name v then
[
(lib.nameValuePair name (
if lib.isAttrs v && !lib.isDerivation v then
super.filterAttrsOnlyRecursive pred v
else
v
))
]
else
[ ]
) (lib.attrNames set)
)
15 changes: 6 additions & 9 deletions src/lib/omnibus/addLoadToPops.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,10 @@
{ lib }:
list: pops: load:
lib.listToAttrs (
map
(name: {
inherit name;
value =
lib.mapAttrs
(n: v: if v ? addLoadExtender then v.addLoadExtender (load name n v) else v)
pops;
})
list
map (name: {
inherit name;
value = lib.mapAttrs (
n: v: if v ? addLoadExtender then v.addLoadExtender (load name n v) else v
) pops;
}) list
)
42 changes: 19 additions & 23 deletions src/lib/omnibus/addLoadToPopsFilterBySrc.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,27 @@ let
processPops =
name:
lib.filterAttrs (_n: v: v != { }) (
lib.mapAttrs
(
n: v:
let
dirs = getDirs name;
src = (dir + "/${name}/${n}");
in
if (v ? addLoadExtender && (lib.pathExists src) && (lib.elem n dirs)) then
if lib.isFunction ext then
ext v
else if lib.isAttrs ext then
(v.addLoadExtender { load.src = src; }).addLoadExtender ext
else
v
lib.mapAttrs (
n: v:
let
dirs = getDirs name;
src = (dir + "/${name}/${n}");
in
if (v ? addLoadExtender && (lib.pathExists src) && (lib.elem n dirs)) then
if lib.isFunction ext then
ext v
else if lib.isAttrs ext then
(v.addLoadExtender { load.src = src; }).addLoadExtender ext
else
{ }
)
pops
v
else
{ }
) pops
);
in
lib.listToAttrs (
map
(name: {
name = name;
value = processPops name;
})
list
map (name: {
name = name;
value = processPops name;
}) list
)
15 changes: 9 additions & 6 deletions src/lib/omnibus/inputsToPaths.nix
Original file line number Diff line number Diff line change
Expand Up @@ -58,24 +58,27 @@ let
l.pipe inputs [
(l.filterAttrs (_: v: l.isAttrs v && (v ? sourceInfo.outPath || v ? outPath)))
(l.mapAttrs (_: v: v.sourceInfo.outPath or v.outPath or v.path))
(l.mapAttrs (_: v: getTopLevelPath (toString v)))
(l.mapAttrs (
_: v: if lib.strings.isStorePath v then getTopLevelPath (toString v) else [ ]
))
];

attrsToPaths = i: lib.attrValues (extractAttrsFromInputs i);

inherit (flops) recursiveMerge;
updatedInputs = (recursiveMerge (l.flatten [ inputs ]));
updatedInputs = recursiveMerge (l.flatten [ inputs ]);
in
l.pipe updatedInputs [
(
v:
map (x: if v.${x} ? inputs then attrsToPaths v.${x}.inputs else attrsToPaths v)
(l.attrNames (extractAttrsFromInputs v))
map (
x: if v.${x} ? inputs then attrsToPaths v.${x}.inputs else attrsToPaths v
) (l.attrNames (extractAttrsFromInputs v))
)
(x: x ++ attrsToPaths updatedInputs)
l.flatten
l.unique
]
++ attrsToPaths updatedInputs # extractPaths From the top level inputs
] # extractPaths From the top level inputs
/* inputsToPaths {
b = {
inputs = {
Expand Down
16 changes: 7 additions & 9 deletions src/lib/recursiveAttrValues.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,13 @@ let
recursiveAttrValues =
set:
lib.flatten (
lib.mapAttrsToList
(
_name: value:
if lib.isAttrs value && !(lib.isFunction value) then
recursiveAttrValues value
else
[ value ]
)
set
lib.mapAttrsToList (
_name: value:
if lib.isAttrs value && !(lib.isFunction value) then
recursiveAttrValues value
else
[ value ]
) set
);
in
recursiveAttrValues
6 changes: 3 additions & 3 deletions src/ops/readYAML.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ in
# Path -> a :: Nix
path:
let
jsonOutputDrv =
runCommand "from-yaml" { nativeBuildInputs = [ yq-go ]; }
''yq -o=json "${path}" > "$out"'';
jsonOutputDrv = runCommand "from-yaml" {
nativeBuildInputs = [ yq-go ];
} ''yq -o=json "${path}" > "$out"'';
in
fromJSON (readFile jsonOutputDrv)
5 changes: 3 additions & 2 deletions src/ops/writeShellApplication.nix
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@ nixpkgs.writeTextFile {
''
+ l.optionalString (runtimeEnv != { }) ''
${l.concatStringsSep "\n" (
l.mapAttrsToList (n: v: "export ${n}=${''"$''}{${n}:-${toString v}}${''"''}")
runtimeEnv
l.mapAttrsToList (
n: v: "export ${n}=${''"$''}{${n}:-${toString v}}${''"''}"
) runtimeEnv
)}
''
+ ''
Expand Down
16 changes: 7 additions & 9 deletions src/pops/configs.nix
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,13 @@ let
# Function to process each layout
processLayouts =
data: cfgName:
applyRecursive
(
layoutData:
if (lib.hasAttr cfgName cfg) then
mkNixago cfg.${cfgName} layoutData
else
throw "Unknown layout: ${cfgName}"
)
(data.layouts.default.${cfgName});
applyRecursive (
layoutData:
if (lib.hasAttr cfgName cfg) then
mkNixago cfg.${cfgName} layoutData
else
throw "Unknown layout: ${cfgName}"
) (data.layouts.default.${cfgName});
in
(
(flops.haumea.pops.default.setInit {
Expand Down
35 changes: 13 additions & 22 deletions src/pops/hive.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,34 +9,25 @@ let

genColmenaFromHosts = hosts: {
meta = {
nodes =
lib.mapAttrs
(hostName: hostConfig: {
inherit (hostConfig.meta.colmena) imports deployment;
})
hosts;
nodeNixpkgs =
lib.mapAttrs
(
hostName: hostConfig: (super.types.hive.colmena hostConfig.meta.colmena).nixpkgs
)
hosts;
nodes = lib.mapAttrs (hostName: hostConfig: {
inherit (hostConfig.meta.colmena) imports deployment;
}) hosts;
nodeNixpkgs = lib.mapAttrs (
hostName: hostConfig: (super.types.hive.colmena hostConfig.meta.colmena).nixpkgs
) hosts;
};
};
in
setHosts:
pop {
defaults = {
hosts =
lib.mapAttrs
(
hostName: hostConfig:
(hostConfig)
// {
meta = (hostConfig.meta or { }) // (removeAttrs hostConfig [ "meta" ]);
}
)
setHosts;
hosts = lib.mapAttrs (
hostName: hostConfig:
(hostConfig)
// {
meta = (hostConfig.meta or { }) // (removeAttrs hostConfig [ "meta" ]);
}
) setHosts;
pops = {
omnibus = { };
nixosProfiles = { };
Expand Down
Loading

0 comments on commit 2ede5bd

Please sign in to comment.