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

doc: diff *.age files #177

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

Conversation

smaximov
Copy link

@smaximov smaximov commented Mar 25, 2023

I'd like to share the steps I used to enable cleartext Git diffs for *.age files using .gitattributes (disclaimer: I borrowed the idea and even whole sentences from SOPS README).

@smaximov
Copy link
Author

smaximov commented Mar 25, 2023

As an alternative to manually adding a helper script rage-textconv, maybe it's worth introducing a new option (disabled by default?) which would do it automatically? For example:

let ageDiffer = with pkgs; 
   writeShellApplication {
     name = "rage-textconv";
     text = ''
        ${cfg.ageBin} --decrypt "$1" ${
          lib.strings.concatMapStringsSep " "
          (path: "-i ${lib.strings.escapeShellArg path}")
          cfg.identityPaths
       }
    '';
  }; 
in {
  # ...
  options.age = {
    # ...
    enablePlaintextDiffer = mkOption {
      type = types.bool;
      default = false;
      # ...
    };
  };

  # ...
  config = {
    # ...
    environment.systemPackages = lib.lists.optional cfg.enablePlaintextDiffer ageDiffer;
  };
}

But that would still require manual actions from the user.

@@ -253,7 +253,52 @@ but, if you want to (change the system based on your system):
};
}
```
7. NixOS rebuild or use your deployment tool like usual.
7. (Optional) Setup git to decrypt `*.age` files when showing diffs
Copy link
Owner

Choose a reason for hiding this comment

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

I don't think we should insert optional steps in the tutorial. It is hard enough to follow as is. I'd be okay with adding this as a separate section though!

@raboof
Copy link

raboof commented May 26, 2024

something like this would be really nice!

my ssh key has a passphrase, though, and while git diff does prompt for it and continues after I hit 'enter', it does not pass on all characters.

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.

None yet

3 participants