Das Netzwerk in der Riesaer Str. 32
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

90 lines
2.8 KiB

{
description = "Zentralwerk network";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/release-21.11";
nixpkgs-master.url = "github:NixOS/nixpkgs";
openwrt.url = "git+https://git.openwrt.org/openwrt/openwrt.git?ref=openwrt-21.02";
openwrt.flake = false;
};
outputs = inputs@{ self, nixpkgs, nixpkgs-master, openwrt }:
let
system = "x86_64-linux";
systems = [ system ];
forAllSystems = nixpkgs.lib.genAttrs systems;
nixosConfig = name:
self.lib.nixosSystem {
inherit system;
modules = [ self.nixosModule ];
specialArgs.hostName = name;
specialArgs.lib = self.lib;
specialArgs.self = self;
specialArgs.inputs = inputs;
specialArgs.nixpkgs-master = nixpkgs-master;
};
in {
# Config, and utilities
lib = nixpkgs.lib.extend (final: prev:
import ./nix/lib {
inherit self;
inherit openwrt;
pkgs = nixpkgs.legacyPackages.x86_64-linux;
});
# Everything that can be built locally outside of NixOS
packages = forAllSystems (system:
import ./nix/pkgs { inherit self nixpkgs system; }
);
# Configuration for nixosConfigurations
# (see nix/nixos-module/default.nix)
nixosModule = { ... }: {
imports = [ ./nix/nixos-module ];
};
# NixOS host systems (servers, and containers)
nixosConfigurations =
builtins.mapAttrs (hostName: _: nixosConfig hostName) (
nixpkgs.lib.filterAttrs (_: { role, ... }:
builtins.elem role [ "server" "container" ]
) self.lib.config.site.hosts
);
# For `nix flake check`, and Hydra
checks = self.packages;
hydraJobs =
with self.lib;
let
exportFileWrapper = pkg:
hydraJob (
nixpkgs.legacyPackages.${system}.runCommand "${pkg.name}-exported" {
src = pkg;
} ''
NAME="${pkg.name}"
mkdir -p $out/nix-support
ln -s ${pkg} $out/$NAME
echo file source-dist $out/$NAME >> $out/nix-support/hydra-build-products
''
);
wrappers = {
"all-device-scripts" = pkg:
hydraJob pkg;
"export-config" = exportFileWrapper;
".*-pillar" = exportFileWrapper;
"switch-.*" = exportFileWrapper;
"ap.*" = exportFileWrapper;
};
in
builtins.mapAttrs (name: pkg:
builtins.foldl' (result: wrapperName:
if builtins.match wrapperName name != null
then wrappers.${wrapperName} pkg
else result
) pkg (builtins.attrNames wrappers)
) self.packages.${system};
};
}