apply nixfmt to tree of flakes #8
19 changed files with 378 additions and 164 deletions
|
|
@ -1,3 +1,6 @@
|
|||
{ ... }@flake: { ... }@inputs: { ... }@imports: {
|
||||
imports = builtins.attrValues (flake.hmModules or {});
|
||||
{ ... }@flake:
|
||||
{ ... }@inputs:
|
||||
{ ... }@imports:
|
||||
{
|
||||
imports = builtins.attrValues (flake.hmModules or { });
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,8 @@
|
|||
flake: { ... }@inputs: { ... }@imports: let
|
||||
flake:
|
||||
{ ... }@inputs:
|
||||
{ ... }@imports:
|
||||
let
|
||||
module' = name: imports: builtins.trace "user module: ${name}" { inherit imports; };
|
||||
modules = builtins.mapAttrs module' imports."user/module";
|
||||
in { default = module' "default" (builtins.attrValues modules); } // modules
|
||||
in
|
||||
{ default = module' "default" (builtins.attrValues modules); } // modules
|
||||
|
|
|
|||
|
|
@ -1,4 +1,7 @@
|
|||
{ ... }@flake: { ... }@inputs: { profile, ... }@imports: let
|
||||
{ ... }@flake:
|
||||
{ ... }@inputs:
|
||||
{ profile, ... }@imports:
|
||||
let
|
||||
profile' = name: snippets: builtins.trace "home-manager: profile: ${name}" { imports = snippets; };
|
||||
in builtins.mapAttrs profile' profile
|
||||
|
||||
in
|
||||
builtins.mapAttrs profile' profile
|
||||
|
|
|
|||
|
|
@ -1,32 +1,50 @@
|
|||
{ nixosUsers ? {}, nixosGroups ? {}, nixosModules, hmModules ? { default = {}; }, ...}@flake: { ... }@inputs: { host, ... }@imports: let
|
||||
host' = name: snippets: let
|
||||
{
|
||||
nixosUsers ? { },
|
||||
nixosGroups ? { },
|
||||
nixosModules,
|
||||
hmModules ? {
|
||||
default = { };
|
||||
},
|
||||
...
|
||||
}@flake:
|
||||
{ ... }@inputs:
|
||||
{ host, ... }@imports:
|
||||
let
|
||||
host' =
|
||||
name: snippets:
|
||||
let
|
||||
|
||||
overlay = self: super: {
|
||||
makeModulesClosure = x: super.makeModulesClosure (x // { allowMissing = true; });
|
||||
};
|
||||
|
||||
common = { modulesPath, lib, ... }: {
|
||||
config.nixpkgs.overlays = [ overlay ];
|
||||
config.networking.hostName = lib.mkForce name;
|
||||
config.home-manager = {
|
||||
sharedModules = [ hmModules.default ] ;
|
||||
overlay = self: super: {
|
||||
makeModulesClosure = x: super.makeModulesClosure (x // { allowMissing = true; });
|
||||
};
|
||||
|
||||
imports = [
|
||||
(modulesPath + "/installer/cd-dvd/installation-cd-minimal-new-kernel-no-zfs.nix")
|
||||
nixosModules.default
|
||||
inputs.home-manager.nixosModules.default
|
||||
];
|
||||
};
|
||||
common =
|
||||
{ modulesPath, lib, ... }:
|
||||
{
|
||||
config.nixpkgs.overlays = [ overlay ];
|
||||
config.networking.hostName = lib.mkForce name;
|
||||
config.home-manager = {
|
||||
sharedModules = [ hmModules.default ];
|
||||
};
|
||||
|
||||
system = inputs.nixpkgs.lib.nixosSystem {
|
||||
specialArgs = { inherit inputs flake; };
|
||||
modules = [ common ]
|
||||
imports = [
|
||||
(modulesPath + "/installer/cd-dvd/installation-cd-minimal-new-kernel-no-zfs.nix")
|
||||
nixosModules.default
|
||||
inputs.home-manager.nixosModules.default
|
||||
];
|
||||
};
|
||||
|
||||
system = inputs.nixpkgs.lib.nixosSystem {
|
||||
specialArgs = { inherit inputs flake; };
|
||||
modules = [
|
||||
common
|
||||
]
|
||||
++ snippets
|
||||
++ builtins.attrValues nixosUsers
|
||||
++ builtins.attrValues nixosGroups
|
||||
;
|
||||
};
|
||||
in system.config.system.build.isoImage;
|
||||
++ builtins.attrValues nixosGroups;
|
||||
};
|
||||
in
|
||||
system.config.system.build.isoImage;
|
||||
|
||||
in builtins.mapAttrs host' host
|
||||
in
|
||||
builtins.mapAttrs host' host
|
||||
|
|
|
|||
|
|
@ -1,19 +1,45 @@
|
|||
{ nixosUsers ? {}, nixosGroups ? {}, nixosModules, hmModules ? { default = {}; }, ...}@flake: { ... }@inputs: { host, ... }@imports: let
|
||||
system = hostname: { namespace ? "fbs42", nixpkgs ? "nixpkgs" }: inputs.${nixpkgs}.lib.nixosSystem {
|
||||
specialArgs = { inherit inputs flake namespace; };
|
||||
modules = builtins.concatLists (map (base: builtins.attrValues (flake.lib.scan { base = "${base}/host/${hostname}"; })) flake.lib.schema.base)
|
||||
++ [ { config.networking.hostName = hostname; } ]
|
||||
++ [ nixosModules.default ]
|
||||
++ inputs.${nixpkgs}.lib.optional (inputs ? home-manager) {
|
||||
imports = [ inputs.home-manager.nixosModules.default ];
|
||||
config.home-manager = {
|
||||
sharedModules = [ hmModules.default ];
|
||||
extraSpecialArgs = { inherit flake namespace; };
|
||||
};
|
||||
}
|
||||
++ builtins.attrValues nixosUsers
|
||||
++ builtins.attrValues nixosGroups
|
||||
;
|
||||
};
|
||||
{
|
||||
nixosUsers ? { },
|
||||
nixosGroups ? { },
|
||||
nixosModules,
|
||||
hmModules ? {
|
||||
default = { };
|
||||
},
|
||||
...
|
||||
}@flake:
|
||||
{ ... }@inputs:
|
||||
{ host, ... }@imports:
|
||||
let
|
||||
system =
|
||||
hostname:
|
||||
{
|
||||
namespace ? "fbs42",
|
||||
nixpkgs ? "nixpkgs",
|
||||
}:
|
||||
inputs.${nixpkgs}.lib.nixosSystem {
|
||||
specialArgs = { inherit inputs flake namespace; };
|
||||
modules =
|
||||
builtins.concatLists (
|
||||
map (
|
||||
base: builtins.attrValues (flake.lib.scan { base = "${base}/host/${hostname}"; })
|
||||
) flake.lib.schema.base
|
||||
)
|
||||
++ [ { config.networking.hostName = hostname; } ]
|
||||
++ [ nixosModules.default ]
|
||||
++ inputs.${nixpkgs}.lib.optional (inputs ? home-manager) {
|
||||
imports = [ inputs.home-manager.nixosModules.default ];
|
||||
config.home-manager = {
|
||||
sharedModules = [ hmModules.default ];
|
||||
extraSpecialArgs = { inherit flake namespace; };
|
||||
};
|
||||
}
|
||||
++ builtins.attrValues nixosUsers
|
||||
++ builtins.attrValues nixosGroups;
|
||||
};
|
||||
|
||||
in builtins.mapAttrs (name: value: assert builtins.length value == 1; system name (builtins.head value)) host
|
||||
in
|
||||
builtins.mapAttrs (
|
||||
name: value:
|
||||
assert builtins.length value == 1;
|
||||
system name (builtins.head value)
|
||||
) host
|
||||
|
|
|
|||
|
|
@ -1,10 +1,25 @@
|
|||
flake: { ... }@inputs: { group, ... }@imports: let
|
||||
group' = name: snippets: { pkgs, lib, options, config, ... }@args: let
|
||||
invoke = x: if builtins.isFunction x then x args else x;
|
||||
in {
|
||||
options.fbs42.group.${name} = lib.mkEnableOption name;
|
||||
config.users.groups.${name} = lib.mkIf
|
||||
(config.fbs42.group.${name} || builtins.any (usr: usr.group == name) (builtins.attrValues config.users.users))
|
||||
(lib.mkMerge (map invoke snippets));
|
||||
};
|
||||
in builtins.mapAttrs group' group
|
||||
flake:
|
||||
{ ... }@inputs:
|
||||
{ group, ... }@imports:
|
||||
let
|
||||
group' =
|
||||
name: snippets:
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
options,
|
||||
config,
|
||||
...
|
||||
}@args:
|
||||
let
|
||||
invoke = x: if builtins.isFunction x then x args else x;
|
||||
in
|
||||
{
|
||||
options.fbs42.group.${name} = lib.mkEnableOption name;
|
||||
config.users.groups.${name} = lib.mkIf (
|
||||
config.fbs42.group.${name}
|
||||
|| builtins.any (usr: usr.group == name) (builtins.attrValues config.users.users)
|
||||
) (lib.mkMerge (map invoke snippets));
|
||||
};
|
||||
in
|
||||
builtins.mapAttrs group' group
|
||||
|
|
|
|||
|
|
@ -1,3 +1,14 @@
|
|||
flake: { ... }@inputs: { module, ... }@imports: let
|
||||
modules = builtins.mapAttrs (name: imports: builtins.trace "module: ${name}" { inherit imports; }) module;
|
||||
in { default = { imports = builtins.attrValues modules; }; } // modules
|
||||
flake:
|
||||
{ ... }@inputs:
|
||||
{ module, ... }@imports:
|
||||
let
|
||||
modules = builtins.mapAttrs (
|
||||
name: imports: builtins.trace "module: ${name}" { inherit imports; }
|
||||
) module;
|
||||
in
|
||||
{
|
||||
default = {
|
||||
imports = builtins.attrValues modules;
|
||||
};
|
||||
}
|
||||
// modules
|
||||
|
|
|
|||
|
|
@ -1,2 +1,4 @@
|
|||
{ ... }@flake: { ... }@inputs: { profile, ... }@imports:
|
||||
builtins.mapAttrs (name: imports: builtins.trace "profile: ${name}" { inherit imports; }) profile
|
||||
{ ... }@flake:
|
||||
{ ... }@inputs:
|
||||
{ profile, ... }@imports:
|
||||
builtins.mapAttrs (name: imports: builtins.trace "profile: ${name}" { inherit imports; }) profile
|
||||
|
|
|
|||
|
|
@ -1,5 +1,15 @@
|
|||
self: { ... }@inputs: { user, ... }@imports: let
|
||||
user' = name: snippets: { pkgs, lib, config, ... }@args:
|
||||
self:
|
||||
{ ... }@inputs:
|
||||
{ user, ... }@imports:
|
||||
let
|
||||
user' =
|
||||
name: snippets:
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}@args:
|
||||
builtins.trace "user: ${name}" {
|
||||
options.fbs42.user.${name} = lib.mkEnableOption name;
|
||||
## no longer with nixos-24.11
|
||||
|
|
@ -7,11 +17,15 @@ self: { ... }@inputs: { user, ... }@imports: let
|
|||
# group = lib.mkDefault name;
|
||||
#};
|
||||
|
||||
imports = map ({ user, home-manager}: {
|
||||
config = lib.mkIf config.fbs42.user.${name} {
|
||||
users.users.${name} = (user args);
|
||||
home-manager.users.${name} = home-manager;
|
||||
};
|
||||
}) snippets;
|
||||
imports = map (
|
||||
{ user, home-manager }:
|
||||
{
|
||||
config = lib.mkIf config.fbs42.user.${name} {
|
||||
users.users.${name} = (user args);
|
||||
home-manager.users.${name} = home-manager;
|
||||
};
|
||||
}
|
||||
) snippets;
|
||||
};
|
||||
in builtins.mapAttrs user' user
|
||||
in
|
||||
builtins.mapAttrs user' user
|
||||
|
|
|
|||
|
|
@ -1,34 +1,52 @@
|
|||
{ nixosUsers ? {}, nixosGroups ? {}, nixosModules, hmModules ? { default = {}; }, ...}@flake: { ... }@inputs: { host, ... }@imports: let
|
||||
host' = name: snippets: let
|
||||
{
|
||||
nixosUsers ? { },
|
||||
nixosGroups ? { },
|
||||
nixosModules,
|
||||
hmModules ? {
|
||||
default = { };
|
||||
},
|
||||
...
|
||||
}@flake:
|
||||
{ ... }@inputs:
|
||||
{ host, ... }@imports:
|
||||
let
|
||||
host' =
|
||||
name: snippets:
|
||||
let
|
||||
|
||||
overlay = self: super: {
|
||||
makeModulesClosure = x: super.makeModulesClosure (x // { allowMissing = true; });
|
||||
};
|
||||
|
||||
common = { modulesPath, lib, ... }: {
|
||||
config.nixpkgs.overlays = [ overlay ];
|
||||
config.networking.hostName = lib.mkForce name;
|
||||
config.home-manager = {
|
||||
sharedModules = [ hmModules.default ] ;
|
||||
overlay = self: super: {
|
||||
makeModulesClosure = x: super.makeModulesClosure (x // { allowMissing = true; });
|
||||
};
|
||||
|
||||
imports = [
|
||||
#(modulesPath + "/installer/cd-dvd/installation-cd-minimal-new-kernel-no-zfs.nix")
|
||||
#(modulesPath + "/installer/sd-card/sd-image-aarch64.nix")
|
||||
(modulesPath + "/installer/sd-card/sd-image-raspberrypi.nix")
|
||||
nixosModules.default
|
||||
inputs.home-manager.nixosModules.default
|
||||
];
|
||||
};
|
||||
common =
|
||||
{ modulesPath, lib, ... }:
|
||||
{
|
||||
config.nixpkgs.overlays = [ overlay ];
|
||||
config.networking.hostName = lib.mkForce name;
|
||||
config.home-manager = {
|
||||
sharedModules = [ hmModules.default ];
|
||||
};
|
||||
|
||||
system = inputs.nixpkgs.lib.nixosSystem {
|
||||
specialArgs = { inherit inputs flake; };
|
||||
modules = [ common ]
|
||||
imports = [
|
||||
#(modulesPath + "/installer/cd-dvd/installation-cd-minimal-new-kernel-no-zfs.nix")
|
||||
#(modulesPath + "/installer/sd-card/sd-image-aarch64.nix")
|
||||
(modulesPath + "/installer/sd-card/sd-image-raspberrypi.nix")
|
||||
nixosModules.default
|
||||
inputs.home-manager.nixosModules.default
|
||||
];
|
||||
};
|
||||
|
||||
system = inputs.nixpkgs.lib.nixosSystem {
|
||||
specialArgs = { inherit inputs flake; };
|
||||
modules = [
|
||||
common
|
||||
]
|
||||
++ snippets
|
||||
++ builtins.attrValues nixosUsers
|
||||
++ builtins.attrValues nixosGroups
|
||||
;
|
||||
};
|
||||
in system.config.system.build.sdImage;
|
||||
++ builtins.attrValues nixosGroups;
|
||||
};
|
||||
in
|
||||
system.config.system.build.sdImage;
|
||||
|
||||
in builtins.mapAttrs host' host
|
||||
in
|
||||
builtins.mapAttrs host' host
|
||||
|
|
|
|||
22
flake.lock
generated
22
flake.lock
generated
|
|
@ -1,6 +1,26 @@
|
|||
{
|
||||
"nodes": {
|
||||
"root": {}
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1763966396,
|
||||
"narHash": "sha256-6eeL1YPcY1MV3DDStIDIdy/zZCDKgHdkCmsrLJFiZf0=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "5ae3b07d8d6527c42f17c876e404993199144b6a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
|
|
|
|||
|
|
@ -1,3 +1,6 @@
|
|||
{
|
||||
# only used for nixfmt-tree
|
||||
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
|
||||
outputs = { self, ... }@inputs: import ./lib/flake.nix inputs ./.;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
{}
|
||||
{ }
|
||||
|
|
|
|||
|
|
@ -1,21 +1,34 @@
|
|||
let
|
||||
function = name: value: let
|
||||
result = if builtins.isAttrs value then {...}: value else value;
|
||||
result' = builtins.trace "result ${name}=${builtins.typeOf result}" result;
|
||||
in
|
||||
function =
|
||||
name: value:
|
||||
let
|
||||
result = if builtins.isAttrs value then { ... }: value else value;
|
||||
result' = builtins.trace "result ${name}=${builtins.typeOf result}" result;
|
||||
in
|
||||
assert builtins.isFunction result';
|
||||
result;
|
||||
|
||||
config = { user?{}, home-manager?{} }@set:
|
||||
config =
|
||||
{
|
||||
user ? { },
|
||||
home-manager ? { },
|
||||
}@set:
|
||||
builtins.mapAttrs function { inherit user home-manager; };
|
||||
|
||||
in name: value: let
|
||||
result = if builtins.isFunction value
|
||||
in
|
||||
name: value:
|
||||
let
|
||||
result =
|
||||
if builtins.isFunction value then
|
||||
config { user = value; }
|
||||
else if
|
||||
builtins.any (attr: builtins.hasAttr attr value) [
|
||||
"user"
|
||||
"home-manager"
|
||||
]
|
||||
then
|
||||
config { user = value; }
|
||||
else if builtins.any (attr: builtins.hasAttr attr value) [ "user" "home-manager" ]
|
||||
then
|
||||
config value
|
||||
else
|
||||
config { user = value; };
|
||||
in result
|
||||
config value
|
||||
else
|
||||
config { user = value; };
|
||||
in
|
||||
result
|
||||
|
|
|
|||
|
|
@ -1,2 +1 @@
|
|||
name: profile: profile
|
||||
|
||||
|
|
|
|||
|
|
@ -1,34 +1,81 @@
|
|||
let
|
||||
scan = import ./scan.nix;
|
||||
|
||||
flake' = self: { imports, exports , base }@schema: { ... }@inputs: { ... }@imports: let
|
||||
lib = {
|
||||
inherit scan schema inputs imports;
|
||||
extend = flake schema inputs imports;
|
||||
new = flake {} {} {};
|
||||
# TODO: override
|
||||
};
|
||||
convert = attr: value: value self inputs imports;
|
||||
flake' =
|
||||
self:
|
||||
{
|
||||
imports,
|
||||
exports,
|
||||
base,
|
||||
}@schema:
|
||||
{ ... }@inputs:
|
||||
{ ... }@imports:
|
||||
let
|
||||
lib = {
|
||||
inherit
|
||||
scan
|
||||
schema
|
||||
inputs
|
||||
imports
|
||||
;
|
||||
extend = flake schema inputs imports;
|
||||
new = flake { } { } { };
|
||||
# TODO: override
|
||||
};
|
||||
convert = attr: value: value self inputs imports;
|
||||
|
||||
result = (builtins.mapAttrs convert schema.exports);
|
||||
in result // { lib = lib // (result.lib or {}); };
|
||||
|
||||
flake = { imports?{}, exports?{}, base?[] }@schema'old: { ... }@inputs'old: { ... }@imports'old: { ... }@inputs'new: base: let
|
||||
schema = {
|
||||
imports = (schema'old.imports or {}) // scan { base = base + "/import"; recursive = true; };
|
||||
exports = (schema'old.exports or {}) // scan { base = base + "/export"; };
|
||||
base = [ base ] ++ (schema'old.base or []);
|
||||
result = (builtins.mapAttrs convert schema.exports);
|
||||
in
|
||||
{
|
||||
formatter = builtins.mapAttrs (_: pkgs: pkgs.nixfmt-tree) inputs.nixpkgs.legacyPackages;
|
||||
}
|
||||
// result
|
||||
// {
|
||||
lib = lib // (result.lib or { });
|
||||
};
|
||||
|
||||
merge = attr: let
|
||||
old = imports'old.${attr} or {};
|
||||
new = imports'new.${attr} or {};
|
||||
in builtins.mapAttrs (attr: _: (old.${attr} or []) ++ (new.${attr} or [])) (old//new);
|
||||
flake =
|
||||
{
|
||||
imports ? { },
|
||||
exports ? { },
|
||||
base ? [ ],
|
||||
}@schema'old:
|
||||
{ ... }@inputs'old:
|
||||
{ ... }@imports'old:
|
||||
{ ... }@inputs'new:
|
||||
base:
|
||||
let
|
||||
schema = {
|
||||
imports =
|
||||
(schema'old.imports or { })
|
||||
// scan {
|
||||
base = base + "/import";
|
||||
recursive = true;
|
||||
};
|
||||
exports = (schema'old.exports or { }) // scan { base = base + "/export"; };
|
||||
base = [ base ] ++ (schema'old.base or [ ]);
|
||||
};
|
||||
|
||||
imports'new = builtins.mapAttrs (name: value: scan { base = base + "/${name}"; convert = name: content: [ (value name content) ]; }) schema.imports;
|
||||
result = flake' result schema
|
||||
(inputs'old // (builtins.removeAttrs inputs'new ["self"]))
|
||||
(builtins.mapAttrs (attr: _: merge attr) schema.imports);
|
||||
in result;
|
||||
merge =
|
||||
attr:
|
||||
let
|
||||
old = imports'old.${attr} or { };
|
||||
new = imports'new.${attr} or { };
|
||||
in
|
||||
builtins.mapAttrs (attr: _: (old.${attr} or [ ]) ++ (new.${attr} or [ ])) (old // new);
|
||||
|
||||
in flake {} {} {}
|
||||
imports'new = builtins.mapAttrs (
|
||||
name: value:
|
||||
scan {
|
||||
base = base + "/${name}";
|
||||
convert = name: content: [ (value name content) ];
|
||||
}
|
||||
) schema.imports;
|
||||
result = flake' result schema (inputs'old // (builtins.removeAttrs inputs'new [ "self" ])) (
|
||||
builtins.mapAttrs (attr: _: merge attr) schema.imports
|
||||
);
|
||||
in
|
||||
result;
|
||||
|
||||
in
|
||||
flake { } { } { }
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
self:
|
||||
53
lib/scan.nix
53
lib/scan.nix
|
|
@ -1,23 +1,42 @@
|
|||
{ base, convert ? name: value: value, recursive ? false }:
|
||||
{
|
||||
base,
|
||||
convert ? name: value: value,
|
||||
recursive ? false,
|
||||
}:
|
||||
let
|
||||
scan = sub: let
|
||||
all = builtins.readDir (base + "/${builtins.concatStringsSep "/" sub}");
|
||||
names = filter: builtins.filter filter (builtins.attrNames all);
|
||||
nix = name: all.${name} == "regular" && builtins.stringLength name > 4 && builtins.substring (builtins.stringLength name - 4) 4 name == ".nix";
|
||||
dir = name: all.${name} == "directory";
|
||||
files = map (name: sub ++ [ (builtins.substring 0 (builtins.stringLength name - 4) name) ]) (names nix);
|
||||
dirs = builtins.concatLists (map (name: scan (sub ++ [name])) (names dir));
|
||||
in if recursive then files ++ dirs else files;
|
||||
scan =
|
||||
sub:
|
||||
let
|
||||
all = builtins.readDir (base + "/${builtins.concatStringsSep "/" sub}");
|
||||
names = filter: builtins.filter filter (builtins.attrNames all);
|
||||
nix =
|
||||
name:
|
||||
all.${name} == "regular"
|
||||
&& builtins.stringLength name > 4
|
||||
&& builtins.substring (builtins.stringLength name - 4) 4 name == ".nix";
|
||||
dir = name: all.${name} == "directory";
|
||||
files = map (name: sub ++ [ (builtins.substring 0 (builtins.stringLength name - 4) name) ]) (
|
||||
names nix
|
||||
);
|
||||
dirs = builtins.concatLists (map (name: scan (sub ++ [ name ])) (names dir));
|
||||
in
|
||||
if recursive then files ++ dirs else files;
|
||||
|
||||
root = scan [];
|
||||
root = scan [ ];
|
||||
|
||||
item = relative: let
|
||||
name = builtins.concatStringsSep "/" relative;
|
||||
absolute = base + "/${name}.nix";
|
||||
content = import absolute;
|
||||
value = convert name content;
|
||||
in { inherit name value; };
|
||||
item =
|
||||
relative:
|
||||
let
|
||||
name = builtins.concatStringsSep "/" relative;
|
||||
absolute = base + "/${name}.nix";
|
||||
content = import absolute;
|
||||
value = convert name content;
|
||||
in
|
||||
{
|
||||
inherit name value;
|
||||
};
|
||||
|
||||
items = map item root;
|
||||
|
||||
in if builtins.pathExists base then builtins.listToAttrs (map item root) else {}
|
||||
in
|
||||
if builtins.pathExists base then builtins.listToAttrs (map item root) else { }
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
{}
|
||||
{ }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue