Any examples for a monorepo to develop app and deploy it to servers?

I followed these steps to get very basic golang service up and running in my monorepo. The only problem I got was the exact one mentioned above:

Another option would be to add your app as an input to the server’s flake but then you have to update the lock file whenever you change the app.

I ended up proceeding with multiple flakes anyway in one monorepo and using the –override-input flag which completely overrides the lock file.

Here’s how the project layout looks like:

$ tree .
.
├── flake.lock
├── flake.nix
├── nixos
│   └── servers
│       ├── modules
│       │   ├── disko-zfs.nix
│       │   ├── postgresql.nix
│       │   └── programs.nix
│       └── my-server.nix
└── services
    └── basic-go-web-app
        ├── flake.nix
        ├── go.mod
        └── main.go

I can then use the services/basic-go-web-app/flake.nix in the main flake.nix as input:

{
  description = "My nixos machine setup";
  inputs = {
    srvos.url = "github:nix-community/srvos";
    nixpkgs.follows = "srvos/nixpkgs";

    disko.url = "github:nix-community/disko";
    disko.inputs.nixpkgs.follows = "nixpkgs";

    basic-go-web-app.url = "path:services/basic-go-web-app/";
  }
  ...
}

My server is named my-server and I can deploy it with nixes-rebuild like this:

$ nix run nixpkgs#nixos-rebuild -- switch --fast --flake .#my-server --target-host my-server --build-host my-server --use-remote-sudo --override-input basic-go-web-app ./services/basic-go-web-app/

So one just needs to include the --override-input basic-go-web-app ./services/basic-go-web-app/ for the relative inputs which you don’t want to be locked.

This definitely feels very hacky and I wish I could just have an option in the flakes to ignore locks for certain relative input all the time.