Skip to content

Commit

Permalink
Cleaned up some files (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
spietras authored Feb 5, 2024
1 parent 0112e8a commit 335a970
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 30 deletions.
11 changes: 11 additions & 0 deletions src/hosts/xenon/modules/motd/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@
pkgs,
...
}: {
environment = {
persistence = {
"/softstate" = {
files = [
# MOTD
"/etc/motd"
];
};
};
};

systemd = {
services = {
# Create a service for changing the MOTD
Expand Down
11 changes: 11 additions & 0 deletions src/hosts/xenon/modules/network/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@
pkgs,
...
}: {
environment = {
persistence = {
"/softstate" = {
directories = [
# Network connections
"/etc/NetworkManager/system-connections/"
];
};
};
};

networking = {
dhcpcd = {
# Disable dhcpcd, we use NetworkManager which has its own DHCP client
Expand Down
42 changes: 26 additions & 16 deletions src/hosts/xenon/modules/ssh/default.nix
Original file line number Diff line number Diff line change
@@ -1,25 +1,15 @@
# SSH server configuration
{
config,
lib,
pkgs,
...
}: {
users = {
users = {
spietras = {
openssh = {
authorizedKeys = {
# Take public keys from GitHub
keys = lib.strings.splitString "\n" (
builtins.readFile (
pkgs.fetchurl {
url = "https://github.com/spietras.keys";
sha256 = "sha256-gtXwzFGet2t8scHAP8lAZqFx2FjfYxAc+zqLecv+8Ik=";
}
)
);
};
};
environment = {
persistence = {
"/softstate" = {
# SSH host keys
files = map (key: key.path) config.services.openssh.hostKeys;
};
};
};
Expand Down Expand Up @@ -55,4 +45,24 @@
enable = true;
};
};

users = {
users = {
spietras = {
openssh = {
authorizedKeys = {
# Take public keys from GitHub
keys = lib.strings.splitString "\n" (
builtins.readFile (
pkgs.fetchurl {
url = "https://github.com/spietras.keys";
sha256 = "sha256-gtXwzFGet2t8scHAP8lAZqFx2FjfYxAc+zqLecv+8Ik=";
}
)
);
};
};
};
};
};
}
18 changes: 4 additions & 14 deletions src/hosts/xenon/modules/storage/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@
# State that should be preserved but it's okay to lose
"/softstate" = {
directories = [
# Network connections
"/etc/NetworkManager/system-connections/"

# Cache that should be preserved
"/var/cache/"

Expand All @@ -39,17 +36,10 @@
"/var/tmp/"
];

files =
[
# Machine ID should be preserved and not changed
"/etc/machine-id"

# MOTD
"/etc/motd"
]
++
# SSH host keys
map (key: key.path) config.services.openssh.hostKeys;
files = [
# Machine ID should be preserved and not changed
"/etc/machine-id"
];

# Don't display as mounts to reduce clutter
hideMounts = true;
Expand Down

0 comments on commit 335a970

Please sign in to comment.