nixos/flake.nix

62 lines
2.0 KiB
Nix
Raw Normal View History

2022-10-25 19:56:22 +01:00
{
inputs = {
2024-02-04 10:29:07 +00:00
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.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
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
2024-02-04 10:29:07 +00:00
home-manager.url = "github:nix-community/home-manager/release-23.11";
2023-01-11 20:22:35 +00:00
home-manager.inputs.nixpkgs.follows = "nixpkgs";
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";
outputs = { self, nixpkgs, nixpkgs-unstable, flake-utils, agenix, home-manager, 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:
2023-03-17 21:35:13 +00:00
let system = builtins.readFile ./hosts/${fqdn}/system;
in
2023-01-11 20:34:07 +00:00
nixpkgs.lib.nixosSystem {
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
2023-03-17 21:35:13 +00:00
home-manager.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-06-11 19:08:23 +01:00
nix.registry.nixpkgs.flake = nixpkgs; # pin `nix shell` nixpkgs
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
}