2026-09-03 23:21:05 -05:00
|
|
|
{
|
|
|
|
|
description = "Flake to run services on a VM powered by incus";
|
|
|
|
|
|
|
|
|
|
inputs = {
|
|
|
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-26.05";
|
2026-09-26 00:47:00 -05:00
|
|
|
postgresql-db = {
|
|
|
|
|
url = "path:../../homelab-services/postgresql-db";
|
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
|
};
|
2026-09-03 23:21:05 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
outputs =
|
|
|
|
|
{
|
2026-09-15 22:35:50 -05:00
|
|
|
self,
|
|
|
|
|
nixpkgs,
|
2026-09-15 22:46:31 -05:00
|
|
|
postgresql-db,
|
2026-09-15 22:35:50 -05:00
|
|
|
}@inputs:
|
2026-09-26 01:32:45 -05:00
|
|
|
let
|
2026-09-26 01:34:53 -05:00
|
|
|
credentials = builtins.listToAttrs (
|
2026-09-26 01:32:45 -05:00
|
|
|
map (filename: {
|
|
|
|
|
name = builtins.replaceStrings [ ".env" ] [ "-env" ] filename;
|
|
|
|
|
value = nixpkgs.runCommand "sops-decrypt-${filename}" { } ''
|
|
|
|
|
${nixpkgs.sops}/bin/sops -d ${./secrets}/${filename} > $out
|
|
|
|
|
'';
|
|
|
|
|
}) (builtins.attrNames (builtins.readDir ./secrets))
|
|
|
|
|
);
|
|
|
|
|
in
|
2026-09-15 22:35:50 -05:00
|
|
|
{
|
|
|
|
|
nixosConfigurations = {
|
2026-09-17 21:58:31 -05:00
|
|
|
vm = nixpkgs.lib.nixosSystem {
|
2026-09-15 22:35:50 -05:00
|
|
|
system = "x86_64-linux";
|
2026-09-26 01:32:45 -05:00
|
|
|
specialArgs = {
|
2026-09-26 01:34:53 -05:00
|
|
|
inherit credentials;
|
2026-09-26 01:32:45 -05:00
|
|
|
};
|
2026-09-15 22:35:50 -05:00
|
|
|
modules = [
|
|
|
|
|
./virtual.nix
|
2026-09-15 22:46:31 -05:00
|
|
|
postgresql-db.nixosModules.postgresql-db
|
|
|
|
|
|
|
|
|
|
# declare the vm output
|
|
|
|
|
"${inputs.nixpkgs}/nixos/modules/virtualisation/incus-virtual-machine.nix"
|
2026-09-15 22:35:50 -05:00
|
|
|
];
|
|
|
|
|
};
|
|
|
|
|
};
|
2026-09-03 23:21:05 -05:00
|
|
|
};
|
|
|
|
|
}
|