nix-configs/flake.nix
2024-08-20 12:35:35 -04:00

137 lines
4.7 KiB
Nix

{
description = "Chris's system configuration";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05";
nixunstable.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
deploy-rs = {
url = "github:serokell/deploy-rs";
inputs.utils.follows = "flake-utils";
inputs.nixpkgs.follows = "nixpkgs";
};
home-manager = {
url = "github:nix-community/home-manager/release-24.05";
inputs.nixpkgs.follows = "nixpkgs";
};
sops-nix = {
url = "github:Mic92/sops-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
impermanence.url = "github:nix-community/impermanence/23c1f06316b67cb5dabdfe2973da3785cfe9c34a";
stylix = {
url = "github:danth/stylix/release-24.05";
inputs = {
nixpkgs.follows = "nixpkgs";
home-manager.follows = "home-manager";
};
};
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
};
outputs = inputs@{ self, nixpkgs, flake-utils, home-manager, deploy-rs
, impermanence, stylix, nixos-hardware, nixunstable, ... }:
let
pkgs = import nixpkgs { system = "x86_64-linux"; };
aarch64Pkgs = import nixpkgs { system = "aarch64-linux"; };
pkgs-unstable = import nixunstable { system = "x86_64-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; inherit pkgs-unstable; };
modules = [
stylix.nixosModules.stylix
impermanence.nixosModules.impermanence
./systems/smolboi/configuration.nix
nixos-hardware.nixosModules.common-cpu-amd
nixos-hardware.nixosModules.common-cpu-amd-pstate
nixos-hardware.nixosModules.common-cpu-amd-zenpower
nixos-hardware.nixosModules.common-gpu-amd
nixos-hardware.nixosModules.common-pc
nixos-hardware.nixosModules.common-pc-ssd
nixos-hardware.nixosModules.gigabyte-b550
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; inherit pkgs-unstable; };
modules = [
impermanence.nixosModules.impermanence
./systems/zeus/configuration.nix
nixos-hardware.nixosModules.supermicro
nixos-hardware.nixosModules.common-cpu-amd
nixos-hardware.nixosModules.common-cpu-amd-pstate
nixos-hardware.nixosModules.common-cpu-amd-zenpower
nixos-hardware.nixosModules.common-pc
];
};
orangepihole = nixpkgs.lib.nixosSystem {
system = "aarch64-linux";
specialArgs = { inherit inputs; inherit pkgs-unstable; };
modules = [
impermanence.nixosModules.impermanence
./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 pkgs.sops ]; };
checks = deployLib.deployChecks self.deploy;
formatter = pkgs.nixfmt;
});
}