forked from zentralwerk/network
pkgs/device-templates.nix: update
This commit is contained in:
parent
7b7745e376
commit
f15bb721d2
|
@ -12,8 +12,8 @@
|
|||
forAllSystems = nixpkgs.lib.genAttrs systems;
|
||||
in
|
||||
rec {
|
||||
lib = forAllSystems (system:
|
||||
import ./nix/lib { inherit nixpkgs system; }
|
||||
lib =
|
||||
import ./nix/lib { inherit nixpkgs; }
|
||||
);
|
||||
|
||||
packages = forAllSystems (system: {
|
||||
|
@ -25,9 +25,7 @@
|
|||
ln -s $src/init $out/
|
||||
ln -s $src/etc $out/etc/static
|
||||
'';
|
||||
});
|
||||
|
||||
#defaultPackage.x86_64-linux = self.packages.x86_64-linux.hello;
|
||||
} // (import ./nix/pkgs/device-templates.nix { inherit self nixpkgs system; }));
|
||||
|
||||
nixosModule = { ... }: {
|
||||
imports = nixpkgs.lib.filesystem.listFilesRecursive ./nix/nixos-modules;
|
||||
|
|
|
@ -6,7 +6,6 @@ let
|
|||
modules = [
|
||||
./options.nix
|
||||
./legacy.nix
|
||||
./device-templates.nix
|
||||
];
|
||||
};
|
||||
in
|
||||
|
|
|
@ -6,4 +6,4 @@ let
|
|||
in
|
||||
builtins.foldl' (result: filename:
|
||||
recursiveUpdate result (loadYaml filename)
|
||||
) {} (filesystem.listFilesRecursive ../../salt-pillar)
|
||||
) {} (filesystem.listFilesRecursive ../../../../salt-pillar)
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
with lib;
|
||||
{ self, nixpkgs, system }:
|
||||
with nixpkgs.lib;
|
||||
let
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
config = self.lib.${system}.config;
|
||||
|
||||
templates = role: {
|
||||
ap = _: ../salt/cpe/ap.sh;
|
||||
switch = model: ../salt/switches + "/${model}.expect";
|
||||
|
@ -15,16 +18,8 @@ let
|
|||
import ./salt-support/expand-template.nix {
|
||||
inherit pkgs;
|
||||
} name (replaceNetmasks template) data;
|
||||
in
|
||||
{
|
||||
options.site.device-scripts = mkOption {
|
||||
type = with types; attrsOf path;
|
||||
};
|
||||
options.site.all-device-scripts = mkOption {
|
||||
type = types.path;
|
||||
};
|
||||
|
||||
config.site.device-scripts =
|
||||
device-scripts =
|
||||
builtins.mapAttrs (hostname: { role, model, ... }:
|
||||
expandTemplate "${hostname}.sh" (templates role model) ({
|
||||
inherit hostname;
|
||||
|
@ -40,7 +35,7 @@ in
|
|||
role == "ap" || role == "switch"
|
||||
) config.site.hosts);
|
||||
|
||||
config.site.all-device-scripts =
|
||||
all-device-scripts =
|
||||
pkgs.runCommandLocal "all-device-scripts" {} (
|
||||
''
|
||||
mkdir -p $out/bin
|
||||
|
@ -51,4 +46,7 @@ in
|
|||
) (builtins.attrNames config.site.device-scripts)
|
||||
)
|
||||
);
|
||||
}
|
||||
in
|
||||
{
|
||||
inherit all-device-scripts;
|
||||
} // device-scripts
|
||||
|
|
Loading…
Reference in New Issue