mirror of
https://github.com/divnix/digga.git
synced 2024-12-27 18:16:59 +03:00
79181e103f
NixOS file, configurations/<name>.nix, will be easily installable via `nixos-rebuild --flake ".#<name>"`.
73 lines
1.3 KiB
Nix
73 lines
1.3 KiB
Nix
{ 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
|
|
coreConfig = ../modules/profiles/core.nix;
|
|
|
|
globalConfig = {
|
|
system.configurationRevision = flake.rev;
|
|
|
|
networking.hostName = "${this}";
|
|
|
|
nix.package = nix.defaultPackage."${system}";
|
|
};
|
|
|
|
thisConfig = ./. + "/${this}.nix";
|
|
|
|
in
|
|
[
|
|
coreConfig
|
|
globalConfig
|
|
thisConfig
|
|
];
|
|
|
|
};
|
|
|
|
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
|