This repository has been archived on 2024-07-08. You can view files and clone it, but cannot push or open issues or pull requests.
nix-config-tn/flake.nix

54 lines
1.6 KiB
Nix
Raw Normal View History

2024-03-13 06:55:17 -05:00
{
description = "My machines";
inputs = {
# Nixpkgs and unstable
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11";
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
# sops-nix
sops-nix = {
url = "github:Mic92/sops-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
# VSCode community extensions
nix-vscode-extensions = {
url = "github:nix-community/nix-vscode-extensions";
inputs.nixpkgs.follows = "nixpkgs";
};
};
2024-03-14 06:04:40 -05:00
outputs = { self, nixpkgs, sops-nix, ... }@inputs:
2024-03-13 06:55:17 -05:00
with inputs;
{
# Use nixpkgs-fmt for 'nix fmt'
formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.nixpkgs-fmt;
# Each subdirectory in ./machines is a host. Add them all to
# nixosConfigurations. Host configurations need a file called
# configuration.nix that will be read first
nixosConfigurations = builtins.listToAttrs (map
(x: {
name = x;
value = nixpkgs.lib.nixosSystem {
# Make inputs and the flake itself accessible as module parameters.
# Technically, adding the inputs is redundant as they can be also
# accessed with flake-self.inputs.X, but adding them individually
# allows to only pass what is needed to each module.
specialArgs = { flake-self = self; } // inputs;
system = "x86_64-linux";
modules = [
(./nixos/hosts + "/${x}/default.nix")
2024-03-14 06:04:40 -05:00
sops-nix.nixosModules.sops
2024-03-13 06:55:17 -05:00
];
};
})
(builtins.attrNames (builtins.readDir ./nixos/hosts)));
};
}