245 lines
7.1 KiB
Nix
245 lines
7.1 KiB
Nix
{
|
|
lib,
|
|
config,
|
|
pkgs,
|
|
...
|
|
}:
|
|
with lib;
|
|
let
|
|
fhsEnv =
|
|
let
|
|
base = pkgs.appimageTools.defaultFhsEnvArgs;
|
|
in
|
|
pkgs.buildFHSEnv (
|
|
base
|
|
// {
|
|
name = "fhs";
|
|
targetPkgs =
|
|
pkgs:
|
|
(base.targetPkgs pkgs)
|
|
++ (with pkgs; [
|
|
pkg-config
|
|
ncurses
|
|
icu
|
|
]);
|
|
profile = "export FHS=1";
|
|
runScript = "bash";
|
|
extraOutputsToInstall = [ "dev" ];
|
|
}
|
|
);
|
|
in
|
|
{
|
|
options.features.base = {
|
|
enable = mkEnableOption "enable shared base programs";
|
|
preset = mkOption {
|
|
type = types.enum [
|
|
"minimal"
|
|
"standard"
|
|
"full"
|
|
];
|
|
default = "standard";
|
|
description = "Preset for desktop package groups.";
|
|
};
|
|
udevEnable = mkOption {
|
|
type = types.bool;
|
|
default = true;
|
|
description = "Enable custom udev rules and device packages.";
|
|
};
|
|
mimeEnable = mkOption {
|
|
type = types.bool;
|
|
default = true;
|
|
description = "Enable Home Manager MIME defaults.";
|
|
};
|
|
packages = {
|
|
communicationEnable = mkOption {
|
|
type = types.bool;
|
|
default = true;
|
|
description = "Install communication desktop apps.";
|
|
};
|
|
mediaEnable = mkOption {
|
|
type = types.bool;
|
|
default = true;
|
|
description = "Install media apps.";
|
|
};
|
|
browsersEnable = mkOption {
|
|
type = types.bool;
|
|
default = true;
|
|
description = "Install browsers.";
|
|
};
|
|
captureEnable = mkOption {
|
|
type = types.bool;
|
|
default = true;
|
|
description = "Install screen capture tools.";
|
|
};
|
|
creativeEnable = mkOption {
|
|
type = types.bool;
|
|
default = true;
|
|
description = "Install conversion/creative tools.";
|
|
};
|
|
devDesktopEnable = mkOption {
|
|
type = types.bool;
|
|
default = true;
|
|
description = "Install desktop dev helper tools and VMs.";
|
|
};
|
|
dbeaverEnable = mkOption {
|
|
type = types.bool;
|
|
default = true;
|
|
description = "Install dbeaver and FHS shell.";
|
|
};
|
|
};
|
|
};
|
|
|
|
config = mkMerge [
|
|
(mkIf (config.features.base.preset == "minimal") {
|
|
features.base.packages.communicationEnable = mkDefault false;
|
|
features.base.packages.mediaEnable = mkDefault false;
|
|
features.base.packages.browsersEnable = mkDefault true;
|
|
features.base.packages.captureEnable = mkDefault false;
|
|
features.base.packages.creativeEnable = mkDefault false;
|
|
features.base.packages.devDesktopEnable = mkDefault false;
|
|
features.base.packages.dbeaverEnable = mkDefault false;
|
|
})
|
|
|
|
(mkIf (config.features.base.preset == "full") {
|
|
features.base.packages.communicationEnable = mkDefault true;
|
|
features.base.packages.mediaEnable = mkDefault true;
|
|
features.base.packages.browsersEnable = mkDefault true;
|
|
features.base.packages.captureEnable = mkDefault true;
|
|
features.base.packages.creativeEnable = mkDefault true;
|
|
features.base.packages.devDesktopEnable = mkDefault true;
|
|
features.base.packages.dbeaverEnable = mkDefault true;
|
|
})
|
|
|
|
(mkIf config.features.base.enable {
|
|
services.udev = mkIf config.features.base.udevEnable {
|
|
extraRules = ''
|
|
KERNEL=="ttyACM0", MODE:="666"
|
|
ACTION=="add", KERNEL=="sd[a-e][0-9]", ENV{ID_FS_UUID}=="3039-3932", RUN+="${pkgs.systemd}/bin/systemd-mount --no-block -A -G -o gid=users,fmask=113,dmask=002 /dev/%k /mnt/sdcard"
|
|
ACTION=="add", KERNEL=="sd[a-e]", ENV{ID_FS_UUID}=="66BA-4EBA", RUN+="${pkgs.systemd}/bin/systemd-mount --no-block -A -G -o gid=users,fmask=113,dmask=002 /dev/%k /mnt/kobo"
|
|
KERNEL=="uinput", GROUP="input", MODE="0660", OPTIONS+="static_node=uinput"
|
|
'';
|
|
packages = with pkgs; [
|
|
vial
|
|
via
|
|
];
|
|
};
|
|
|
|
home-manager.users.fw = mkIf config.features.base.mimeEnable {
|
|
xdg.mimeApps = {
|
|
enable = true;
|
|
defaultApplications = {
|
|
"text/html" = "librewolf.desktop";
|
|
"x-scheme-handler/http" = "librewolf.desktop";
|
|
"x-scheme-handler/https" = "librewolf.desktop";
|
|
"x-scheme-handler/about" = "librewolf.desktop";
|
|
"x-scheme-handler/unknown" = "librewolf.desktop";
|
|
"text/plain" = "nvim.desktop";
|
|
"text/markdown" = "nvim.desktop";
|
|
"text/x-markdown" = "nvim.desktop";
|
|
"application/json" = "nvim.desktop";
|
|
"application/x-ndjson" = "nvim.desktop";
|
|
"application/x-yaml" = "nvim.desktop";
|
|
"text/yaml" = "nvim.desktop";
|
|
"text/x-shellscript" = "nvim.desktop";
|
|
"text/x-python" = "nvim.desktop";
|
|
"text/x-csrc" = "nvim.desktop";
|
|
"text/x-c++src" = "nvim.desktop";
|
|
"application/x-sql" = "nvim.desktop";
|
|
"text/xml" = "nvim.desktop";
|
|
"application/xml" = "nvim.desktop";
|
|
"application/pdf" = "org.gnome.Evince.desktop";
|
|
"image/jpeg" = "feh.desktop";
|
|
"image/png" = "feh.desktop";
|
|
"image/gif" = "feh.desktop";
|
|
"image/webp" = "feh.desktop";
|
|
"image/tiff" = "feh.desktop";
|
|
"image/bmp" = "feh.desktop";
|
|
"image/svg+xml" = "feh.desktop";
|
|
};
|
|
};
|
|
};
|
|
|
|
environment.sessionVariables.DEFAULT_BROWSER = "${pkgs.librewolf}/bin/librewolf";
|
|
|
|
environment.systemPackages =
|
|
(with pkgs; [
|
|
codex
|
|
ipcalc
|
|
remmina
|
|
brightnessctl
|
|
speedcrunch
|
|
lagrange
|
|
jujutsu
|
|
rclone
|
|
zathura
|
|
feh
|
|
pavucontrol
|
|
pulseaudio
|
|
devour
|
|
caligula
|
|
ptouch-print
|
|
])
|
|
++ optionals config.features.base.packages.communicationEnable (
|
|
with pkgs;
|
|
[
|
|
signal-desktop
|
|
thunderbird
|
|
discord
|
|
slack
|
|
]
|
|
)
|
|
++ optionals config.features.base.packages.mediaEnable (
|
|
with pkgs;
|
|
[
|
|
feishin
|
|
spotify
|
|
mpv
|
|
]
|
|
)
|
|
++ optionals config.features.base.packages.browsersEnable (
|
|
with pkgs;
|
|
[
|
|
librewolf
|
|
firefox
|
|
]
|
|
)
|
|
++ optionals config.features.base.packages.captureEnable (
|
|
with pkgs;
|
|
[
|
|
wf-recorder
|
|
slurp
|
|
]
|
|
)
|
|
++ optionals config.features.base.packages.creativeEnable (
|
|
with pkgs;
|
|
[
|
|
yt-dlp
|
|
imagemagick
|
|
pandoc
|
|
pinta
|
|
pastel
|
|
ffmpeg
|
|
]
|
|
)
|
|
++ optionals config.features.base.packages.devDesktopEnable (
|
|
with pkgs;
|
|
[
|
|
vscode
|
|
opencode
|
|
quickemu
|
|
virt-viewer
|
|
go-passbolt-cli
|
|
bitwarden-desktop
|
|
bitwarden-cli
|
|
]
|
|
)
|
|
++ optionals config.features.base.packages.dbeaverEnable (
|
|
with pkgs;
|
|
[
|
|
dbeaver-bin
|
|
fhsEnv
|
|
]
|
|
);
|
|
})
|
|
];
|
|
}
|