From b2ae8a2df672d7cdf3f121c124d6a4b26d02df0a Mon Sep 17 00:00:00 2001 From: Ari Sosnovsky Date: Sat, 27 Jul 2024 12:47:04 -0400 Subject: [PATCH 1/3] Added volume to db --- hosts/hl-minipc1.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hosts/hl-minipc1.nix b/hosts/hl-minipc1.nix index 4056274..1a7b094 100644 --- a/hosts/hl-minipc1.nix +++ b/hosts/hl-minipc1.nix @@ -59,6 +59,9 @@ environmentFiles = [ "/mnt/Data/myevents/db.env" ]; + volumes = [ + "/mnt/Data/myevents/db:/var/lib/postgresql/data" + ]; }; }; }; From c33c4de55529e3e896cdfa2e705208d5393d2b96 Mon Sep 17 00:00:00 2001 From: Ari Sosnovsky Date: Wed, 31 Jul 2024 11:30:46 -0400 Subject: [PATCH 2/3] Updated cache builds --- flake.nix | 12 ++++++++---- hosts/hl-minipc1.nix | 5 +++++ modules/main.nix | 2 +- modules/nix/default.nix | 8 ++++---- 4 files changed, 18 insertions(+), 9 deletions(-) diff --git a/flake.nix b/flake.nix index c60cf40..cc23a8a 100644 --- a/flake.nix +++ b/flake.nix @@ -43,10 +43,14 @@ }; homeManagerVersion = "24.05"; # Local Services - localNixCaches = [ - "http://minipc1.lab.internal:5000" - "http://fwlaptop.devices.internal:5000" - ]; + localNixCaches = { + urls = [ + "http://minipc1.lab.internal:5000" + ]; + keys = [ + "minipc1.lab.internal:eIoib1JgcBEd0YKdW95QlRA2eCKDs+WxNhWhkA1wffc=" + ]; + }; localDockerRegistries = [ "minipc1.lab.internal:5001" ]; # Libs lib = (import modules/lib.nix { diff --git a/hosts/hl-minipc1.nix b/hosts/hl-minipc1.nix index 4056274..85bd054 100644 --- a/hosts/hl-minipc1.nix +++ b/hosts/hl-minipc1.nix @@ -1,6 +1,11 @@ { user }: { pkgs, lib, config, ... }: { imports = [ ./hl-minipc1.hardware-configuration.nix ]; + # Nix Stores + services.nix-serve = { + enable = true; + secretKeyFile = "/var/keys/cache-priv-key.pem"; + }; # firmware updater services.fwupd.enable = true; # Bootloader. diff --git a/modules/main.nix b/modules/main.nix index 4336b26..40f3eee 100644 --- a/modules/main.nix +++ b/modules/main.nix @@ -17,7 +17,7 @@ enable = false; enableDevelopmentKit = false; } -, localNixCaches ? [ ] +, localNixCaches ? { keys = [ ]; urls = [ ]; } , ... }: { ... }: { diff --git a/modules/nix/default.nix b/modules/nix/default.nix index 6547eba..b07705c 100644 --- a/modules/nix/default.nix +++ b/modules/nix/default.nix @@ -1,4 +1,4 @@ -{ user, systemStateVersion, localNixCaches ? [ ] }: +{ user, systemStateVersion, localNixCaches ? { keys = [ ]; urls = [ ]; } }: { pkgs, ... }: { # Nix core @@ -10,16 +10,16 @@ "https://cache.nixos.org" "https://cache.flox.dev" "https://devenv.cachix.org" - ] ++ localNixCaches; + ] ++ localNixCaches.urls; trusted-substituters = [ "https://cache.flox.dev" "https://devenv.cachix.org" - ] ++ localNixCaches; + ] ++ localNixCaches.urls; trusted-users = [ "root" user.name ]; trusted-public-keys = [ "flox-cache-public-1:7F4OyH7ZCnFhcze3fJdfyXYLQw/aV7GEed86nQ7IsOs=" "devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw=" - ]; + ] ++ localNixCaches.keys; }; # System Packages From 6a9b8b080f2159f26b0088f149a2a67d8f5bfc36 Mon Sep 17 00:00:00 2001 From: Ari Sosnovsky Date: Wed, 31 Jul 2024 11:31:37 -0400 Subject: [PATCH 3/3] Updated local config --- hosts/hl-minipc1.nix | 36 ------------------------------------ 1 file changed, 36 deletions(-) diff --git a/hosts/hl-minipc1.nix b/hosts/hl-minipc1.nix index 1a7b094..55322f7 100644 --- a/hosts/hl-minipc1.nix +++ b/hosts/hl-minipc1.nix @@ -29,41 +29,5 @@ listenAddress = "0.0.0.0"; enableDelete = true; }; - virtualisation.oci-containers = { - backend = "docker"; - containers = { - myevents-app = { - autoStart = true; - image = "localhost:5001/asosnovsky/myevents"; - extraOptions = [ "--gpus" "all" ]; - ports = [ "8000:80" ]; - cmd = [ "app" ]; - environmentFiles = [ - "/mnt/Data/myevents/app.env" - ]; - dependsOn = [ "myevents-db" ]; - }; - myevents-cron = { - autoStart = true; - image = "localhost:5001/asosnovsky/myevents"; - cmd = [ "cron" ]; - environmentFiles = [ - "/mnt/Data/myevents/app.env" - ]; - dependsOn = [ "myevents-db" ]; - }; - myevents-db = { - autoStart = true; - image = "docker.io/postgres"; - hostname = "myevents-db"; - environmentFiles = [ - "/mnt/Data/myevents/db.env" - ]; - volumes = [ - "/mnt/Data/myevents/db:/var/lib/postgresql/data" - ]; - }; - }; - }; }