Skip to content

Conversation

@delafthi
Copy link
Contributor

@delafthi delafthi commented Nov 1, 2025

  • restructure module from podman-linux to platform-agnostic podman
  • move linux-specific implementation to modules/services/podman/linux/
  • add darwin module with declarative machine management
  • implement launchd-based watchdog for auto-starting machines
  • maintains backward compatibility with existing linux functionality

Checklist

  • Change is backwards compatible.

  • Code formatted with nix fmt or
    nix-shell -p treefmt nixfmt deadnix keep-sorted --run treefmt.

  • Code tested through nix run .#tests -- test-all or
    nix-shell --pure tests -A run.all.

  • Test cases updated/added. See example.

  • Commit messages are formatted like

    {component}: {description}
    
    {long description}
    

    See CONTRIBUTING for more information and recent commit messages for examples.

  • If this PR adds a new module

    • Added myself as module maintainer. See example.
    • Generate a news entry. See News
    • Basic tests added. See Tests
  • If this PR adds an exciting new feature or contains a breaking change.

    • Generate a news entry. See News

@delafthi delafthi force-pushed the push-rplzqunssuyz branch 2 times, most recently from 5612f58 to ad8d7ec Compare November 1, 2025 21:28
@delafthi delafthi force-pushed the push-rplzqunssuyz branch 9 times, most recently from 811381d to cb6e129 Compare November 4, 2025 15:50
@delafthi delafthi marked this pull request as ready for review November 4, 2025 15:50
@delafthi delafthi requested a review from khaneliman November 4, 2025 15:50
@khaneliman khaneliman requested review from bamhm182 and n-hass November 4, 2025 16:37
@n-hass
Copy link
Contributor

n-hass commented Nov 4, 2025

I've just had a skim and will take a more thorough look later. Thanks for the contribution.

I don't believe it's conventional to namespace service settings under the platform the feature is available for, eg the services.podman.darwin.machines. Instead give the user a useful error if they configure a machine on a non-Darwin system.

Any thoughts anyone else?

@khaneliman
Copy link
Collaborator

khaneliman commented Nov 5, 2025

I agree I don't really like darwin namespacing really... Should be able to hide options / disable options on darwin if they can't be used.

          visible = pkgs.stdenv.hostPlatform.isLinux;
          readOnly = pkgs.stdenv.hostPlatform.isDarwin;

or just don't make them available through not importing ?

@delafthi
Copy link
Contributor Author

delafthi commented Nov 5, 2025

Any thoughts anyone else?

I agree. An implementation without a darwin namespace would be nicer.

@delafthi delafthi force-pushed the push-rplzqunssuyz branch 3 times, most recently from 5da68ee to 1f40bb5 Compare November 5, 2025 09:39
- restructure module from `podman-linux` to platform-agnostic `podman`
- move linux-specific implementation to `modules/services/podman/linux/`
- add darwin module with declarative machine management
- implement launchd-based watchdog for auto-starting machines
- maintains backward compatibility with existing linux functionality
delafthi added a commit to delafthi/dotfiles that referenced this pull request Nov 5, 2025
This change removes our custom podman-darwin module that manually managed
Podman machines on macOS. Instead, we now rely on home-manager's native
podman module which includes proper launchd integration for machine
management.

Waits for: nix-community/home-manager#8102
delafthi added a commit to delafthi/dotfiles that referenced this pull request Nov 5, 2025
This change removes our custom podman-darwin module that manually managed
Podman machines on macOS. Instead, we now rely on home-manager's native
podman module which includes proper launchd integration for machine
management.

Waits for: nix-community/home-manager#8102
delafthi added a commit to delafthi/dotfiles that referenced this pull request Nov 7, 2025
This change removes our custom podman-darwin module that manually managed
Podman machines on macOS. Instead, we now rely on home-manager's native
podman module which includes proper launchd integration for machine
management.

Waits for: nix-community/home-manager#8102
delafthi added a commit to delafthi/dotfiles that referenced this pull request Nov 7, 2025
This change removes our custom podman-darwin module that manually managed
Podman machines on macOS. Instead, we now rely on home-manager's native
podman module which includes proper launchd integration for machine
management.

Waits for: nix-community/home-manager#8102
@delafthi
Copy link
Contributor Author

@n-hass just a ping. I removed the darwin namespace.

./networks.nix
./services.nix
./volumes.nix
./linux/default.nix
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you make these imports conditional on platform? That way respective platforms will not have visibility of the invalid options. eg


  imports =
    lib.optional pkgs.stdenv.hostPlatform.isLinux ./linux/default.nix
    ++ lib.optional pkgs.stdenv.hostPlatform.isDarwin ./darwin.nix;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried this, but I think conditional imports are not allowed - at least not this way. I get the following error, when running the tests with conditional imports:

> make test TEST=podman-configuration
nix-shell --pure tests -I nixpkgs=https://github.com/NixOS/nixpkgs/archive/nixpkgs-unstable.tar.gz -A run.podman-configuration
unpacking 'https://github.com/NixOS/nixpkgs/archive/nixpkgs-unstable.tar.gz' into the Git cache...
error:
       … while calling the 'derivationStrict' builtin
         at <nix/derivation-internal.nix>:37:12:
           36|
           37|   strict = derivationStrict drvAttrs;
             |            ^
           38|while evaluating derivation 'nmt-run-podman-configuration'
         whose name attribute is located at /nix/store/8pskd9fpj2lgv6fjyyvhhxvw4bmayfnd-source/pkgs/stdenv/generic/make-derivation.nix:541:13

       … while evaluating attribute 'shellHook' of derivation 'nmt-run-podman-configuration'
         at /nix/store/fm1dwqb08lxr1gk02niyvb1j7v4181c0-source/default.nix:38:41:
           37|   runShellOnlyCommand = name: shellHook:
           38|     pkgs.runCommandLocal name { inherit shellHook; } ''
             |                                         ^
           39|       echo This derivation is only useful when run through nix-shell.

       … while evaluating the module argument `pkgs' in "/home/deaa/Developer/personal/home-manager/modules/services/podman":

       … noting that argument `pkgs` is not externally provided, so querying `_module.args` instead, requiring `config`

       … if you get an infinite recursion here, you probably reference `config` in `imports`. If you are trying to achieve a conditional import behavior dependent on `config`, consider importing unconditionally, and using `mkEnableOption` and `mkIf` to control its effect.

       (stack trace truncated; use '--show-trace' to show the full, detailed trace)

       error: infinite recursion encountered
make: *** [Makefile:14: test] Error 1

@khaneliman do you know of a way to resolve this problem?

@n-hass
Copy link
Contributor

n-hass commented Nov 28, 2025

Impl looks good - just one small thing about guarding imports by platform.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants