Hi, sorry if that title isn’t very clear. I just started learning about nix a couple days ago; I’ll explain what I mean.

I’m trying to set up a web application that I’m currently hosting with Docker containers, but do it with nix instead, like what’s shown in this blog post: https://carjorvaz.com/posts/the-holy-grail-nextcloud-setup-made-easy-by-nixos/

However, I don’t have NixOS on my server. I’m using Debian, with the nix package manager installed.

Is it possible to use a nix config file, like the one below, when only using the nix package manager? Currently it errors when I try to call nix-build with it, giving an error about calling a lambda function that never called self. If I remove the self argument, it complains about config, and so on.

{ self, config, lib, pkgs, ... }:

{
  services = {
    nextcloud = {
      enable = true;
      hostName = "cloud.example.com";

      package = pkgs.nextcloud27;

      # Let NixOS install and configure the database automatically.
      database.createLocally = true;

      # Let NixOS install and configure Redis caching automatically.
      configureRedis = true;

      < other settings here... >
    };
  };
}

From what I’ve read, the services part of that creates systemd services, which makes me think that it only works if you’re on a full NixOS system and not only using the nix package manager. But it’s been difficult to find a clear answer on that, probably because I’m still learning what terms to search for.

  • tuckerm@supermeter.socialOP
    link
    fedilink
    arrow-up
    2
    ·
    9 months ago

    Oh, that’s a really cool idea. I’ll check that out just for my own nix education, although I’m a little leery about doing something so custom for my first nix setup, especially if services.nextcloud has a lot in it. Thanks for the info, though! That’s really good to know about. I’ll probably end up running NixOS in a docker container. The server is an Orange Pi 5, which doesn’t have a stable NixOS image available for it, unfortunately.