add options

This commit is contained in:
caandt 2024-12-22 23:46:42 -05:00
parent c7d8dcbdf6
commit f28d3ea99d
16 changed files with 209 additions and 119 deletions

View file

@ -1,4 +1,9 @@
{...}: {
{
config,
lib,
...
}:
lib.mkIf config.u.has.graphical {
services.pipewire = {
enable = true;
alsa.enable = true;

View file

@ -12,7 +12,6 @@
environment.pathsToLink = ["/libexec"];
environment.localBinInPath = true;
services.globalprotect.enable = true;
boot.tmp.useTmpfs = true;
@ -33,9 +32,10 @@
documentation.dev.enable = true;
xdg.terminal-exec = {
enable = true;
enable = config.u.has.graphical;
settings.default = ["Alacritty.desktop"];
};
services.globalprotect.enable = config.u.has.graphical;
environment.etc."ssh/ssh_config".text = lib.mkAfter "Include /home/*/.local/ssh/config";

View file

@ -1,4 +1,4 @@
{...}: {
{lib, ...}: {
imports = [
./audio.nix
./bash.nix
@ -10,4 +10,28 @@
./security.nix
./virt.nix
];
options.u = {
has = {
graphical = lib.mkOption {
type = lib.types.bool;
description = "enable graphical settings";
default = true;
};
wine = lib.mkOption {
type = lib.types.bool;
description = "enable wine settings";
default = true;
};
virt = lib.mkOption {
type = lib.types.bool;
description = "enable virt settings";
default = true;
};
container = lib.mkOption {
type = lib.types.bool;
description = "enable container settings";
default = true;
};
};
};
}

View file

@ -1,4 +1,10 @@
{pkgs, ...}: {
{
config,
lib,
pkgs,
...
}:
lib.mkIf config.u.has.graphical {
services.xserver = {
enable = true;
autorun = false;

View file

@ -1,10 +1,15 @@
{pkgs, ...}: {
{
config,
lib,
pkgs,
...
}: {
i18n.defaultLocale = "en_US.UTF-8";
i18n.supportedLocales = [
"en_US.UTF-8/UTF-8"
"ja_JP.UTF-8/UTF-8"
];
i18n.inputMethod = {
i18n.inputMethod = lib.mkIf config.u.has.graphical {
enable = true;
type = "fcitx5";
fcitx5.addons = with pkgs; [
@ -12,11 +17,12 @@
fcitx5-gtk
];
};
fonts.packages = with pkgs; [
noto-fonts
noto-fonts-cjk-sans
source-han-sans
source-han-serif
nerd-fonts.jetbrains-mono
];
fonts.packages = with pkgs;
lib.optionals config.u.has.graphical [
noto-fonts
noto-fonts-cjk-sans
source-han-sans
source-han-serif
nerd-fonts.jetbrains-mono
];
}

View file

@ -1,4 +1,10 @@
{pkgs, ...}: {
{
config,
lib,
pkgs,
...
}:
lib.mkIf config.u.has.graphical {
programs.partition-manager = {
enable = true;
package = pkgs.libsForQt5.partitionmanager;

View file

@ -1,14 +1,14 @@
{...}: {
virtualisation.containers.enable = true;
{config, ...}: {
virtualisation.containers.enable = config.u.has.container;
virtualisation = {
podman = {
enable = true;
enable = config.u.has.container;
dockerCompat = true;
defaultNetwork.settings.dns_enabled = true;
};
};
virtualisation.libvirtd.enable = true;
programs.virt-manager.enable = true;
virtualisation.libvirtd.enable = config.u.has.virt;
programs.virt-manager.enable = config.u.has.graphical && config.u.has.virt;
programs.nix-ld.enable = true;
hardware.graphics.enable32Bit = true;
hardware.graphics.enable32Bit = config.u.has.graphical && config.u.has.wine;
}

View file

@ -1,8 +1,11 @@
{
config,
lib,
pkgs,
pkgs-stable,
...
}: {
}:
lib.mkIf config.u.has.graphical {
systemd.user.targets.autostart = {
Unit = {
Wants = [

View file

@ -7,8 +7,10 @@
./autostart.nix
./bin
./config
./fhs.nix
./options.nix
./packages.nix
./prog.nix
./share
./theme.nix
./xdg.nix

18
user/fhs.nix Normal file
View file

@ -0,0 +1,18 @@
{pkgs, ...}: let
base = pkgs.appimageTools.defaultFhsEnvArgs;
fhs = {
name = "fhs";
targetPkgs = pkgs:
(base.targetPkgs pkgs)
++ [
pkgs.pkg-config
pkgs.ncurses
];
profile = "export FHS=1";
runScript = "bash";
extraOutputsToInstall = ["dev"];
};
fhsenv = pkgs.buildFHSUserEnv (base // fhs);
in {
home.packages = [fhsenv];
}

View file

@ -43,6 +43,23 @@
});
description = "list of file manager bookmarks";
};
has = {
graphical = lib.mkOption {
type = lib.types.bool;
description = "enable graphical settings";
default = true;
};
wine = lib.mkOption {
type = lib.types.bool;
description = "enable wine settings";
default = true;
};
prog = lib.mkOption {
type = lib.types.bool;
description = "enable prog settings";
default = true;
};
};
lib = lib.mkOption {
type = lib.types.attrs;
description = "library";

View file

@ -1,101 +1,63 @@
{
config,
lib,
pkgs,
pkgs-stable,
...
}: {
home.packages = with pkgs; [
(config.u.lib.localHome pkgs.firefox-bin "firefox" "bin/firefox")
alacritty
mpv
(config.u.lib.fixXcursor nsxiv)
rofi
sct
(config.u.lib.fixXcursor maim)
xclip
copyq
picom
obs-studio
screenkey
pkgs-stable.safeeyes
snixembed
libsForQt5.kolourpaint
libsForQt5.filelight
papirus-icon-theme
lightly-boehs
pavucontrol
qpwgraph
qbittorrent
xournalpp
adwaita-icon-theme
lsd
bat
zoxide
fd
ripgrep
fzf
trash-cli
tlrc
speedtest-cli
bluetuith
unixtools.xxd
starship
killall
file
nix-tree
alejandra
ffmpeg
ffsubsync
unzip
unar
(python312.withPackages (python-pkgs: [
python-pkgs.pwntools
python-pkgs.requests
python-pkgs.pyjwt
python-pkgs.flask
]))
nodejs
deno
gnumake
coq
coqPackages.coqide
gcc
sqlitebrowser
globalprotect-openconnect
tmuxPlugins.vim-tmux-navigator
tmuxPlugins.sessionist
wine
winetricks
cage
gdb
pwndbg
(pkgs-stable.cutter.withPlugins (ps: with ps; [jsdec rz-ghidra sigdb]))
ghidra-bin
pwninit
patchelf
(let
base = pkgs.appimageTools.defaultFhsEnvArgs;
in
pkgs.buildFHSUserEnv (base
// {
name = "fhs";
targetPkgs = pkgs:
(base.targetPkgs pkgs)
++ (
with pkgs; [
pkg-config
ncurses
]
);
profile = "export FHS=1";
runScript = "bash";
extraOutputsToInstall = ["dev"];
}))
];
home.packages = with pkgs;
[
lsd
bat
zoxide
fd
ripgrep
fzf
trash-cli
tlrc
speedtest-cli
unixtools.xxd
starship
killall
file
nix-tree
alejandra
ffmpeg
ffsubsync
unzip
unar
tmuxPlugins.vim-tmux-navigator
tmuxPlugins.sessionist
]
++ lib.optionals config.u.has.graphical [
(config.u.lib.localHome pkgs.firefox-bin "firefox" "bin/firefox")
alacritty
mpv
(config.u.lib.fixXcursor nsxiv)
rofi
sct
(config.u.lib.fixXcursor maim)
xclip
copyq
picom
obs-studio
screenkey
pkgs-stable.safeeyes
snixembed
libsForQt5.kolourpaint
libsForQt5.filelight
papirus-icon-theme
lightly-boehs
pavucontrol
qpwgraph
qbittorrent
xournalpp
adwaita-icon-theme
bluetuith
globalprotect-openconnect
]
++ lib.optionals config.u.has.wine [
wine
winetricks
];
}

32
user/prog.nix Normal file
View file

@ -0,0 +1,32 @@
{
config,
lib,
pkgs,
...
}:
lib.mkIf config.u.has.prog {
home.packages = with pkgs;
[
(python312.withPackages (python-pkgs: [
python-pkgs.pwntools
python-pkgs.requests
python-pkgs.pyjwt
python-pkgs.flask
]))
nodejs
deno
gnumake
coq
coqPackages.coqide
gcc
gdb
pwndbg
pwninit
patchelf
]
++ lib.optionals config.u.has.graphical [
(cutter.withPlugins (ps: with ps; [jsdec rz-ghidra sigdb]))
ghidra-bin
sqlitebrowser
];
}

View file

@ -1,4 +1,9 @@
{...}: {
{
config,
lib,
...
}:
lib.mkIf config.u.has.graphical {
xdg.desktopEntries."nsxiv-rifle" = {
exec = "nsxiv-rifle %F";
icon = "nsxiv";

View file

@ -1,8 +1,10 @@
{
config,
lib,
pkgs,
...
}: {
}:
lib.mkIf config.u.has.graphical {
qt = {
enable = true;
platformTheme.name = "qtct";

View file

@ -1,8 +1,10 @@
{
config,
lib,
pkgs,
...
}: {
}:
lib.mkIf config.u.has.graphical {
xdg.mimeApps.enable = true;
xdg.mimeApps.defaultApplications = let
image = "nsxiv-rifle.desktop";