nixos/flake.nix

40 lines
1.2 KiB
Nix
Raw Normal View History

2022-10-25 19:56:22 +01:00
{
inputs = {
2023-01-11 21:08:31 +00:00
nixpkgs.url = "github:nixos/nixpkgs/nixos-22.11";
2022-12-04 15:01:05 +00:00
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
2022-11-20 20:29:49 +00:00
agenix.url = "github:ryantm/agenix";
agenix.inputs.nixpkgs.follows = "nixpkgs";
2023-01-11 20:22:35 +00:00
home-manager.url = "github:nix-community/home-manager";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
2022-10-25 19:56:22 +01:00
};
description = "Hillion Nix flake";
2023-01-11 20:22:35 +00:00
outputs = { self, nixpkgs, nixpkgs-unstable, agenix, home-manager }@inputs: {
2023-01-11 20:34:07 +00:00
nixosConfigurations =
let
fqdns = builtins.attrNames (builtins.readDir ./hosts);
mkHost = fqdn:
let system = builtins.readFile ./hosts/${fqdn}/system; in
nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = inputs;
modules = [
./hosts/${fqdn}/default.nix
agenix.nixosModule
2023-01-11 20:22:35 +00:00
home-manager.nixosModule
2023-01-11 20:34:07 +00:00
{
system.configurationRevision = nixpkgs.lib.mkIf (self ? rev) self.rev;
}
];
};
in
nixpkgs.lib.genAttrs fqdns mkHost;
2022-12-28 13:59:16 +00:00
formatter."x86_64-linux" = nixpkgs.legacyPackages."x86_64-linux".nixpkgs-fmt;
formatter."aarch64-darwin" = nixpkgs.legacyPackages."aarch64-darwin".nixpkgs-fmt;
2022-10-25 19:56:22 +01:00
};
}