Skip to content

Commit

Permalink
Add agenix
Browse files Browse the repository at this point in the history
  • Loading branch information
yousiki committed Mar 24, 2024
1 parent 9d1d106 commit c58b2bf
Show file tree
Hide file tree
Showing 8 changed files with 124 additions and 6 deletions.
1 change: 1 addition & 0 deletions cells/common/profiles/core.nix
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ in {

# Basic packages for both NixOS and Darwin.
environment.systemPackages = with pkgs; [
agenix
alejandra
cachix
curl
Expand Down
2 changes: 2 additions & 0 deletions cells/nixos/hosts/hakase/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
inputs.cells.nixos.nixosProfiles.core
inputs.cells.nixos.nixosProfiles.desktop
inputs.cells.nixos.nixosProfiles.nvidia
inputs.cells.nixos.nixosProfiles.secrets
inputs.cells.nixos.nixosProfiles.server

inputs.cells.home.homeProfiles.base
Expand Down Expand Up @@ -57,6 +58,7 @@
cudaSupport = true;
};
overlays = [
inputs.agenix.overlays.default
inputs.fenix.overlays.default
inputs.nvfetcher.overlays.default
];
Expand Down
4 changes: 3 additions & 1 deletion cells/nixos/hosts/hakase/hardware-configuration.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
modulesPath,
...
}: let
credentials = config.age.secrets.nas-credentials.path;

mkCifs = device: {
device = device;
fsType = "cifs";
Expand All @@ -18,7 +20,7 @@
"x-systemd.device-timeout=5s"
"x-systemd.mount-timeout=5s"
"noperm"
"credentials=/etc/credentials"
"credentials=${credentials}"
];
};
in {
Expand Down
10 changes: 10 additions & 0 deletions cells/nixos/profiles/secrets.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
inputs,
cell,
}: {...}: {
imports = [
inputs.agenix.nixosModules.default
];

age.secrets.nas-credentials.file = "${inputs.self}/secrets/nas-credentials.age";
}
92 changes: 87 additions & 5 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,11 @@
url = "github:nix-community/nix-index-database";
inputs.nixpkgs.follows = "nixpkgs";
};

agenix = {
url = "github:ryantm/agenix";
inputs.nixpkgs.follows = "nixpkgs";
};
};

nixConfig = rec {
Expand Down
7 changes: 7 additions & 0 deletions secrets/nas-credentials.age
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
age-encryption.org/v1
-> ssh-ed25519 n0eTIA uldBDn7i4Kme4C6hBrDQ6LHlq1NKa7A75M8YhOhtAAI
ZGgyCEJr+Xf9CztP9XKoIATiA13jth4xNaE4FPrGJB4
-> ssh-ed25519 N9KtPg MYvP63pPrC7KoWHLJk/5anYiQh4aVzfhCfEE3Vd/djU
ZhRwRfhzIPyDYNYCmtEvGWimtCvRNe1TfmpSsR9PG6s
--- Tb+jv81q4ekvdEivQucmHI+SlkCFzHpl+ToSB2tMM8o
�����>Q�8�{�� �]@�&��TE�'VE� K��"�|�NH���ؔ��b������r(n�j
Expand Down
9 changes: 9 additions & 0 deletions secrets/secrets.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
let
hakase = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJJIxfWYaoGqw02b2U04OtaaPgIVFH7m2zyFwfRWAQl/";
hosts = [hakase];

yousiki_hakase = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFn+pRkC6G81PSmJOw8j8Y9i8Gt2OZiQ73ZpQV4UIZbg";
users = [yousiki_hakase];
in {
"nas-credentials.age".publicKeys = hosts ++ users;
}

0 comments on commit c58b2bf

Please sign in to comment.