2024-02-29 14:53:34 +00:00
|
|
|
{ pkgs, lib, config, ... }:
|
|
|
|
|
|
|
|
# Define 'gremlin' user
|
|
|
|
let
|
|
|
|
cfg = config.host.users.gremlin;
|
|
|
|
in
|
|
|
|
with lib;
|
|
|
|
{
|
|
|
|
options = {
|
|
|
|
host.users.gremlin = {
|
|
|
|
enable = mkEnableOption (mdDoc "Enables gremlin user account");
|
|
|
|
|
|
|
|
services.syncthing = {
|
|
|
|
enable = mkEnableOption (mdDoc "Enables Syncthing");
|
|
|
|
enableTray = mkEnableOption (mdDoc "Enables the Syncthing Tray application");
|
|
|
|
autostart = mkOption {
|
|
|
|
default = true;
|
|
|
|
type = types.bool;
|
|
|
|
description = "Whether to auto-start Syncthing on boot";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkMerge [
|
|
|
|
(mkIf cfg.enable {
|
|
|
|
# Add Gremlin account
|
|
|
|
users.users.gremlin = {
|
|
|
|
isNormalUser = true;
|
|
|
|
description = "Gremlin";
|
|
|
|
uid = 1001;
|
|
|
|
extraGroups = [ "networkmanager" "input" ];
|
|
|
|
|
|
|
|
# Allow systemd services to keep running even while gremlin is logged out
|
|
|
|
linger = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
# Install gremlin-specific flatpaks
|
2024-03-02 17:58:30 +00:00
|
|
|
services.flatpak.packages = lib.mkIf config.services.flatpak.enable [
|
2024-02-29 14:53:34 +00:00
|
|
|
"com.google.Chrome"
|
|
|
|
"com.slack.Slack"
|
|
|
|
];
|
|
|
|
|
|
|
|
home-manager.users.gremlin = {
|
|
|
|
imports = [
|
|
|
|
../common/gnome.nix
|
|
|
|
];
|
|
|
|
|
2024-03-21 20:17:06 +00:00
|
|
|
home = {
|
|
|
|
# Basic setup
|
|
|
|
username = "gremlin";
|
|
|
|
homeDirectory = "/home/gremlin";
|
2024-02-29 14:53:34 +00:00
|
|
|
|
2024-03-21 20:17:06 +00:00
|
|
|
# The state version is required and should stay at the version you originally installed.
|
|
|
|
stateVersion = "24.05";
|
|
|
|
};
|
2024-02-29 14:53:34 +00:00
|
|
|
|
2024-03-21 20:17:06 +00:00
|
|
|
programs = {
|
|
|
|
# Let home Manager install and manage itself.
|
|
|
|
home-manager.enable = true;
|
2024-02-29 14:53:34 +00:00
|
|
|
|
2024-03-21 20:17:06 +00:00
|
|
|
# Set up git
|
|
|
|
git = {
|
|
|
|
# Name and email set in nix-secrets
|
|
|
|
enable = true;
|
|
|
|
extraConfig = {
|
|
|
|
push.autoSetupRemote = "true";
|
|
|
|
};
|
|
|
|
};
|
2024-02-29 14:53:34 +00:00
|
|
|
|
2024-03-21 20:17:06 +00:00
|
|
|
# Set up Zsh
|
|
|
|
zsh = {
|
|
|
|
enable = true;
|
|
|
|
# Install and source the p10k theme
|
|
|
|
plugins = [
|
|
|
|
{ name = "powerlevel10k"; src = pkgs.zsh-powerlevel10k; file = "share/zsh-powerlevel10k/powerlevel10k.zsh-theme"; }
|
|
|
|
{ name = "powerlevel10k-config"; src = ./p10k-config; file = "p10k.zsh"; }
|
|
|
|
];
|
|
|
|
autosuggestion.enable = true;
|
|
|
|
syntaxHighlighting.enable = true;
|
|
|
|
history.ignoreDups = true; # Do not enter command lines into the history list if they are duplicates of the previous event.
|
|
|
|
prezto = {
|
|
|
|
git.submoduleIgnore = "untracked"; # Ignore submodules when they are untracked.
|
|
|
|
};
|
|
|
|
shellAliases = {
|
|
|
|
please = "sudo";
|
|
|
|
};
|
2024-02-29 14:53:34 +00:00
|
|
|
|
2024-03-21 20:17:06 +00:00
|
|
|
oh-my-zsh = {
|
|
|
|
enable = true;
|
|
|
|
plugins = [
|
|
|
|
"git"
|
|
|
|
];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
# SSH entries set in nix-secrets
|
2024-02-29 14:53:34 +00:00
|
|
|
};
|
|
|
|
})
|
|
|
|
|
|
|
|
# Enable Syncthing
|
2024-03-02 17:58:30 +00:00
|
|
|
(mkIf cfg.services.syncthing.enable {
|
2024-02-29 14:53:34 +00:00
|
|
|
users.users.gremlin = {
|
|
|
|
packages = [
|
|
|
|
pkgs.syncthing
|
2024-03-02 17:58:30 +00:00
|
|
|
(mkIf cfg.services.syncthing.enableTray pkgs.syncthingtray)
|
2024-02-29 14:53:34 +00:00
|
|
|
];
|
|
|
|
};
|
|
|
|
|
|
|
|
home-manager.users.gremlin = {
|
|
|
|
# Syncthing options
|
|
|
|
services.syncthing = {
|
|
|
|
enable = true;
|
|
|
|
extraOptions = [
|
|
|
|
"--gui-address=0.0.0.0:8081"
|
2024-04-01 16:30:07 +00:00
|
|
|
"--home=${config.users.users.gremlin.home}/.config/syncthing"
|
2024-02-29 14:53:34 +00:00
|
|
|
"--no-default-folder"
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
|
|
|
# Override the default Syncthing settings so it doesn't start on boot
|
2024-03-02 17:58:30 +00:00
|
|
|
systemd.user.services."syncthing" = mkIf (!cfg.services.syncthing.autostart) {
|
2024-02-29 14:53:34 +00:00
|
|
|
Install = lib.mkForce {};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
})
|
|
|
|
];
|
|
|
|
}
|