summaryrefslogtreecommitdiff
path: root/hosts
diff options
context:
space:
mode:
authorFuwn <[email protected]>2024-10-28 09:58:10 -0700
committerFuwn <[email protected]>2024-10-28 09:58:10 -0700
commit2fb6e0ffc7448602a28a57aec1f26127e1a05c6d (patch)
treeca8a7d3e0395353edca7da5f2f5e9a411c0b9da5 /hosts
parentcore: move simple programs to core (diff)
downloadnixos-config-2fb6e0ffc7448602a28a57aec1f26127e1a05c6d.tar.xz
nixos-config-2fb6e0ffc7448602a28a57aec1f26127e1a05c6d.zip
kioku: move primary modules to modules
Diffstat (limited to 'hosts')
-rw-r--r--hosts/kioku/configuration.nix96
-rw-r--r--hosts/kioku/hardware-configuration.nix16
2 files changed, 17 insertions, 95 deletions
diff --git a/hosts/kioku/configuration.nix b/hosts/kioku/configuration.nix
index f955735..8d3a630 100644
--- a/hosts/kioku/configuration.nix
+++ b/hosts/kioku/configuration.nix
@@ -1,8 +1,4 @@
{
- config,
- lib,
- pkgs,
- secrets,
self,
...
}:
@@ -10,101 +6,13 @@
imports = [
"${self}/modules/core"
"${self}/modules/options"
+ "${self}/modules/usb"
];
config = {
modules.primaryUser = "ebisu";
- time.timeZone = secrets.i18n.timezone;
+ networking.hostName = "kioku";
system.stateVersion = "24.05";
raspberry-pi-nix.kernel-version = "v6_10_12";
-
- users = {
- groups.${config.modules.primaryUser} = { };
-
- users =
- let
- defaultOptions = {
- initialHashedPassword = secrets.initial_hashed_password;
- openssh.authorizedKeys.keys = [ secrets.kioku_openssh_public_key ];
- };
- in
- {
- root = defaultOptions;
-
- ${config.modules.primaryUser} = defaultOptions // {
- group = config.modules.primaryUser;
- isNormalUser = true;
- };
- };
- };
-
- zramSwap = {
- enable = true;
- priority = 100;
- memoryMax = 268435456;
- algorithm = "lz4";
- memoryPercent = 50;
- };
-
- networking = {
- firewall.enable = lib.mkForce false;
- hostName = "kioku";
- useDHCP = lib.mkDefault true;
-
- wireless =
- let
- network = builtins.elemAt secrets.wifi 0;
- in
- {
- enable = true;
- interfaces = [ "wlan0" ];
- networks."${network.ssid}".psk = network.psk;
- };
- };
-
- services = {
- openssh.settings.PermitRootLogin = "prohibit-password";
-
- samba = {
- enable = true;
- openFirewall = true;
-
- settings = {
- usb = {
- browseable = "yes";
- path = "/mnt/usb_share";
- "guest ok" = "no";
- "read only" = "no";
- "create mask" = "777";
- "directory mask" = "777";
- "valid users" = config.modules.primaryUser;
- };
- };
- };
-
- samba-wsdd = {
- enable = true;
- openFirewall = true;
- };
- };
-
- systemd.services.usbshare = {
- description = "USB Share Watchdog";
- wantedBy = [ "multi-user.target" ];
-
- serviceConfig =
- let
- usb_share_script = pkgs.fetchurl {
- url = "https://gist.githubusercontent.com/davidhoness/0f45ef6a41bac6311614f109acbf92db/raw/970badd0ae4b097e3af8d5142e65c34b21f5cfab/usb_share.py";
- sha256 = "sha256-Z8HoOmzK3UjZac6hB3297fCDrbLwiFFNwxhqzr1WMSo";
- };
- in
- {
- ExecStart = "${pkgs.python3.withPackages (ps: [ ps.watchdog ])}/bin/python3 ${usb_share_script}";
- Restart = "always";
- Type = "simple";
- Environment = "PATH=${pkgs.kmod}/bin:${pkgs.coreutils}/bin";
- };
- };
};
}
diff --git a/hosts/kioku/hardware-configuration.nix b/hosts/kioku/hardware-configuration.nix
index 47498ff..264810f 100644
--- a/hosts/kioku/hardware-configuration.nix
+++ b/hosts/kioku/hardware-configuration.nix
@@ -1,7 +1,21 @@
-{ lib, ... }:
+{ lib, secrets, ... }:
{
raspberry-pi-nix.board = "bcm2711";
+ networking = {
+ useDHCP = lib.mkDefault true;
+
+ wireless =
+ let
+ network = builtins.elemAt secrets.wifi 0;
+ in
+ {
+ enable = true;
+ interfaces = [ "wlan0" ];
+ networks."${network.ssid}".psk = network.psk;
+ };
+ };
+
fileSystems."/mnt/usb_share" = {
device = "/piusb.bin";
fsType = "exfat";