use agenix
This commit is contained in:
@@ -53,6 +53,7 @@
|
|||||||
};
|
};
|
||||||
configurationWithHomeManager = machine: (configuration machine
|
configurationWithHomeManager = machine: (configuration machine
|
||||||
[
|
[
|
||||||
|
agenix.nixosModules.default
|
||||||
home-manager.nixosModules.home-manager
|
home-manager.nixosModules.home-manager
|
||||||
{
|
{
|
||||||
nixpkgs.overlays = [
|
nixpkgs.overlays = [
|
||||||
|
|||||||
@@ -1,4 +1,9 @@
|
|||||||
{machine, ...}: {
|
{
|
||||||
|
config,
|
||||||
|
machine,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
|
age.secrets.secret1.file = ../../secrets/secret1.age;
|
||||||
boot.tmp.cleanOnBoot = true;
|
boot.tmp.cleanOnBoot = true;
|
||||||
boot.loader.grub.devices = ["nodev"];
|
boot.loader.grub.devices = ["nodev"];
|
||||||
environment.persistence."/nix/persist" = {
|
environment.persistence."/nix/persist" = {
|
||||||
@@ -66,7 +71,7 @@
|
|||||||
users.users."mtgmonkey" = {
|
users.users."mtgmonkey" = {
|
||||||
isNormalUser = true;
|
isNormalUser = true;
|
||||||
description = "mtgmonkey";
|
description = "mtgmonkey";
|
||||||
initialPassword = "password";
|
passwordFile = builtins.toString config.age.secrets.secret1.path;
|
||||||
extraGroups = ["wheel"];
|
extraGroups = ["wheel"];
|
||||||
openssh.authorizedKeys.keys = machine.pub-keys.ssh;
|
openssh.authorizedKeys.keys = machine.pub-keys.ssh;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,8 +1,13 @@
|
|||||||
{
|
{
|
||||||
|
config,
|
||||||
lib,
|
lib,
|
||||||
machine,
|
machine,
|
||||||
...
|
...
|
||||||
}: {
|
}: {
|
||||||
|
age.secrets = {
|
||||||
|
secret0.file = ../../secrets/secret0.age;
|
||||||
|
secret1.file = ../../secrets/secret1.age;
|
||||||
|
};
|
||||||
boot.loader = {
|
boot.loader = {
|
||||||
efi.canTouchEfiVariables = true;
|
efi.canTouchEfiVariables = true;
|
||||||
systemd-boot.enable = true;
|
systemd-boot.enable = true;
|
||||||
@@ -16,6 +21,7 @@
|
|||||||
"/var/lib/nixos"
|
"/var/lib/nixos"
|
||||||
"/var/lib/systemd/coredump"
|
"/var/lib/systemd/coredump"
|
||||||
"/etc/NetworkManager/system-connections"
|
"/etc/NetworkManager/system-connections"
|
||||||
|
"/etc/ssh"
|
||||||
];
|
];
|
||||||
files = [
|
files = [
|
||||||
"/etc/machine-id"
|
"/etc/machine-id"
|
||||||
@@ -82,6 +88,7 @@
|
|||||||
ly.enable = true;
|
ly.enable = true;
|
||||||
};
|
};
|
||||||
libinput.enable = true;
|
libinput.enable = true;
|
||||||
|
openssh.enable = true;
|
||||||
printing.enable = true;
|
printing.enable = true;
|
||||||
};
|
};
|
||||||
system.stateVersion = "26.05";
|
system.stateVersion = "26.05";
|
||||||
@@ -89,7 +96,7 @@
|
|||||||
users.users."andromeda" = {
|
users.users."andromeda" = {
|
||||||
isNormalUser = true;
|
isNormalUser = true;
|
||||||
description = "andromeda";
|
description = "andromeda";
|
||||||
initialPassword = "password";
|
hashedPasswordFile = builtins.toString config.age.secrets.secret0.path;
|
||||||
extraGroups = [
|
extraGroups = [
|
||||||
"networkmanager"
|
"networkmanager"
|
||||||
"wheel"
|
"wheel"
|
||||||
@@ -98,7 +105,7 @@
|
|||||||
users.users."mtgmonkey" = {
|
users.users."mtgmonkey" = {
|
||||||
isNormalUser = true;
|
isNormalUser = true;
|
||||||
description = "mtgmonkey";
|
description = "mtgmonkey";
|
||||||
initialPassword = "password";
|
hashedPasswordFile = builtins.toString config.age.secrets.secret1.path;
|
||||||
extraGroups = [
|
extraGroups = [
|
||||||
"networkmanager"
|
"networkmanager"
|
||||||
"wheel"
|
"wheel"
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
#device = "none";
|
#device = "none";
|
||||||
#fsType = "tmpfs";
|
#fsType = "tmpfs";
|
||||||
#options = ["defaults" "size=60%" "mode=755"];
|
#options = ["defaults" "size=60%" "mode=755"];
|
||||||
device = "/dev/disk/by-uuid/16c93673-4f0e-4010-a7f4-7ccffb20edb7";
|
device = "/dev/disk/by-uuid/5455cfb4-0efd-4f55-b496-d2cab3f419b7";
|
||||||
fsType = "btrfs";
|
fsType = "btrfs";
|
||||||
options = ["subvol=root"];
|
options = ["subvol=root"];
|
||||||
};
|
};
|
||||||
@@ -48,6 +48,12 @@
|
|||||||
done
|
done
|
||||||
|
|
||||||
btrfs subvolume create /btrfs_tmp/root
|
btrfs subvolume create /btrfs_tmp/root
|
||||||
|
mkdir /btrfs_tmp/root/nix
|
||||||
|
mkdir /btrfs_tmp/root/etc
|
||||||
|
mount ${config.fileSystems."/nix".device} /btrfs_tmp/root/nix
|
||||||
|
cp /btrfs_tmp/root/nix/persist/etc/ssh /btrfs_tmp/root/etc/ssh -r
|
||||||
|
umount /btrfs_tmp/root/nix
|
||||||
|
rm -r /btrfs_tmp/root/nix
|
||||||
umount /btrfs_tmp
|
umount /btrfs_tmp
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
|||||||
BIN
secrets/secret0.age
Normal file
BIN
secrets/secret0.age
Normal file
Binary file not shown.
BIN
secrets/secret1.age
Normal file
BIN
secrets/secret1.age
Normal file
Binary file not shown.
7
secrets/secrets.nix
Normal file
7
secrets/secrets.nix
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
let
|
||||||
|
andromeda = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJy2VD362wUcu0lKj2d6OIU8dbAna0Lu/NaAYIj8gdIA andromeda@lenovo";
|
||||||
|
lenovo = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHG4eqsLTq2os2mxfwhys3BpVnowcJrqt2CbRFzN2pJb root@lenovo";
|
||||||
|
in {
|
||||||
|
"secret0.age".publicKeys = [andromeda lenovo];
|
||||||
|
"secret1.age".publicKeys = [andromeda lenovo];
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user