nixos/flake.nix

95 lines
3.3 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";
2024-09-05 00:30:25 +01:00
darwin.url = "github:lnl7/nix-darwin";
darwin.inputs.nixpkgs.follows = "nixpkgs";
2022-11-20 20:29:49 +00:00
agenix.url = "github:ryantm/agenix";
agenix.inputs.nixpkgs.follows = "nixpkgs";
2024-09-05 00:30:25 +01:00
agenix.inputs.darwin.follows = "darwin";
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-09-05 00:30:25 +01:00
outputs = { self, nixpkgs, nixpkgs-unstable, nixos-hardware, flake-utils, agenix, home-manager, home-manager-unstable, darwin, impermanence, ... }@inputs:
let
getSystemOverlays = system: nixpkgsConfig: [
(final: prev: {
unstable = nixpkgs-unstable.legacyPackages.${prev.system};
2024-10-11 16:09:52 +01:00
2024-10-12 00:54:02 +01:00
"scx_lavd" = final.callPackage ./pkgs/scx/lavd.nix { };
2024-10-11 16:09:52 +01:00
"scx_layered" = final.callPackage ./pkgs/scx/layered.nix { };
2024-09-05 00:30:25 +01:00
"storj" = final.callPackage ./pkgs/storj.nix { };
})
];
in
{
nixosConfigurations =
let
fqdns = builtins.attrNames (builtins.readDir ./hosts);
mkHost = fqdn:
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;
in
func {
inherit system;
specialArgs = inputs;
modules = [
./hosts/${fqdn}/default.nix
./modules/default.nix
agenix.nixosModules.default
impermanence.nixosModules.impermanence
home-manager-pick.nixosModules.default
{
home-manager.sharedModules = [
impermanence.nixosModules.home-manager.impermanence
];
}
({ config, ... }: {
system.configurationRevision = nixpkgs.lib.mkIf (self ? rev) self.rev;
nixpkgs.overlays = getSystemOverlays config.nixpkgs.hostPlatform.system config.nixpkgs.config;
})
];
};
in
nixpkgs.lib.genAttrs fqdns mkHost;
darwinConfigurations = {
jakehillion-mba-m2-15 = darwin.lib.darwinSystem {
system = "aarch64-darwin";
specialArgs = inputs;
2023-07-23 17:28:58 +01:00
2024-09-05 00:30:25 +01:00
modules = [
./darwin/jakehillion-mba-m2-15/configuration.nix
2023-07-23 17:28:58 +01:00
2024-09-05 00:30:25 +01:00
({ config, ... }: {
nixpkgs.overlays = getSystemOverlays "aarch64-darwin" config.nixpkgs.config;
})
];
};
};
2023-07-23 17:28:58 +01:00
2024-09-05 00:30:25 +01:00
} // flake-utils.lib.eachDefaultSystem (system: {
formatter = nixpkgs.legacyPackages.${system}.nixpkgs-fmt;
});
2022-10-25 19:56:22 +01:00
}