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 = { services.pipewire = {
enable = true; enable = true;
alsa.enable = true; alsa.enable = true;

View file

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

View file

@ -1,4 +1,4 @@
{...}: { {lib, ...}: {
imports = [ imports = [
./audio.nix ./audio.nix
./bash.nix ./bash.nix
@ -10,4 +10,28 @@
./security.nix ./security.nix
./virt.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 = { services.xserver = {
enable = true; enable = true;
autorun = false; autorun = false;

View file

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

View file

@ -1,14 +1,14 @@
{...}: { {config, ...}: {
virtualisation.containers.enable = true; virtualisation.containers.enable = config.u.has.container;
virtualisation = { virtualisation = {
podman = { podman = {
enable = true; enable = config.u.has.container;
dockerCompat = true; dockerCompat = true;
defaultNetwork.settings.dns_enabled = true; defaultNetwork.settings.dns_enabled = true;
}; };
}; };
virtualisation.libvirtd.enable = true; virtualisation.libvirtd.enable = config.u.has.virt;
programs.virt-manager.enable = true; programs.virt-manager.enable = config.u.has.graphical && config.u.has.virt;
programs.nix-ld.enable = true; 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,
pkgs-stable, pkgs-stable,
... ...
}: { }:
lib.mkIf config.u.has.graphical {
systemd.user.targets.autostart = { systemd.user.targets.autostart = {
Unit = { Unit = {
Wants = [ Wants = [

View file

@ -7,8 +7,10 @@
./autostart.nix ./autostart.nix
./bin ./bin
./config ./config
./fhs.nix
./options.nix ./options.nix
./packages.nix ./packages.nix
./prog.nix
./share ./share
./theme.nix ./theme.nix
./xdg.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"; 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 { lib = lib.mkOption {
type = lib.types.attrs; type = lib.types.attrs;
description = "library"; description = "library";

View file

@ -1,101 +1,63 @@
{ {
config, config,
lib,
pkgs, pkgs,
pkgs-stable, pkgs-stable,
... ...
}: { }: {
home.packages = with pkgs; [ home.packages = with pkgs;
(config.u.lib.localHome pkgs.firefox-bin "firefox" "bin/firefox") [
alacritty lsd
mpv bat
(config.u.lib.fixXcursor nsxiv) zoxide
rofi fd
sct ripgrep
(config.u.lib.fixXcursor maim) fzf
xclip trash-cli
copyq tlrc
picom speedtest-cli
obs-studio unixtools.xxd
screenkey starship
pkgs-stable.safeeyes killall
snixembed file
libsForQt5.kolourpaint nix-tree
libsForQt5.filelight alejandra
papirus-icon-theme ffmpeg
lightly-boehs ffsubsync
pavucontrol unzip
qpwgraph unar
qbittorrent tmuxPlugins.vim-tmux-navigator
xournalpp tmuxPlugins.sessionist
adwaita-icon-theme ]
++ lib.optionals config.u.has.graphical [
lsd (config.u.lib.localHome pkgs.firefox-bin "firefox" "bin/firefox")
bat alacritty
zoxide mpv
fd (config.u.lib.fixXcursor nsxiv)
ripgrep rofi
fzf sct
trash-cli (config.u.lib.fixXcursor maim)
tlrc xclip
speedtest-cli copyq
bluetuith picom
unixtools.xxd obs-studio
starship screenkey
killall pkgs-stable.safeeyes
file snixembed
nix-tree libsForQt5.kolourpaint
alejandra libsForQt5.filelight
ffmpeg papirus-icon-theme
ffsubsync lightly-boehs
unzip pavucontrol
unar qpwgraph
qbittorrent
(python312.withPackages (python-pkgs: [ xournalpp
python-pkgs.pwntools adwaita-icon-theme
python-pkgs.requests bluetuith
python-pkgs.pyjwt globalprotect-openconnect
python-pkgs.flask ]
])) ++ lib.optionals config.u.has.wine [
nodejs wine
deno winetricks
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"];
}))
];
} }

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" = { xdg.desktopEntries."nsxiv-rifle" = {
exec = "nsxiv-rifle %F"; exec = "nsxiv-rifle %F";
icon = "nsxiv"; icon = "nsxiv";

View file

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

View file

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