Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

63: Added some lightweight Nix state #81

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

mattgeddes
Copy link
Contributor

Closes #63. Some of the heavier-weight Nix-related stuff we want to check on will be added to self-checks infrastructure.

@mattgeddes mattgeddes self-assigned this Feb 24, 2025
@mattgeddes mattgeddes requested a review from a team as a code owner February 24, 2025 06:53
// If we ever decide to enable `use-xdg-base-directories`, we'll need this to point to
// `$XDG_STATE_HOME/nix/channels` instead.
const NIX_CHANNELS_FILE: &str = "/root/.nix-channels";
fn from_host() -> Self {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you add some tests for this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure. Did you have anything specific in mind? I can put some wrapper functions around the constant path name, have the test(s) create a dummy channel file and use this code to parse it if we think there's value there.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Just some unit tests would be fine by me. Just anything to run through a happy path and validate it works as intended

Copy link
Contributor

@steveej steveej left a comment

Choose a reason for hiding this comment

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

i propose the following as additions to this PR as they're lightweight enough IMO:

  • /root/.nix-defexpr/channels/holo-nixpkgs/.git-version as a blob
  • /var/lib/zerotier-one/identity.public as a blob
  • /etc/nixos as a compressed tarball. i expect this a few KB max. in my case it's 711B using tar --dereference --hard-dereference -cavjf etcnixos.tbz2 /etc/nixos/*.nix
  • value of the NIX_PATH env var
  • output of systemctl status holo-nixpkgs-auto-upgrade.service or equivalent
  • output of systemctl status auto-update.timer or equivalent

having these in a follow-up is fine with me.
i just think without these the requirements discussed in this issue aren't covered.

// If we ever decide to enable `use-xdg-base-directories`, we'll need this to point to
// `$XDG_STATE_HOME/nix/channels` instead.
const NIX_CHANNELS_FILE: &str = "/root/.nix-channels";
fn from_host() -> Self {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just some unit tests would be fine by me. Just anything to run through a happy path and validate it works as intended

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