config/flake.nix

186 lines
6.0 KiB
Nix
Raw Normal View History

2023-03-29 17:50:55 +03:00
{
2023-03-30 16:33:03 +03:00
description = "motiejus/config";
2023-03-29 17:50:55 +03:00
inputs = {
2023-08-23 11:30:15 +03:00
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.05-small";
2023-04-05 14:46:57 +03:00
flake-utils.url = "github:numtide/flake-utils";
2023-08-18 13:47:27 +03:00
home-manager.url = "github:nix-community/home-manager/release-23.05";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
2023-05-30 10:03:21 +03:00
2023-04-14 14:12:45 +03:00
agenix.url = "github:ryantm/agenix";
agenix.inputs.nixpkgs.follows = "nixpkgs";
2023-08-18 13:47:27 +03:00
agenix.inputs.home-manager.follows = "home-manager";
2023-04-14 14:12:45 +03:00
agenix.inputs.darwin.follows = "";
2023-03-30 16:33:03 +03:00
2023-04-03 16:50:52 +03:00
deploy-rs.url = "github:serokell/deploy-rs";
deploy-rs.inputs.nixpkgs.follows = "nixpkgs";
deploy-rs.inputs.utils.follows = "flake-utils";
2023-04-05 14:46:57 +03:00
};
2023-04-05 09:15:02 +03:00
2023-04-05 14:46:57 +03:00
nixConfig = {
trusted-substituters = "https://cache.nixos.org/";
trusted-public-keys = "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=";
2023-03-29 17:50:55 +03:00
};
2023-04-03 16:50:52 +03:00
outputs = {
self,
nixpkgs,
2023-04-14 14:12:45 +03:00
agenix,
2023-04-03 16:50:52 +03:00
deploy-rs,
flake-utils,
2023-08-18 13:47:27 +03:00
home-manager,
2023-04-05 23:19:56 +03:00
} @ inputs: let
2023-04-05 09:15:02 +03:00
myData = import ./data.nix;
in
2023-04-03 16:50:52 +03:00
{
2023-07-22 16:05:44 +03:00
#nixosConfigurations.vm = nixpkgs.lib.nixosSystem {
# system = "x86_64-linux";
# modules = [
# ./hosts/vm/configuration.nix
# ./modules
# ];
2023-07-17 16:35:45 +03:00
2023-07-22 16:05:44 +03:00
# specialArgs = {inherit myData;} // inputs;
#};
2023-07-17 16:35:45 +03:00
2023-04-03 16:50:52 +03:00
nixosConfigurations.hel1-a = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
2023-04-14 14:12:45 +03:00
./hosts/hel1-a/configuration.nix
./hosts/hel1-a/hardware-configuration.nix
./hosts/hel1-a/zfs.nix
./modules
agenix.nixosModules.default
home-manager.nixosModules.home-manager
2023-04-14 14:12:45 +03:00
{
2023-07-23 15:02:58 +03:00
age.secrets.motiejus-passwd-hash.file = ./secrets/motiejus_passwd_hash.age;
age.secrets.root-passwd-hash.file = ./secrets/root_passwd_hash.age;
2023-07-23 15:43:55 +03:00
age.secrets.zfs-passphrase-vno1-oh2.file = ./secrets/vno1-oh2/zfs-passphrase.age;
2023-07-23 15:02:58 +03:00
2023-08-14 12:58:19 +03:00
age.secrets.headscale-client-oidc.file = ./secrets/hel1-a/headscale/oidc_client_secret2.age;
2023-04-14 14:12:45 +03:00
age.secrets.borgbackup-password.file = ./secrets/hel1-a/borgbackup/password.age;
2023-07-26 13:26:11 +03:00
age.secrets.sasl-passwd.file = ./secrets/postfix_sasl_passwd.age;
2023-08-25 15:55:06 +03:00
age.secrets.synapse-jakstys-signing-key.file = ./secrets/synapse/jakstys_lt_signing_key.age;
age.secrets.synapse-registration-shared-secret.file = ./secrets/synapse/registration_shared_secret.age;
age.secrets.synapse-macaroon-secret-key.file = ./secrets/synapse/macaroon_secret_key.age;
2023-04-14 14:12:45 +03:00
}
2023-04-03 16:50:52 +03:00
];
2023-04-05 23:19:56 +03:00
2023-04-14 14:12:45 +03:00
specialArgs = {inherit myData;} // inputs;
2023-04-03 16:50:52 +03:00
};
2023-03-30 16:33:03 +03:00
2023-07-22 16:05:44 +03:00
nixosConfigurations.vno1-oh2 = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
./hosts/vno1-oh2/configuration.nix
./modules
agenix.nixosModules.default
home-manager.nixosModules.home-manager
2023-07-22 16:05:44 +03:00
{
age.secrets.motiejus-passwd-hash.file = ./secrets/motiejus_passwd_hash.age;
age.secrets.root-passwd-hash.file = ./secrets/root_passwd_hash.age;
2023-07-23 15:43:55 +03:00
age.secrets.zfs-passphrase-hel1-a.file = ./secrets/hel1-a/zfs-passphrase.age;
2023-07-26 14:23:12 +03:00
age.secrets.sasl-passwd.file = ./secrets/postfix_sasl_passwd.age;
age.secrets.borgbackup-password.file = ./secrets/vno1-oh2/borgbackup/password.age;
age.secrets.grafana-oidc.file = ./secrets/grafana.jakstys.lt/oidc.age;
age.secrets.letsencrypt-account-key.file = ./secrets/letsencrypt/account.key.age;
2023-08-25 15:55:06 +03:00
age.secrets.synapse-jakstys-signing-key.file = ./secrets/synapse/jakstys_lt_signing_key.age;
age.secrets.synapse-registration-shared-secret.file = ./secrets/synapse/registration_shared_secret.age;
age.secrets.synapse-macaroon-secret-key.file = ./secrets/synapse/macaroon_secret_key.age;
2023-07-22 16:05:44 +03:00
}
];
specialArgs = {inherit myData;} // inputs;
};
2023-08-15 07:09:11 +03:00
nixosConfigurations.vno1-rp3b = nixpkgs.lib.nixosSystem {
modules = [
./hosts/vno1-rp3b/configuration.nix
./modules
agenix.nixosModules.default
home-manager.nixosModules.home-manager
2023-08-15 07:09:11 +03:00
{
age.secrets.motiejus-passwd-hash.file = ./secrets/motiejus_passwd_hash.age;
age.secrets.root-passwd-hash.file = ./secrets/root_passwd_hash.age;
age.secrets.sasl-passwd.file = ./secrets/postfix_sasl_passwd.age;
}
];
specialArgs = {inherit myData;} // inputs;
};
2023-04-03 17:17:40 +03:00
deploy.nodes.hel1-a = {
2023-07-28 15:37:19 +03:00
hostname = myData.hosts."hel1-a.servers.jakst".jakstIP;
2023-04-03 16:50:52 +03:00
profiles = {
system = {
sshUser = "motiejus";
path =
deploy-rs.lib.x86_64-linux.activate.nixos self.nixosConfigurations.hel1-a;
user = "root";
};
2023-03-30 16:33:03 +03:00
};
2023-03-29 17:50:55 +03:00
};
2023-03-30 16:33:03 +03:00
2023-07-22 16:05:44 +03:00
deploy.nodes.vno1-oh2 = {
2023-07-28 15:37:19 +03:00
hostname = myData.hosts."vno1-oh2.servers.jakst".jakstIP;
2023-07-22 16:05:44 +03:00
profiles = {
system = {
2023-07-22 20:27:49 +03:00
sshUser = "motiejus";
2023-07-22 16:05:44 +03:00
path =
deploy-rs.lib.x86_64-linux.activate.nixos self.nixosConfigurations.vno1-oh2;
user = "root";
};
};
};
2023-08-16 15:58:35 +03:00
deploy.nodes.vno1-rp3b = {
2023-08-16 16:48:01 +03:00
hostname = myData.hosts."vno1-rp3b.servers.jakst".jakstIP;
2023-08-16 15:58:35 +03:00
profiles = {
system = {
2023-08-16 16:16:49 +03:00
sshUser = "motiejus";
2023-08-16 15:58:35 +03:00
path =
deploy-rs.lib.aarch64-linux.activate.nixos self.nixosConfigurations.vno1-rp3b;
user = "root";
};
};
};
2023-08-15 07:09:11 +03:00
2023-04-03 16:50:52 +03:00
checks = builtins.mapAttrs (system: deployLib: deployLib.deployChecks self.deploy) deploy-rs.lib;
}
// flake-utils.lib.eachDefaultSystem (system: let
pkgs = import nixpkgs {inherit system;};
in {
2023-07-28 15:37:19 +03:00
apps.deploy-rs = {
type = "app";
program = "${deploy-rs.packages."${system}".default}/bin/deploy";
};
2023-04-03 16:50:52 +03:00
devShells.default = with pkgs;
mkShell {
2023-04-05 14:46:57 +03:00
packages = [
2023-04-14 14:12:45 +03:00
pkgs.rage
2023-04-05 22:48:04 +03:00
pkgs.ssh-to-age
2023-04-14 14:12:45 +03:00
pkgs.age-plugin-yubikey
#pkgs.borgbackup
2023-04-14 14:12:45 +03:00
agenix.packages.${system}.agenix
2023-04-05 22:48:04 +03:00
deploy-rs.packages.${system}.deploy-rs
2023-04-05 14:46:57 +03:00
];
2023-04-03 16:50:52 +03:00
};
formatter = pkgs.alejandra;
2023-04-03 16:43:34 +03:00
});
2023-03-29 17:50:55 +03:00
}