aboutsummaryrefslogtreecommitdiff
path: root/cluster/staging
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2022-11-16 16:28:18 +0100
committerAlex Auvolat <alex@adnab.me>2022-11-16 16:28:18 +0100
commit49b0dc2d5bfe9b92e6e02e6f0fa1076c4204f8b8 (patch)
treedcbf0f2b2c214f135a24dc9adc24d3a9856bdaf4 /cluster/staging
parenteac950c47f3bcedbd02b5bd71a8f42084c643854 (diff)
downloadnixcfg-49b0dc2d5bfe9b92e6e02e6f0fa1076c4204f8b8.tar.gz
nixcfg-49b0dc2d5bfe9b92e6e02e6f0fa1076c4204f8b8.zip
poc 2 for nix containers: use nomad-driver-nix
Diffstat (limited to 'cluster/staging')
-rw-r--r--cluster/staging/app/dummy/deploy/dummy-nginx.hcl39
-rw-r--r--cluster/staging/node/cariacou.nix18
2 files changed, 12 insertions, 45 deletions
diff --git a/cluster/staging/app/dummy/deploy/dummy-nginx.hcl b/cluster/staging/app/dummy/deploy/dummy-nginx.hcl
index 5f3d5f6..8e2dd43 100644
--- a/cluster/staging/app/dummy/deploy/dummy-nginx.hcl
+++ b/cluster/staging/app/dummy/deploy/dummy-nginx.hcl
@@ -5,17 +5,6 @@ job "dummy-nginx" {
group "nginx" {
count = 1
- volume "nix-store" {
- type = "host"
- source = "nix-store"
- read_only = true
- }
- volume "nix-current-system-bin" {
- type = "host"
- source = "nix-current-system-bin"
- read_only = true
- }
-
network {
port "http" {
to = 8080
@@ -23,32 +12,12 @@ job "dummy-nginx" {
}
task "not-actually-nginx" {
- driver = "exec"
+ driver = "nix"
config {
- command = "env"
- args = [
- "/run/current-system/sw/bin/nix-shell",
- "--run", "python3 -m http.server 8080"
+ packages = [
+ "github:nixos/nixpkgs/nixos-21.05#python3",
]
- }
- env = {
- NIX_PATH = "nixpkgs=/nix/var/nix/profiles/per-user/root/channels/nixos"
- }
-
- volume_mount {
- volume = "nix-store"
- read_only = true
- destination = "/nix"
- }
- volume_mount {
- volume = "nix-current-system-bin"
- read_only = true
- destination = "/run/current-system/sw/bin"
- }
-
- template {
- data = file("shell.nix")
- destination = "shell.nix"
+ command = [ "/bin/python3", "-m", "http.server", "8080" ]
}
}
diff --git a/cluster/staging/node/cariacou.nix b/cluster/staging/node/cariacou.nix
index 5662422..04e581d 100644
--- a/cluster/staging/node/cariacou.nix
+++ b/cluster/staging/node/cariacou.nix
@@ -24,14 +24,12 @@
# experimental: nomad as root, to enable exec driver
services.nomad.dropPrivileges = false;
- services.nomad.settings.client.host_volume = {
- "nix-store" = {
- path = "/nix";
- read_only = true;
- };
- "nix-current-system-bin" = {
- path = "/run/current-system/sw/bin";
- read_only = true;
- };
- };
+ services.nomad.extraPackages = [
+ pkgs.nix
+ ];
+ services.nomad.extraSettingsPlugins =
+ let nomad_driver_nix = import ./nomad-driver-nix.nix { inherit pkgs; };
+ in [ nomad_driver_nix ];
+ # the nix driver requires flakes to be enabled
+ nix.settings.experimental-features = [ "nix-command" "flakes" ];
}