nixos-config/flake.nix
2021-08-04 12:37:55 -07:00

40 lines
1.2 KiB
Nix

let target-version = "21.05";
in {
description = "Fudo Host Configuration";
inputs = {
nixpkgs.url = "nixpkgs/nixos-${target-version}";
home-manager.url =
"github:nix-community/home-manager/release-${target-version}";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = { nixpkgs, home-manager, ... }:
with nixpkgs.lib;
let
is-nix-file = filename: type: (builtins.match ".+.nix$" filename) != null;
is-regular-file = filename: type: type == "regular" || type == "link";
hostname-from-file = filename:
builtins.replaceStrings [ ".nix" ] [ "" ] filename;
hosts = map hostname-from-file (attrNames (filterAttrs is-nix-file
(filterAttrs is-regular-file (builtins.readDir ./config/hosts))));
pkgs = import nixpkgs { };
in {
nixConfigurations = mapAttrs (hostname: hostOpts:
lib.nixosSystem {
inherit system;
modules = [
(import ./initialize.nix {
hostname = hostname;
home-manager-package = home-manager;
pkgs = pkgs;
include-secrets = true;
})
];
}) host-configs;
};
}