NixOS/flake.nix

79 lines
2.0 KiB
Nix

{
description = "Price Hiller's flake for managing system configurations";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
impermanence = {
url = "github:nix-community/impermanence";
};
agenix = {
url = "github:ryantm/agenix";
inputs.nixpkgs.follows = "nixpkgs";
};
personal-blog = {
url = "gitlab:blog/blog?host=gitlab.orion-technologies.io";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = inputs @ { self, nixpkgs, impermanence, agenix, ... }:
let
specialArgs = {
secrets = ./secrets;
persist-dir = "/nix/persist";
};
defaults = {
config = {
environment.persistence = {
"${specialArgs.persist-dir}" = {
hideMounts = true;
directories = [
"/var/lib"
"/var/log"
"/etc/nixos"
"/opt"
"/persist"
];
files = [
"/etc/machine-id"
"/etc/ssh/ssh_host_ed25519_key"
"/etc/ssh/ssh_host_ed25519_key.pub"
"/etc/ssh/ssh_host_rsa_key"
"/etc/ssh/ssh_host_rsa_key.pub"
];
};
};
age.identityPaths = [
"/persist/nix.key"
];
};
};
in
{
nixosConfigurations.orion = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = specialArgs;
modules = [
{ _module.args = inputs; }
defaults
./hosts/orion
impermanence.nixosModules.impermanence
agenix.nixosModules.default
];
};
nixosConfigurations.luna = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = specialArgs;
modules = [
{ _module.args = inputs; }
defaults
./hosts/luna
impermanence.nixosModules.impermanence
agenix.nixosModules.default
];
};
};
}