System/home-manager/linux/default.nix

143 lines
4.8 KiB
Nix

{ config, lib, pkgs, inputs, ... }:
let
inherit (import ../../modules/lib.nix {
inherit lib;
inherit pkgs;
})
nLib;
in with lib;
with nLib; {
imports = [
../options.nix
../common/programs/core.nix
../common/programs/devel.nix
../common/programs/terminal.nix
../common/programs/git.nix
../common/programs/ssh.nix
../common/programs/fish.nix
./programs/hyprland.nix
./programs/communications.nix
./programs/devel.nix
./programs/emacs.nix
./programs/image-editing.nix
./programs/media.nix
./programs/wine.nix
./programs/gpg.nix
./programs/games.nix
./services/syncthing.nix
./services/email.nix
];
options = {
nathan = {
# Services, these are platform specific so they go here
services = {
# Synthing, enabled by default on linux desktop
syncthing = mkDefaultOption "Syncthing"
(config.nathan.config.isDesktop && pkgs.stdenv.isLinux);
# Email syncing
# Disabled by default since this requires manual setup on the machine
# TODO: Get this working on darwin
email = { enable = mkEnableOption "Email"; };
};
# Configuration for linux specific options
config = {
# Generic desktop components
desktop = {
fuzzel-command = mkOption {
description = "Fuzzel command";
default = ''
fuzzel -f "Iosevka Sans Quasi:size=16" -b "181818cc" -S "b9b9b9ff" -s "252525cc" -t "777777ff" -B 5 -r 5 -C "70b433cc" --width=80 --lines=25'';
};
targets = mkOption {
description = "Targets to install desktop services to";
default = [ "graphical-session.target" ];
};
swaylock = {
package = mkOption {
description = "Swaylock package to use";
default =
inputs.nixpkgs-unstable.legacyPackages.${pkgs.system}.swaylock-effects;
};
command = mkOption {
description = "Swaylock package to use";
default = ''
--screenshots --grace 30 --indicator --clock --timestr "%-I:%M:%S %p" --datestr "%A %Y-%M-%d" --effect-blur 20x3'';
};
};
};
};
# Linux specific programs
programs = {
util = {
# Wine support, disabled by default
wine = mkEnableOption "wine";
# GPG support, enabled by default on desktop
gpg = mkEnableOptionT "gpg";
};
devel = {
jvm = mkDefaultOption "JVM Development Utilites"
config.nathan.config.isDesktop;
};
# Install games
games = { launcher = mkEnableOption "Game launcher"; };
# Hyprland and supporting application configuration
hyprland = {
enable = mkDefaultOption "hyprland" config.nathan.config.isDesktop;
};
# Alacritty, follows sway
alacritty =
mkDefaultOption "alacritty" config.nathan.programs.hyprland.enable;
# Communications applications
communications = {
# Enable by default if we are on a linux desktop
enable = mkDefaultOption "Communication applications"
(config.nathan.config.isDesktop && pkgs.stdenv.isLinux);
};
# Image editing software, on by default on desktop
image-editing = mkDefaultOption "Image Editing Software"
config.nathan.config.isDesktop;
# Media appilcations, on by default on linux desktop
media = {
enable = mkDefaultOption "Media Applications"
(config.nathan.config.isDesktop && pkgs.stdenv.isLinux);
nicotineService = mkDefaultOption "Nicotine service" false;
mopidyExtraConfig = mkOption {
description = "Extra config files for mopidy";
default = [ ];
};
};
# Firefox, enabled by default on linux desktop
firefox = mkDefaultOption "Firefox"
(config.nathan.config.isDesktop && pkgs.stdenv.isLinux);
};
};
};
config = {
programs.command-not-found.enable = true;
home.stateVersion = "22.05";
programs.home-manager.enable = true;
programs.firefox = {
enable = config.nathan.programs.firefox;
package = pkgs.firefox-beta-bin;
};
nathan.programs.emacs.package =
lib.mkDefault inputs.emacs.packages."${pkgs.system}".emacsUnstablePgtk;
# We should be managing xdg stuff
xdg = {
enable = true;
# Manage mime associations
mime.enable = true;
mimeApps = {
enable = true;
# Set firefox as the default browser
defaultApplications = {
"x-scheme-handler/https" = [ "firefox.desktop" ];
"x-scheme-handler/http" = [ "firefox.desktop" ];
};
};
};
};
}