-
Notifications
You must be signed in to change notification settings - Fork 2
/
flake.nix
65 lines (56 loc) · 1.73 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
teraflops.url = "github:aanderse/teraflops";
teraflops.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = { nixpkgs, teraflops, ... }:
let
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
# NOTE: this is a workaround while opentofu support is being improved in nixpkgs... see https://github.com/NixOS/nixpkgs/issues/283015 for details
tofuProvider = provider:
provider.override (oldArgs: {
provider-source-address =
pkgs.lib.replaceStrings
[ "https://registry.terraform.io/providers" ]
[ "registry.opentofu.org" ]
oldArgs.homepage;
});
in
{
devShells.${system}.default = with pkgs;
mkShell {
pname = "teraflops-digitalocean";
packages = [
colmena
jq
(opentofu.withPlugins (p: map tofuProvider [ p.digitalocean p.ssh p.tls ]))
teraflops.packages.${system}.default
];
};
} // {
teraflops = {
imports = [ teraflops.modules.digitalocean ];
meta = {
nixpkgs = nixpkgs.legacyPackages.${system};
};
defaults = { ... }: {
deployment.targetEnv = "digitalocean";
deployment.digitalocean = {
region = "fra1";
size = "s-1vcpu-1gb";
};
system.stateVersion = "24.05";
};
machine = { pkgs, ... }: {
fileSystems."/storage" = {
fsType = "ext4";
label = "storage";
digitalocean.size = 10;
};
environment.systemPackages = [ pkgs.hello ];
};
};
};
}