nixfiles/hosts/nixos.nix

107 lines
2.6 KiB
Nix

{
self,
nixpkgs-unstable,
...
} @ inputs: let
inherit (nixpkgs-unstable.lib) forEach;
mkTree = inputs.tree-input.tree;
metaTree = mkTree ((import ../treeConfig.nix {}) // {inherit inputs;});
tree = metaTree.impure;
patchedInputs =
inputs
// {
# set these to the correct versions from inputs
nixpkgs = inputs.nixpkgs-unstable;
home-manager = inputs.home-manager-unstable;
};
defaultSpecialArgs = {
inherit self;
tree = metaTree.impure;
pureTree = metaTree.pure;
inputs = patchedInputs;
};
defaultModules = [
tree.profiles.base
inputs.home-manager-unstable.nixosModules.home-manager
inputs.vaultui.nixosModules.default
inputs.gitlab_artifacts_sync.nixosModules.default
inputs.piped-flake.nixosModules.default
tree.modules.nixos.rcloneServe
tree.modules.nixos.rcloneSync
tree.modules.nixos.secrets
];
nixosUnstableSystem = nixpkgs-unstable.lib.nixosSystem;
nixosX86_64LiveWithExtraDepsForMachines = machines:
nixosUnstableSystem {
specialArgs =
defaultSpecialArgs
// {
hostPath = ./nixos-live;
};
system = "x86_64-linux";
modules =
defaultModules
++ [
./nixos-live/nixos-live.nix
({...}: {
system.extraDependencies =
forEach machines (system:
self.nixosConfigurations.${system}.config.system.build.toplevel);
})
];
};
in {
lappy-t495 = nixosUnstableSystem {
specialArgs =
defaultSpecialArgs
// {
hostPath = ./lappy-t495;
};
system = "x86_64-linux";
modules = defaultModules ++ [./lappy-t495/lappy-t495.nix ./lappy-t495/hardware.nix];
};
hetzner-arm = nixosUnstableSystem {
specialArgs =
defaultSpecialArgs
// {
hostPath = ./hetzner-arm;
};
system = "aarch64-linux";
modules = defaultModules ++ [./hetzner-arm/hetzner-arm.nix];
};
vault = nixosUnstableSystem {
specialArgs =
defaultSpecialArgs
// {
hostPath = ./vault;
};
system = "aarch64-linux";
modules = defaultModules ++ [./vault/vault.nix];
};
# nix build .#nixosConfigurations.nixos-live-x86_64.config.system.build.isoImage
nixos-live-x86_64 = nixosX86_64LiveWithExtraDepsForMachines ["lappy-t495"];
# nix --no-sandbox build .#nixosConfigurations.raspberry.config.system.build.sdImage
raspberry = nixosUnstableSystem {
specialArgs =
defaultSpecialArgs
// {
hostPath = ./vault;
};
system = "aarch64-linux";
modules = defaultModules ++ [./raspberry/raspberry.nix];
};
}