dotfiles
My PC Dotfiles & Websitegit clone https://github.com/maydayv7/dotfiles
modules/system/crypt.nix (1313B)
1## GPG & SSH Configuration ##
2_: {
3 flake.modules = {
4 nixos.crypt = {lib, ...}: {
5 programs.gnupg.agent = {
6 enable = true;
7 enableSSHSupport = true;
8 };
9
10 environment.persist.directories = ["/etc/ssh"];
11 services.openssh = {
12 enable = true;
13 settings = {
14 PasswordAuthentication = false;
15 PermitRootLogin = lib.mkForce "no";
16 };
17
18 hostKeys = [
19 {
20 comment = "Host SSH Key";
21 bits = 4096;
22 type = "ed25519";
23 path = "/etc/ssh/ssh_key";
24 }
25 ];
26 };
27 };
28
29 homeManager.crypt = _: {
30 home.persist.directories = [
31 {
32 directory = ".gnupg";
33 mode = "0700";
34 }
35 {
36 directory = ".ssh";
37 mode = "0700";
38 }
39 ];
40
41 programs.ssh = {
42 enable = true;
43 settings."*" = {
44 ForwardAgent = false;
45 AddKeysToAgent = "no";
46 Compression = false;
47 ServerAliveInterval = 0;
48 ServerAliveCountMax = 3;
49 HashKnownHosts = false;
50 UserKnownHostsFile = "~/.ssh/known_hosts";
51 ControlMaster = "no";
52 ControlPath = "~/.ssh/master-%r@%n:%p";
53 ControlPersist = "no";
54 };
55 };
56 };
57 };
58}