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

65 lines
1.8 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-18 04:26:02 -05:00
outputs =
{ self
, nixpkgs
, sops-nix
, ...
} @ inputs:
let
inherit (self) outputs;
forAllSystems = nixpkgs.lib.genAttrs [
"aarch64-linux"
# "i686-linux"
"x86_64-linux"
# "aarch64-darwin"
# "x86_64-darwin"
];
in
2024-03-17 16:04:32 -05:00
with inputs; {
2024-03-13 06:55:17 -05:00
# Use nixpkgs-fmt for 'nix fmt'
2024-03-18 04:06:00 -05:00
formatter = forAllSystems (system: nixpkgs.legacyPackages."${system}".nixpkgs-fmt);
2024-03-13 06:55:17 -05:00
2024-03-16 07:46:36 -05:00
# Each subdirectory in ./machines is a host. Add them all to
2024-03-13 06:55:17 -05:00
# 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.
2024-03-18 04:26:02 -05:00
specialArgs = { flake-self = self; } // inputs;
2024-03-13 06:55:17 -05:00
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)));
2024-03-16 07:46:36 -05:00
};
}