Skip to content

nixos/artifacts: backend-agnostic secret management interface - #519619

Draft
Mutasem-mk4 wants to merge 8 commits into
NixOS:masterfrom
Mutasem-mk4:feature/nixos-artifacts
Draft

Mutasem-mk4 wants to merge 8 commits into
NixOS:masterfrom
Mutasem-mk4:feature/nixos-artifacts

Conversation

@Mutasem-mk4

Copy link
Copy Markdown

This PR introduces \security.artifacts, a backend-agnostic abstraction layer for managing secrets in NixOS. It decouples NixOS service modules from specific secret providers like sops-nix, agenix, or systemd-creds.

Motivation

Currently, NixOS modules often hardcode support for specific secret managers or leave users to manually pass paths. This forces users into vendor lock-in or fragile configuration.

Implementation

  • Introduces \security.artifacts.secrets.\ options.
  • Includes provider backends: \sops-nix, \�genix, \systemd-creds, and a \dummy\ backend for CI/CD environments.
  • Implements strict evaluation-time assertions ensuring secrets never leak into the Nix store.
  • Adds comprehensive
    ixosTest\ coverage validating permissions, target ordering, and dummy provisioners.

@Mutasem-mk4
Mutasem-mk4 force-pushed the feature/nixos-artifacts branch from 0991e23 to 865b3d5 Compare May 13, 2026 03:02
@nixpkgs-ci nixpkgs-ci Bot added the 12.first-time contribution This PR is the author's first one; please be gentle! label May 13, 2026
This commit updates the backend-agnostic secret management abstraction:
- security.artifacts: add 'source' option for encrypted files.
- security.artifacts: change 'path' type from path to str to prevent store coercion.
- security.artifacts: add rigorous assertions to reject store leaks and missing sources.
- security.artifacts/dummy: harden dummy provider against shell injection.
- security.artifacts/sops-nix: map 'source' to 'sopsFile'.
- security.artifacts/agenix: map 'source' to 'file'.
- security.artifacts/systemd-creds: migrate to /etc/credstore convention.
- tests/artifacts: expand from 1 to 9 comprehensive integration tests.
- doc/manual: expand secret-management.md with architecture and backends.
This patch conditionally translates options into sops.secrets and
age.secrets using lib.optionalAttrs, checking whether those external
modules are imported via (options ? sops) and (options ? age).
This prevents the nixpkgs module evaluator from aborting strictly when
testing nixos modules against the dummy provider.
@nixpkgs-ci nixpkgs-ci Bot added 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 9.needs: reviewer This PR currently has no reviewers requested and needs attention. labels May 13, 2026
@nixpkgs-ci nixpkgs-ci Bot added 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: changelog This PR adds or changes release notes 8.has: module (update) This PR changes an existing module in `nixos/` 8.has: documentation This PR adds or changes documentation labels May 13, 2026
@nixpkgs-ci
nixpkgs-ci Bot requested a review from a team May 13, 2026 10:26
@nixpkgs-ci nixpkgs-ci Bot added 6.topic: continuous integration Affects continuous integration (CI) in Nixpkgs, including Ofborg and GitHub Actions 6.topic: policy discussion Discuss policies to work in and around Nixpkgs backport release-25.11 and removed 9.needs: reviewer This PR currently has no reviewers requested and needs attention. labels May 13, 2026
@nixpkgs-ci nixpkgs-ci Bot added the 2.status: merge conflict This PR has merge conflicts with the target branch label Jun 7, 2026

@SigmaSquadron SigmaSquadron left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't think anyone was planning on merging this, but I'm blocking this just in case:

This is AI slop. Although NixOS allows LLM-generated contributions into the tree, our automation policy clearly states that LLMs are only to be used as a way to hasten human programming, not do the entirety of the development. We need a capable human in the loop whenever an LLM makes changes, and it's clear from your commits that you are not the one developing this, and neither you nor your AI model really know how to make a working NixOS module. You must also disclose LLM usage whenever it is required by the automation policy, which your commits and PR description fail to do.

Finally, please do not replace the PR description template.

@SigmaSquadron
SigmaSquadron marked this pull request as draft June 21, 2026 13:24
@Mutasem-mk4

Copy link
Copy Markdown
Author

Hi @SigmaSquadron,

Thanks for the catch and for calling out the policy violation. You're right—I relied too heavily on an LLM to bootstrap this, and I messed up by replacing the PR template and not disclosing it. That's on me, and I apologize.

I'm actually very interested in getting this backend-agnostic interface right. I'm going to take a step back, dig into the NixOS module system properly, and rewrite/fix the broken parts myself.

I’ll restore and update the PR description template right now to be transparent about the tools used, and I won't ask for another review until I've thoroughly tested everything locally and made sure the implementation is solid.

Appreciate your patience and feedback.

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

Labels

2.status: merge conflict This PR has merge conflicts with the target branch 6.topic: continuous integration Affects continuous integration (CI) in Nixpkgs, including Ofborg and GitHub Actions 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 6.topic: policy discussion Discuss policies to work in and around Nixpkgs 8.has: changelog This PR adds or changes release notes 8.has: documentation This PR adds or changes documentation 8.has: module (update) This PR changes an existing module in `nixos/` 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 12.first-time contribution This PR is the author's first one; please be gentle!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants