1
0
Fork 0

More messing around; added a module template

This commit is contained in:
Aires 2024-05-21 09:22:03 -04:00
parent 832aa56828
commit 7ab2df21a6
13 changed files with 76 additions and 45 deletions

View file

@ -42,7 +42,10 @@ in
}; };
}; };
}; };
apcupsd.enable = true; apcupsd = {
enable = true;
configText = builtins.readFile ./etc/apcupsd.conf;
};
airsonic = { airsonic = {
enable = true; enable = true;
domain = config.secrets.networking.primaryDomain; domain = config.secrets.networking.primaryDomain;
@ -79,16 +82,13 @@ in
ports = [ config.secrets.hosts.haven.ssh.port ]; ports = [ config.secrets.hosts.haven.ssh.port ];
}; };
}; };
users = { users.aires = {
aires = {
enable = true; enable = true;
services.syncthing = { services.syncthing = {
enable = true; enable = true;
autostart = false; autostart = false;
}; };
}; };
media.enable = true;
};
}; };
# TODO: VPN (Check out Wireguard) # TODO: VPN (Check out Wireguard)

View file

@ -19,8 +19,7 @@
flatpak.enable = true; flatpak.enable = true;
gnome.enable = true; gnome.enable = true;
}; };
users = { users.aires = {
aires = {
enable = true; enable = true;
autologin = true; autologin = true;
services = { services = {
@ -32,7 +31,6 @@
}; };
}; };
}; };
};
# Build remotely # Build remotely
nix.distributedBuilds = true; nix.distributedBuilds = true;

View file

@ -13,6 +13,10 @@
role = "server"; role = "server";
users.aires.enable = true; users.aires.enable = true;
boot.enable = false; boot.enable = false;
services.ssh = {
enable = true;
ports = [ nix-secrets.hosts.haven.ssh.port ];
};
}; };
networking.hostName = "Pihole"; networking.hostName = "Pihole";
@ -34,16 +38,4 @@
}; };
}; };
}; };
# Enable SSH
services.openssh = {
enable = true;
ports = [ 33105 ];
settings = {
PasswordAuthentication = true;
AllowUsers = [ "aires" ];
PermitRootLogin = "no";
};
};
} }

View file

@ -14,6 +14,7 @@ let
files = files =
dir: collect isString (mapAttrsRecursive (path: type: concatStringsSep "/" path) (getDir dir)); dir: collect isString (mapAttrsRecursive (path: type: concatStringsSep "/" path) (getDir dir));
# Search all files and folders within and below the current directory.
# Filters out directories that belong to home-manager, and don't end with .nix or are this file. # Filters out directories that belong to home-manager, and don't end with .nix or are this file.
# Also, make the strings absolute # Also, make the strings absolute
validFiles = validFiles =

View file

@ -0,0 +1,41 @@
# This is an example of a blank module.
{ config, lib, ... }:
let
cfg = config.host.services.myModule;
in
{
options = {
host.services.myModule = {
enable = lib.mkEnableOption (lib.mdDoc "Enables this example module.");
attributes = lib.mkOption {
default = { };
type = lib.types.attrs;
description = "An example of an attributes option.";
};
string = lib.mkOption {
default = "";
type = lib.types.str;
description = "An example of a string option.";
};
list = lib.mkOption {
default = [ ];
type = lib.types.listOf lib.types.int;
description = "An example of a list (of integers) option.";
};
enum = mkOption {
default = "one";
type = types.enum [
"one"
"two"
];
description = "An example of an enum option.";
};
};
};
config = mkIf cfg.enable {
# Add changes applied by this module here.
};
}

View file

@ -14,6 +14,7 @@ in
autostart = lib.mkEnableOption (lib.mdDoc "Automatically starts Airsonic at boot."); autostart = lib.mkEnableOption (lib.mdDoc "Automatically starts Airsonic at boot.");
enable = lib.mkEnableOption (lib.mdDoc "Enables Airsonic Advanced media streaming service."); enable = lib.mkEnableOption (lib.mdDoc "Enables Airsonic Advanced media streaming service.");
home = lib.mkOption { home = lib.mkOption {
default = "";
type = lib.types.str; type = lib.types.str;
description = "Where to store Airsonic's files"; description = "Where to store Airsonic's files";
}; };

View file

@ -10,13 +10,19 @@ in
with lib; with lib;
{ {
options = { options = {
host.services.apcupsd.enable = mkEnableOption (mdDoc "Enables apcupsd"); host.services.apcupsd = {
enable = mkEnableOption (mdDoc "Enables apcupsd");
configText = lib.mkOption {
type = lib.types.str;
description = "The configuration to pass to apcupsd.";
};
};
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
services.apcupsd = { services.apcupsd = {
enable = true; enable = true;
configText = builtins.readFile ./etc/apcupsd.conf; configText = cfg.configText;
}; };
}; };
} }

View file

@ -29,6 +29,7 @@ in
autostart = lib.mkEnableOption (lib.mdDoc "Automatically starts Forgejo at boot."); autostart = lib.mkEnableOption (lib.mdDoc "Automatically starts Forgejo at boot.");
enable = lib.mkEnableOption (lib.mdDoc "Enables Forgejo Git hosting service."); enable = lib.mkEnableOption (lib.mdDoc "Enables Forgejo Git hosting service.");
home = lib.mkOption { home = lib.mkOption {
default = "";
type = lib.types.str; type = lib.types.str;
description = "Where to store Forgejo's files"; description = "Where to store Forgejo's files";
}; };

View file

@ -38,13 +38,12 @@ with lib;
} }
]; ];
# Install Flatpaks. For details, see https://github.com/gmodena/nix-flatpak # Install base Flatpaks. For details, see https://github.com/gmodena/nix-flatpak
packages = [ packages = [
"com.github.tchx84.Flatseal" "com.github.tchx84.Flatseal"
"md.obsidian.Obsidian" "md.obsidian.Obsidian"
"net.waterfox.waterfox" "net.waterfox.waterfox"
"org.keepassxc.KeePassXC" "org.keepassxc.KeePassXC"
"org.mozilla.firefox"
]; ];
}; };

View file

@ -36,12 +36,10 @@ with lib;
# Enable Gnome # Enable Gnome
desktopManager.gnome.enable = true; desktopManager.gnome.enable = true;
displayManager = { displayManager.gdm.enable = true;
gdm.enable = true;
};
# Remove default packages that came with the install # Remove default packages that came with the install
excludePackages = with pkgs; [ xterm ]; excludePackages = [ pkgs.xterm ];
}; };
# Install Flatpaks # Install Flatpaks
@ -66,8 +64,7 @@ with lib;
"org.gtk.Gtk3theme.Adwaita-dark" "org.gtk.Gtk3theme.Adwaita-dark"
]; ];
# Disable CUPS - not needed printing.enable = true;
printing.enable = false;
}; };
environment = { environment = {

View file

@ -99,8 +99,6 @@ with lib;
shellAliases = { shellAliases = {
update = "upgrade"; update = "upgrade";
upgrade = "nh os boot --update --ask"; upgrade = "nh os boot --update --ask";
protontricks = "flatpak run com.github.Matoking.protontricks";
please = "sudo";
}; };
loginExtra = "fastfetch"; loginExtra = "fastfetch";
}; };

View file

@ -108,9 +108,6 @@ with lib;
file = "p10k.zsh"; file = "p10k.zsh";
} }
]; ];
shellAliases = {
please = "sudo";
};
}; };
}; };
}; };