!UKDpaKNNsBpOPfLWfX:zhaofeng.li

Colmena

295 Members
A simple, stateless NixOS deployment tool - https://github.com/zhaofengli/colmena101 Servers

Load older messages


SenderMessageTime
9 Feb 2024
@treed:zenithia.nettreedUnsure. It comes for free though01:21:23
@treed:zenithia.nettreedhttps://nixos.org/manual/nixos/unstable/options01:21:49
@treed:zenithia.nettreedmentioned there, only defined for nixos01:21:58
@treed:zenithia.nettreedProbably not that different from what yours does in the end though01:22:38
@pgibson:matrix.orgpgibson I get error: undefined variable 'modulesPath', but maybe I'm putting it in the wrong spot 01:23:11
@treed:zenithia.nettreed It needs to be defined as an input to the file being imported, like where the file starts with { pkgs, config, ... }: 01:23:46
@pgibson:matrix.orgpgibson
      my-host = { name, nodes, pkgs, ... }: {

        imports = [
          #(nixpkgs + "/nixos/modules/virtualisation/digital-ocean-config.nix")
          (modulesPath + "/nixos/modules/virtualisation/digital-ocean-config.nix")
        ];
01:23:56
@pgibson:matrix.orgpgibsonAhh right01:24:08
@treed:zenithia.nettreedah, put it between pkgs and ...01:24:11
@treed:zenithia.nettreedIt's one of the module arguments01:25:11
@treed:zenithia.nettreed oh, and you'd want to remove /nixos/modules. I think that's included 01:25:55
@pgibson:matrix.orgpgibsonYes that's working thanks - looks a bit cleaner01:27:09
@pgibson:matrix.orgpgibsonNext question - I have a separate flake that builds a docker image that I can run that locally with podman. How do I go about deploying that as a systemd service on my droplet? 01:45:03
@treed:zenithia.nettreedDoes the flake define a service module, or something else?01:45:24
@treed:zenithia.nettreedOh, probably not.01:45:42
@pgibson:matrix.orgpgibsonNo at the moment it just builds the image01:45:50
@treed:zenithia.nettreedAssuming that the image you want is a flake output, you'd need to add it as an input to your flake, and then you can make use of its outputs however you need, presumably by putting the image in some service config. I don't have any experience with defining podman containers declaratively, so I'm not sure what the best way to handle that part would be.01:47:00
@pgibson:matrix.orgpgibson

The docker image flake is something like:

{
  description = "Some Docker image";

  outputs = { self, nixpkgs }: {
    dockerImageFor = { name, system }:

    ...

    dockerImages = {
      site1 = self.dockerImageFor (import ./site1.nix);
      site2 = self.dockerImageFor (import ./site2.nix);
    };
  };
}
01:55:25
@pgibson:matrix.orgpgibson It produces a result symlink to the actual image, which you can podman load -i result 01:56:15
@treed:zenithia.nettreed If you include that flake as in input (and then include it in the arguments to outputs, then you should be able to reference as like someDockerImage.dockerImages.site1 01:56:37
@treed:zenithia.nettreedAlthough I'm not sure how to get that into podman declaratively01:57:27
@pgibson:matrix.orgpgibsonOkay thanks I'll give it a go - appreciate your help01:57:49
@treed:zenithia.nettreedLooks like you might be able to use a bit like in https://nixos.wiki/wiki/Podman01:58:08
@treed:zenithia.nettreed but instead of image = whatever, you'd want imageFile = dockerImages.site1 01:58:36
@treed:zenithia.nettreed I think that might do it 01:58:48
@pgibson:matrix.orgpgibsonI think I recall seeing other people pushing the images to the Docker registry so they could then use the registry url in the Podman service, but hoping to avoid that if possible01:58:52
@treed:zenithia.nettreed Depending on exactly how podman load works I guess 01:59:14
@treed:zenithia.nettreedBut it's certainly where I'd start01:59:28
@pgibson:matrix.orgpgibson Yeah that's working, thanks again treed . You still need to specify image = "the-actual-image-name" as well as imageFile = someDockerImage.dockerImages.site1 02:54:54
@treed:zenithia.nettreedOh, interesting.02:55:14

Show newer messages


Back to Room ListRoom Version: 6