nix-configs/flake.nix
2024-04-27 22:36:58 -04:00

91 lines
2.8 KiB
Nix

{
description = "Chris's system configuration";
inputs = {
nixpkgs.url = "nixpkgs/nixos-23.11";
flake-utils.url = github:numtide/flake-utils;
deploy-rs.url = github:serokell/deploy-rs;
home-manager = {
url = github:nix-community/home-manager/release-23.11;
inputs.nixpkgs.follows = "nixpkgs";
};
sops-nix = {
url = "github:Mic92/sops-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = inputs@{ self, nixpkgs, flake-utils, home-manager, deploy-rs, sops-nix, ... }:
let
pkgs = import nixpkgs { system = "x86_64-linux"; };
aarch64Pkgs = import nixpkgs { system = "aarch64-linux"; };
deployAarch64Pkgs = import nixpkgs {
system = "aarch64-linux";
overlays = [
deploy-rs.overlay
(self: super: { deploy-rs = { inherit (aarch64Pkgs) deploy-rs; lib = super.deploy-rs.lib; }; })
];
};
deployPkgs = import nixpkgs {
system = "x86_64-linux";
overlays = [
deploy-rs.overlay
(self: super: { deploy-rs = { inherit (pkgs) deploy-rs; lib = super.deploy-rs.lib; }; })
];
};
in
{
nixosConfigurations = {
smolboi = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = { inherit inputs; };
modules = [
./systems/smolboi/configuration.nix
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.users.cdombroski = import ./systems/smolboi/home.nix;
}
];
};
zeus = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = { inherit inputs; };
modules = [ ./systems/zeus/configuration.nix ];
};
orangepihole = nixpkgs.lib.nixosSystem {
system = "aarch64-linux";
specialArgs = { inherit inputs; };
modules = [ ./systems/orangepihole/configuration.nix ];
};
};
deploy = {
sshUser = "root";
fastConnection = true;
nodes = {
smolboi = {
hostname = "smolboi";
profiles.system.path = deployPkgs.deploy-rs.lib.activate.nixos self.nixosConfigurations.smolboi;
};
zeus = {
hostname = "zeus";
profiles.system.path = deployPkgs.deploy-rs.lib.activate.nixos self.nixosConfigurations.zeus;
};
orangepihole = {
hostname = "orangepihole";
profiles.system.path = deployAarch64Pkgs.deploy-rs.lib.activate.nixos self.nixosConfigurations.orangepihole;
};
};
};
} //
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
deployLib = deploy-rs.lib.${system};
in
{
devShells.default = pkgs.mkShell {
buildInputs = [ pkgs.deploy-rs ];
};
checks = deployLib.deployChecks self.deploy;
}
);
}