nixos/flake.nix

68 lines
2.5 KiB
Nix
Raw Normal View History

2022-10-25 19:56:22 +01:00
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05";
2022-12-04 15:01:05 +00:00
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
2022-11-20 20:29:49 +00:00
2024-05-25 15:53:18 +01:00
nixos-hardware.url = "github:nixos/nixos-hardware";
2023-09-09 22:24:27 +01:00
flake-utils.url = "github:numtide/flake-utils";
2022-11-20 20:29:49 +00:00
agenix.url = "github:ryantm/agenix";
agenix.inputs.nixpkgs.follows = "nixpkgs";
2024-04-07 13:29:39 +01:00
agenix.inputs.home-manager.follows = "home-manager";
2023-01-11 20:22:35 +00:00
home-manager.url = "github:nix-community/home-manager/release-24.05";
2023-01-11 20:22:35 +00:00
home-manager.inputs.nixpkgs.follows = "nixpkgs";
2024-04-22 20:49:43 +01:00
home-manager-unstable.url = "github:nix-community/home-manager";
home-manager-unstable.inputs.nixpkgs.follows = "nixpkgs-unstable";
2023-07-23 17:28:58 +01:00
impermanence.url = "github:nix-community/impermanence/master";
2022-10-25 19:56:22 +01:00
};
description = "Hillion Nix flake";
2024-05-25 15:53:18 +01:00
outputs = { self, nixpkgs, nixpkgs-unstable, nixos-hardware, flake-utils, agenix, home-manager, home-manager-unstable, impermanence, ... }@inputs: {
2023-01-11 20:34:07 +00:00
nixosConfigurations =
let
fqdns = builtins.attrNames (builtins.readDir ./hosts);
2023-06-11 15:15:49 +01:00
getSystemOverlays = system: nixpkgsConfig: [
(final: prev: {
"storj" = final.callPackage ./pkgs/storj.nix { };
})
];
2023-01-11 20:34:07 +00:00
mkHost = fqdn:
2024-04-22 20:49:43 +01:00
let
system = builtins.readFile ./hosts/${fqdn}/system;
func = if builtins.pathExists ./hosts/${fqdn}/unstable then nixpkgs-unstable.lib.nixosSystem else nixpkgs.lib.nixosSystem;
home-manager-pick = if builtins.pathExists ./hosts/${fqdn}/unstable then home-manager-unstable else home-manager;
2023-03-17 21:35:13 +00:00
in
2024-04-22 20:49:43 +01:00
func {
2023-01-11 20:34:07 +00:00
inherit system;
specialArgs = inputs;
modules = [
./hosts/${fqdn}/default.nix
2023-04-07 21:37:23 +01:00
./modules/default.nix
2023-07-23 17:28:58 +01:00
2023-02-11 17:59:48 +00:00
agenix.nixosModules.default
2023-07-23 17:28:58 +01:00
impermanence.nixosModules.impermanence
2024-04-22 20:49:43 +01:00
home-manager-pick.nixosModules.default
2023-07-23 17:28:58 +01:00
{
home-manager.sharedModules = [
impermanence.nixosModules.home-manager.impermanence
];
}
2023-06-11 15:15:49 +01:00
({ config, ... }: {
2023-01-11 20:34:07 +00:00
system.configurationRevision = nixpkgs.lib.mkIf (self ? rev) self.rev;
2023-06-11 15:15:49 +01:00
nixpkgs.overlays = getSystemOverlays config.nixpkgs.hostPlatform.system config.nixpkgs.config;
})
2023-01-11 20:34:07 +00:00
];
};
in
nixpkgs.lib.genAttrs fqdns mkHost;
2023-09-09 22:24:27 +01:00
} // flake-utils.lib.eachDefaultSystem (system: {
formatter = nixpkgs.legacyPackages.${system}.nixpkgs-fmt;
});
2022-10-25 19:56:22 +01:00
}