pkgs.writeErofsLayers,profiles/ch-runner: MVE
$ nix-build -A examples.dummy.config.debug.closure.erofs.list | xargs cat | xargs du -h 749M /nix/store/bzfv5x6lycq6hzhjv6d6vlk1q8fdg9di-base0.erofs 24M /nix/store/hp41jfq36y0mmjrzqilyh3jfsvqic3kb-nixos.erofs $ nix run -f . examples.dummy.config.uvms.cloud-hypervisor.runner ... <<< Welcome to NixOS 25.11pre-git (x86_64) - ttyS0 >>> nixos login: The definition of the `pkgs` fixpoint was moved to pkgs/default.nix. For that, dirToAttrs was moved to lib/, imported ad hoc
This commit is contained in:
parent
1828835a1d
commit
28d3f89ad4
12 changed files with 428 additions and 77 deletions
41
default.nix
41
default.nix
|
@ -1,26 +1,7 @@
|
|||
let
|
||||
pkgs = import <nixpkgs> { };
|
||||
inherit (pkgs) lib;
|
||||
dirToAttrs =
|
||||
root: patterns: f:
|
||||
lib.listToAttrs (
|
||||
lib.concatMap (
|
||||
dirent:
|
||||
let
|
||||
fname = dirent.name;
|
||||
typ = dirent.value;
|
||||
fpath = root + "/${fname}";
|
||||
doMatch =
|
||||
pat:
|
||||
let
|
||||
match = pat fpath fname typ;
|
||||
value = f match fpath typ;
|
||||
in
|
||||
if match == null then [ ] else [ (lib.nameValuePair match value) ];
|
||||
in
|
||||
(lib.take 1 (lib.concatMap (doMatch) patterns))
|
||||
) (lib.attrsToList (builtins.readDir root))
|
||||
);
|
||||
dirToAttrs = import ./lib/dirToAttrs.nix { inherit lib; };
|
||||
in
|
||||
{
|
||||
examples =
|
||||
|
@ -35,23 +16,5 @@ in
|
|||
name: fpath: _:
|
||||
import <nixpkgs/nixos/lib/eval-config.nix> { modules = [ fpath ]; }
|
||||
);
|
||||
pkgs = lib.makeScope pkgs.newScope (
|
||||
self:
|
||||
dirToAttrs ./pkgs
|
||||
[
|
||||
(
|
||||
path: fname: _:
|
||||
lib.strings.removeSuffix ".nix" fname
|
||||
)
|
||||
]
|
||||
(
|
||||
name: fpath: typ:
|
||||
if typ == "regular" then
|
||||
self.callPackage fpath { }
|
||||
else if typ == "directory" && builtins.pathExists (fpath + "/package.nix") then
|
||||
self.callPackage (fpath + "/package.nix") { }
|
||||
else
|
||||
null
|
||||
)
|
||||
);
|
||||
pkgs = pkgs.callPackage ./pkgs { };
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue