Skip to content
komar007Public

About

A Home Manager module for generating ~/.netrc through sops-nix templates.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

10 Commits

Folders and files

Repository files navigation

hm-netrc

GitHub branch check runs

A Home Manager module for generating ~/.netrc through sops-nix templates.

The module does not import sops-nix for you. Import both modules in your configuration.

Usage

Add this flake and sops-nix as source:

{
  inputs = {
    hm-netrc.url = "github:komar007/hm-netrc";
    sops-nix.url = "github:Mic92/sops-nix";
  };
}

Then import the modules in your Home Manager configuration and reference sops-nix placeholders from the netrc entries:

{ config, ... }:
{
  imports = [
    inputs.sops-nix.homeManagerModules.sops
    inputs.hm-netrc.homeManagerModules.netrc
  ];

  sops = {
    defaultSopsFile = ./secrets.yaml;
    secrets = {
      "netrc/example.com/password" = { };
      "netrc/default/password" = { };
    };
  };

  netrc = {
    enable = true;
    entries = [
      {
        machine = "example.com";
        login = "user";
        password = config.sops.placeholder."netrc/example.com/password";
      }
    ];
    default = {
      login = "default-user";
      password = config.sops.placeholder."netrc/default/password";
    };
  };
}

This creates ~/.netrc as an out-of-store symlink to a sops-nix template.

Options

Option Type Default Description
netrc.enable boolean false Enable management of ~/.netrc.
netrc.entries list of submodules [] Machine-specific netrc entries.
netrc.entries.*.machine string required Machine name.
netrc.entries.*.login string required Login value.
netrc.entries.*.password string required Password value.
netrc.entries.*.account null or string null Optional account value.
netrc.default null or submodule null Optional default entry with login, password, and optional account.

When netrc.enable is false, importing the module does not create ~/.netrc and does not require the sops option namespace to be present.

About

A Home Manager module for generating ~/.netrc through sops-nix templates.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages