devos/configurations/default.nix

73 lines
1.3 KiB
Nix
Raw Normal View History

{ nix, nixpkgs, flake, ... }:
let
inherit (builtins)
isAttrs
readDir
;
inherit (nixpkgs.lib)
filterAttrs
hasSuffix
mapAttrs'
nameValuePair
removeSuffix
;
configs = let
configs' = let
config = this:
nixpkgs.lib.nixosSystem rec {
system = "x86_64-linux";
modules = let
2019-12-05 19:09:17 +01:00
core = ../profiles/core.nix;
2019-12-05 19:09:17 +01:00
global = {
system.configurationRevision = flake.rev;
networking.hostName = "${this}";
nix.package = nix.defaultPackage."${system}";
};
2019-12-05 19:09:17 +01:00
local = ./. + "/${this}.nix";
in
[
2019-12-05 19:09:17 +01:00
core
global
local
];
};
dot = readDir ./.;
in
mapAttrs'
(
name: value:
if
name != "default.nix"
&& hasSuffix ".nix" name
&& value == "regular"
then let
name' = removeSuffix ".nix" name;
in
nameValuePair (name') (config name')
else
nameValuePair ("") (null)
)
dot;
removeInvalid =
filterAttrs (_: value: isAttrs value);
in
removeInvalid configs';
in
configs