Refactored this mess a bit.

This commit is contained in:
Dmitry Voronin 2024-08-02 23:45:19 +03:00
parent db77ece3c3
commit ff99cfe763
Signed by: voronind
SSH key fingerprint: SHA256:3kBb4iV2ahufEBNq+vFbUe4QYfHt98DHQjN7QaptY9k
38 changed files with 254 additions and 264 deletions

View file

@ -8,8 +8,8 @@
inherit (config.style.font) serif sansSerif monospace emoji;
sizes = {
inherit (config.style.font.size) terminal desktop;
popups = config.style.font.size.popup;
applications = config.style.font.size.application;
popups = config.style.font.size.popup;
};
};
opacity = {

View file

@ -1,6 +1,6 @@
{ container, pkgs, util, lib, config, ... } @args: with lib; let
{ container, pkgs, util, lib, config, __findFile, ... } @args: with lib; let
cfg = config.container.module.home;
package = (pkgs.callPackage ./homer args);
package = (pkgs.callPackage <package/homer> args);
in {
options = {
container.module.home = {

View file

@ -1,6 +1,6 @@
{ container, pkgsJobber, poetry2nixJobber, lib, config, ... }: with lib; let
{ container, pkgsJobber, poetry2nixJobber, lib, config, __findFile, ... }: with lib; let
cfg = config.container.module.jobber;
script = import ./jobber { poetry2nix = poetry2nixJobber; pkgs = pkgsJobber; };
script = import <package/jobber> { poetry2nix = poetry2nixJobber; pkgs = pkgsJobber; };
in {
options = {
container.module.jobber = {

View file

@ -1,6 +1,6 @@
{ pkgs, util, container, lib, config, ... } @args: with lib; let
{ pkgs, util, container, lib, config, __findFile, ... } @args: with lib; let
cfg = config.container.module.paste;
package = (pkgs.callPackage ./pastebin args);
package = (pkgs.callPackage <package/pastebin> args);
in {
options = {
container.module.paste = {

View file

@ -2,9 +2,9 @@
# ipp://192.168.2.237
# Pantum M6500W-Series
{ container, pkgs, lib, config, ... } @args: with lib; let
{ container, pkgs, lib, config, __findFile, ... } @args: with lib; let
cfg = config.container.module.print;
package = pkgs.callPackage ./print args;
package = pkgs.callPackage <package/print> args;
in {
options = {
container.module.print = {

View file

@ -238,7 +238,6 @@
# for Live ISO and Android configurations respectively.
(x86System "dasha")
(x86System "desktop")
(x86System "fsight")
(x86System "home")
(x86System "laptop")
(x86System "work")
@ -293,7 +292,13 @@
in nixpkgs.lib.foldl' (acc: h: acc // h) {} [
x86LinuxRoot
(x86LinuxHome "voronind" [
{ home.hm.packages.common.enable = true; }
{
home.hm.package = {
android.enable = true;
core.enable = true;
common.enable = true;
};
}
])
];

View file

@ -23,7 +23,7 @@ in {
config = mkIf cfg.enable {
time.timeZone = const.timeZone;
environment.packages = package.core;
environment.packages = package.core ++ package.android;
home-manager.config = stylix // {
imports = [ inputs.stylix.homeManagerModules.stylix ];
home = {

View file

@ -19,17 +19,18 @@ in {
default = "/home/${cfg.username}";
type = types.str;
};
packages = mkOption {
package = mkOption {
default = {};
type = types.submodule {
options = {
core.enable = mkEnableOption "Core apps.";
android.enable = mkEnableOption "Android apks.";
common.enable = mkEnableOption "Common apps.";
desktop.enable = mkEnableOption "Desktop apps.";
gaming.enable = mkEnableOption "Gaming apps.";
core.enable = mkEnableOption "Core apps.";
creative.enable = mkEnableOption "Creative apps.";
desktop.enable = mkEnableOption "Desktop apps.";
dev.enable = mkEnableOption "Dev apps.";
extra.enable = mkEnableOption "Extra apps.";
gaming.enable = mkEnableOption "Gaming apps.";
};
};
};
@ -48,12 +49,13 @@ in {
programs = import ./program args;
dconf.settings = util.catSet (util.ls ./config/dconf) args;
}
(mkIf cfg.packages.core.enable { home.packages = package.core; })
(mkIf cfg.packages.common.enable { home.packages = package.common; })
(mkIf cfg.packages.desktop.enable { home.packages = package.desktop; })
(mkIf cfg.packages.gaming.enable { home.packages = package.gaming; })
(mkIf cfg.packages.creative.enable { home.packages = package.creative; })
(mkIf cfg.packages.dev.enable { home.packages = package.dev; })
(mkIf cfg.packages.extra.enable { home.packages = package.extra; })
(mkIf cfg.package.android.enable { home.packages = package.android; })
(mkIf cfg.package.common.enable { home.packages = package.common; })
(mkIf cfg.package.core.enable { home.packages = package.core; })
(mkIf cfg.package.creative.enable { home.packages = package.creative; })
(mkIf cfg.package.desktop.enable { home.packages = package.desktop; })
(mkIf cfg.package.dev.enable { home.packages = package.dev; })
(mkIf cfg.package.extra.enable { home.packages = package.extra; })
(mkIf cfg.package.gaming.enable { home.packages = package.gaming; })
]);
}

View file

@ -1,13 +1,15 @@
{ ... }: {
fileSystems."/storage/hot" = {
device = "/dev/storage/hot";
fsType = "ext4";
options = [ "nofail" "noatime" ];
};
fileSystems = {
"/storage/hot" = {
device = "/dev/storage/hot";
fsType = "ext4";
options = [ "nofail" "noatime" ];
};
fileSystems."/storage/cold" = {
device = "/dev/storage/cold";
fsType = "ext4";
options = [ "nofail" "noatime" ];
"/storage/cold" = {
device = "/dev/storage/cold";
fsType = "ext4";
options = [ "nofail" "noatime" ];
};
};
}

View file

@ -9,20 +9,19 @@
module = {
amd.gpu.enable = true;
builder.client.enable = true;
desktop.sway.enable = true;
intel.cpu.enable = true;
print.enable = true;
strongswan.enable = true;
tablet.enable = true;
desktop = {
sway.enable = true;
app = {
common.enable = true;
desktop.enable = true;
gaming.enable = true;
creative.enable = true;
dev.enable = true;
extra.enable = true;
};
package = {
common.enable = true;
core.enable = true;
creative.enable = true;
desktop.enable = true;
dev.enable = true;
extra.enable = true;
gaming.enable = true;
};
};
}

View file

@ -1,19 +1,21 @@
{ ... }: {
fileSystems."/storage/hot" = {
device = "/dev/storage/hot";
fsType = "ext4";
options = [ "noatime" "nofail" ];
};
fileSystems = {
"/storage/hot" = {
device = "/dev/storage/hot";
fsType = "ext4";
options = [ "noatime" "nofail" ];
};
fileSystems."/storage/cold_1" = {
device = "/dev/storage/cold_1";
fsType = "ext4";
options = [ "noatime" "noauto" "nofail" ];
};
"/storage/cold_1" = {
device = "/dev/storage/cold_1";
fsType = "ext4";
options = [ "noatime" "noauto" "nofail" ];
};
fileSystems."/storage/cold_2" = {
device = "/dev/storage/cold_2";
fsType = "ext4";
options = [ "noatime" "noauto" "nofail" ];
"/storage/cold_2" = {
device = "/dev/storage/cold_2";
fsType = "ext4";
options = [ "noatime" "noauto" "nofail" ];
};
};
}

View file

@ -1,4 +1,4 @@
{ lib, ... }: {
{ ... }: {
imports = [
./Filesystem.nix
];
@ -8,6 +8,7 @@
module = {
builder.client.enable = true;
desktop.sway.enable = true;
ollama.enable = true;
print.enable = true;
virtmanager.enable = true;
@ -16,21 +17,19 @@
cpu.enable = true;
gpu.enable = true;
};
desktop = {
sway.enable = true;
app = {
common.enable = true;
desktop.enable = true;
creative.enable = true;
dev.enable = true;
extra.enable = true;
gaming.enable = true;
};
};
docker = {
enable = true;
autostart = false;
rootless = false;
};
package = {
common.enable = true;
core.enable = true;
creative.enable = true;
desktop.enable = true;
dev.enable = true;
extra.enable = true;
gaming.enable = true;
};
};
}

View file

@ -1,17 +0,0 @@
{ lib, ... }: {
# This host is running inside BIOS VM so it needs the Grub.
boot.loader.systemd-boot.enable = lib.mkForce false;
boot.loader.efi.canTouchEfiVariables = lib.mkForce false;
boot.loader.grub.enable = true;
boot.loader.grub.device = "/dev/sda";
boot.loader.grub.useOSProber = true;
fileSystems."/" = lib.mkForce {
device = "/dev/sda2";
fsType = "ext4";
};
fileSystems."/boot" = lib.mkForce {
device = "/dev/sda1";
fsType = "vfat";
};
}

View file

@ -1,8 +0,0 @@
{ lib, ... }: {
# Force specific PW for this host.
users.users.root.hashedPassword = lib.mkForce "$y$j9T$d4HfwutZr.eNHuLJYRuro/$7swZfgCNS6jEXHFCxsW5um/68jX9BRiiZD1BYcm/gD/";
# Allow login with PW for others.
# services.openssh.settings.PasswordAuthentication = lib.mkForce true;
# services.openssh.settings.PermitRootLogin = lib.mkForce "yes";
}

View file

@ -1,13 +0,0 @@
{ ... }: {
imports = [
./Grub.nix
./Root.nix
];
home.nixos.enable = true;
module.docker = {
enable = true;
autostart = true;
rootless = false;
};
}

View file

@ -77,9 +77,7 @@ in {
systemd.services.backup = util.mkStaticSystemdService {
enable = true;
description = "Home system backup.";
serviceConfig = {
Type = "oneshot";
};
serviceConfig.Type = "oneshot";
path = with pkgs; [
bashInteractive
curl

View file

@ -1,5 +1,5 @@
{ ... }: {
# TODO: Remove this with Fsight container.
# TODO: Remove this with Fsight container. ALSO!!! delete images and everything before that.
virtualisation.docker.enable = true;
container = {

View file

@ -1,20 +1,22 @@
{ ... }: {
fileSystems."/storage/cold_1" = {
device = "/dev/storage/cold_1";
fsType = "ext4";
options = [ "nofail" "noatime" ];
};
fileSystems = {
"/storage/cold_1" = {
device = "/dev/storage/cold_1";
fsType = "ext4";
options = [ "nofail" "noatime" ];
};
fileSystems."/storage/cold_2" = {
device = "/dev/storage/cold_2";
fsType = "ext4";
options = [ "nofail" "noatime" ];
};
"/storage/cold_2" = {
device = "/dev/storage/cold_2";
fsType = "ext4";
options = [ "nofail" "noatime" ];
};
fileSystems."/storage/hot" = {
device = "/dev/storage/hot";
fsType = "ext4";
options = [ "nofail" "noatime" ];
"/storage/hot" = {
device = "/dev/storage/hot";
fsType = "ext4";
options = [ "nofail" "noatime" ];
};
};
swapDevices = [{

View file

@ -1,11 +1,13 @@
{ ... }: {
networking.networkmanager.insertNameservers = [
"1.1.1.1"
"8.8.8.8"
];
networking.extraHosts = ''
10.1.0.2 git.voronind.com
10.1.0.2 iot.voronind.com
10.1.0.2 pass.voronind.com
'';
{ util, ... }: {
networking = {
networkmanager.insertNameservers = [
"1.1.1.1"
"8.8.8.8"
];
extraHosts = util.trimTabs ''
10.1.0.2 git.voronind.com
10.1.0.2 iot.voronind.com
10.1.0.2 pass.voronind.com
'';
};
}

View file

@ -12,19 +12,9 @@
user.voronind.enable = true;
module = {
autoupdate.enable = false;
autoupdate.enable = false;
builder.server.enable = true;
desktop = {
sway.enable = true;
app = {
common.enable = true;
desktop.enable = true;
};
};
ftpd = {
enable = true;
storage = "/storage/hot/ftp";
};
desktop.sway.enable = true;
amd = {
cpu = {
enable = true;
@ -32,5 +22,15 @@
};
gpu.enable = true;
};
ftpd = {
enable = true;
storage = "/storage/hot/ftp";
};
package = {
android.enable = true;
common.enable = true;
core.enable = true;
desktop.enable = true;
};
};
}

View file

@ -11,6 +11,7 @@
module = {
builder.client.enable = true;
desktop.sway.enable = true;
print.enable = true;
strongswan.enable = true;
tablet.enable = true;
@ -19,15 +20,13 @@
cpu.enable = true;
gpu.enable = true;
};
desktop = {
sway.enable = true;
app = {
common.enable = true;
desktop.enable = true;
gaming.enable = true;
creative.enable = true;
dev.enable = true;
};
package = {
common.enable = true;
core.enable = true;
desktop.enable = true;
gaming.enable = true;
creative.enable = true;
dev.enable = true;
};
};
}

View file

@ -3,7 +3,11 @@
fprintd
];
services.fprintd.enable = true;
services.fprintd.tod.enable = true;
services.fprintd.tod.driver = pkgs.libfprint-2-tod1-vfs0090;
services.fprintd = {
enable = true;
tod = {
enable = true;
driver = pkgs.libfprint-2-tod1-vfs0090;
};
};
}

View file

@ -11,18 +11,17 @@
module = {
builder.client.enable = true;
desktop.sway.enable = true;
intel.cpu.enable = true;
powerlimit.thinkpad.enable = true;
print.enable = true;
desktop = {
sway.enable = true;
app = {
common.enable = true;
desktop.enable = true;
gaming.enable = true;
dev.enable = true;
extra.enable = true;
};
package = {
common.enable = true;
core.enable = true;
desktop.enable = true;
dev.enable = true;
extra.enable = true;
gaming.enable = true;
};
};
}

View file

@ -1,74 +0,0 @@
{ pkgs, config, lib, __findFile, ... } @args: with lib; let
cfg = config.module.desktop.app;
package = import <package> args;
in {
options = {
module.desktop.app = {
common.enable = mkEnableOption "Common Apps.";
desktop.enable = mkEnableOption "Desktop Apps.";
gaming.enable = mkEnableOption "Gaming Apps.";
creative.enable = mkEnableOption "Creative Apps.";
dev.enable = mkEnableOption "Dev Apps.";
extra.enable = mkEnableOption "Extra Apps.";
};
};
config = mkMerge [
# Common apps.
(mkIf cfg.common.enable {
xdg.mime.defaultApplications = {
# Use `file -i file.txt` to find file mime type.
# Use `xdg-mime query default "text/plain"` to find default app.
"application/pdf" = "org.gnome.Evince.desktop";
"application/vnd.openxmlformats-officedocument.*" = "onlyoffice-desktopeditors.desktop";
"audio/*" = "mpv.desktop";
"image/*" = "org.gnome.Loupe.desktop";
"text/*" = "nvim.desktop";
"video/*" = "mpv.desktop";
};
environment.systemPackages = package.common;
services.gvfs.enable = true;
})
# Desktop apps.
(mkIf cfg.desktop.enable {
environment.systemPackages = package.desktop;
})
# Gaming.
(mkIf cfg.gaming.enable {
hardware.graphics = let
packages = with pkgs; [
dxvk
gamescope
pkgs.mangohud
vkd3d
];
in {
extraPackages = packages;
extraPackages32 = packages;
};
programs.steam.enable = true;
environment.systemPackages = package.gaming;
})
# Creative.
(mkIf cfg.creative.enable {
environment.systemPackages = package.creative;
})
# Development.
(mkIf cfg.dev.enable {
environment.systemPackages = package.dev;
})
# Extras.
(mkIf cfg.extra.enable {
environment.systemPackages = package.extra;
})
];
}

View file

@ -7,7 +7,6 @@ in {
config = mkIf cfg.enable {
module.desktop = {
app.common.enable = true;
dm.enable = true;
sound.enable = true;
wayland.enable = true;

View file

@ -1,18 +1,98 @@
{ pkgs, __findFile, ... } @args: let
{ pkgs, config, lib, __findFile, ... } @args: with lib; let
cfg = config.module.package;
package = import <package> args;
in {
environment.systemPackages = package.core;
# Special packages.
programs = {
adb.enable = true;
git.enable = true;
java = {
enable = true;
package = pkgs.corretto21;
options = {
module.package = {
android.enable = mkEnableOption "Android Apks.";
common.enable = mkEnableOption "Common Apps.";
core.enable = mkEnableOption "Core apps.";
creative.enable = mkEnableOption "Creative Apps.";
desktop.enable = mkEnableOption "Desktop Apps.";
dev.enable = mkEnableOption "Dev Apps.";
extra.enable = mkEnableOption "Extra Apps.";
gaming.enable = mkEnableOption "Gaming Apps.";
};
};
services = {
udisks2.enable = true;
};
config = mkMerge [
# Core apps.
(mkIf cfg.core.enable {
environment.systemPackages = package.core;
programs = {
adb.enable = true;
git.enable = true;
java = {
enable = true;
package = pkgs.corretto21;
};
};
services = {
udisks2.enable = true;
};
})
# Common apps.
(mkIf cfg.common.enable {
xdg.mime.defaultApplications = {
# Use `file -i file.txt` to find file mime type.
# Use `xdg-mime query default "text/plain"` to find default app.
"application/pdf" = "org.gnome.Evince.desktop";
"application/vnd.openxmlformats-officedocument.*" = "onlyoffice-desktopeditors.desktop";
"audio/*" = "mpv.desktop";
"image/*" = "org.gnome.Loupe.desktop";
"text/*" = "nvim.desktop";
"video/*" = "mpv.desktop";
};
environment.systemPackages = package.common;
services.gvfs.enable = true;
})
# Android apps.
(mkIf cfg.android.enable {
environment.systemPackages = package.android;
})
# Desktop apps.
(mkIf cfg.desktop.enable {
environment.systemPackages = package.desktop;
})
# Gaming.
(mkIf cfg.gaming.enable {
hardware.graphics = let
packages = with pkgs; [
dxvk
gamescope
pkgs.mangohud
vkd3d
];
in {
extraPackages = packages;
extraPackages32 = packages;
};
programs.steam.enable = true;
environment.systemPackages = package.gaming;
})
# Creative.
(mkIf cfg.creative.enable {
environment.systemPackages = package.creative;
})
# Development.
(mkIf cfg.dev.enable {
environment.systemPackages = package.dev;
})
# Extras.
(mkIf cfg.extra.enable {
environment.systemPackages = package.extra;
})
];
}

View file

@ -9,7 +9,6 @@ in {
config = mkIf cfg.enable {
module.desktop = {
app.common.enable = true;
bluetooth.enable = true;
brightness.enable = true;
portal.enable = true;

View file

@ -3,20 +3,28 @@
android-tools # Android adb tool. Can be used to connect to itself via wireless debugging.
binwalk # Can analyze files for other files inside them.
btop htop # System monitors.
coreutils # UNIX Core utilities.
cryptsetup # Filesystem encryption (LUKS).
curl # CLI http client.
ddrescue testdisk # Apps to recover data from drives.
diffutils # Diff tool.
dnsutils # NS utilities.
exiftool # Image info.
fastfetch # Systeminfo summary.
ffmpeg # Video/audio converter.
file # Get general info about a file.
findutils # Find tool.
gawk # Awk.
gcc # C compiler.
gdu # TUI storage analyzer.
git # Version control system.
gnugrep # Grep.
gnumake # Make.
gnused # Sed.
gnutar gzip xz # Archive and compression tools.
gparted parted # GUI/CLI disk partition tool.
imagemagick # Image converter and transformation tool.
inetutils # Things like FTP.
iputils # IP tools.
jq # Json parser.
lm_sensors # Hardware sensors, like temperature and fan speeds.
lshw # Detailed hardware info tool.
@ -26,12 +34,12 @@
neovim # Text editor.
nixd # Nix LSP.
nmap # Network analyzer.
ollama # LLMs.
openssh sshfs # Ssh client.
parallel # Run programs in parallel.
parted gparted # GUI/CLI disk partition tool.
pv # IO progress bar.
radare2 # Hex editor.
ripgrep # Grep for file search.
ripgrep # Better grep.
rsync # File copy tool.
scanmem # Memory edit tool.
smartmontools # S.M.A.R.T. tools.
@ -44,16 +52,12 @@
wget # CLI http download tool.
wireguard-tools # Tools to work with Wireguard.
yazi chafa # CLI file manager.
yt-dlp # Video downloader.
zapret # FRKN.
zip unzip # Zip archive/unarchive tools.
coreutils dnsutils diffutils findutils utillinux # Common utilities.
gawk gnused gnugrep gnumake ripgrep # Common Gnu utils.
(pkgs.callPackage ./apks {})
(pkgs.callPackage ./yamusicdownload {})
# (pkgs.callPackage ./ytdlp {})
yt-dlp
];
desktop = with pkgs; [
@ -100,12 +104,19 @@
jetbrains.idea-community
];
android = [
(pkgs.callPackage ./apks {})
];
extra = with pkgs; [
anilibria-winmaclinux # Anime!
appimage-run # Tool to run .AppImage files in NixOS.
blanket # Sounds generator.
calibre # Book library manager.
cbonsai cmatrix # CLI Screensavers.
cowsay lolcat # CLI funni.
gnome-font-viewer # Font viewer.
ollama # LLMs.
tor-browser # Privacy browser.
universal-android-debloater # Debloat Android devices.
];