options follow my.schema to avoid conflicts

This commit is contained in:
2024-04-19 23:19:21 -06:00
parent f1a1656155
commit 36f4b83c82
30 changed files with 1502 additions and 1657 deletions

View File

@@ -1,5 +1,6 @@
{ config, lib, pkgs, options, ... }: { { config, lib, pkgs, options, ... }: {
imports = [ ./modules/apps.nix ./modules/dev.nix ]; imports =
[ ./modules/apps.nix ./modules/dev.nix ./modules/services.nix ./jawz.nix ];
system = { system = {
copySystemConfiguration = true; copySystemConfiguration = true;
stateVersion = "23.11"; stateVersion = "23.11";

View File

@@ -24,7 +24,6 @@ in {
''download -u jawz -i "$(cat $LW | fzf --multi --exact -i)"''; ''download -u jawz -i "$(cat $LW | fzf --multi --exact -i)"'';
cp = "cp -i"; cp = "cp -i";
mv = "mv -i"; mv = "mv -i";
mkcd = ''mkdir -pv "$1" && cd "$1" || exit'';
mkdir = "mkdir -p"; mkdir = "mkdir -p";
rm = "trash"; rm = "trash";
".." = "cd .."; ".." = "cd ..";
@@ -41,21 +40,21 @@ in {
jc = "journalctl --user -xefu"; jc = "journalctl --user -xefu";
open-gallery = '' open-gallery = ''
cd /mnt/pool/scrapping/JawZ/gallery-dl && cd /mnt/pool/scrapping/JawZ/gallery-dl &&
xdg-open "$(fd . ./ Husbands -tdirectory -d 1 | fzf -i)"''; xdg-open "$(fd . ./ Husbands -tdirectory -d 1 | fzf -i)"'';
unique-extensions = '' unique-extensions = ''
fd -tf | rev | cut -d. -f1 | rev | fd -tf | rev | cut -d. -f1 | rev |
tr '[:upper:]' '[:lower:]' | sort | tr '[:upper:]' '[:lower:]' | sort |
uniq --count | sort -rn''; uniq --count | sort -rn'';
}; };
enableVteIntegration = true; enableVteIntegration = true;
initExtra = '' initExtra = ''
$HOME/.local/bin/pokemon-colorscripts -r --no-title $HOME/.local/bin/pokemon-colorscripts -r --no-title
# Lists
list_root="${config.xdg.configHome}"/jawz/lists/jawz list_root="${config.xdg.configHome}"/jawz/lists/jawz
export LW=$list_root/watch.txt export LW=$list_root/watch.txt
export LI=$list_root/instant.txt export LI=$list_root/instant.txt
export LC=$list_root/comic.txt export LC=$list_root/comic.txt
export command_timeout=30 export command_timeout=60
if command -v fzf-share >/dev/null; then if command -v fzf-share >/dev/null; then
source "$(fzf-share)/key-bindings.bash" source "$(fzf-share)/key-bindings.bash"
@@ -64,11 +63,12 @@ in {
nixos-reload () { nixos-reload () {
NIXOSDIR=/home/jawz/Development/NixOS NIXOSDIR=/home/jawz/Development/NixOS
nix-store --add-fixed sha256 $NIXOSDIR/scripts/PureRef-1.11.1_x64.Appimage nix-store --add-fixed sha256 \
nixfmt $NIXOSDIR/workstation/*.nix $NIXOSDIR/PureRef-1.11.1_x64.Appimage
fd --full-path $NIXOSDIR -e nix -x nixfmt \;
sudo unbuffer nixos-rebuild switch -I \ sudo unbuffer nixos-rebuild switch -I \
nixos-config="$NIXOSDIR/hosts/$HOSTNAME/configuration.nix" \ nixos-config="$NIXOSDIR/hosts/$HOSTNAME/configuration.nix" \
|& nom |& nom
} }
''; '';
}; };

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -10,17 +10,31 @@ in {
./hardware-configuration.nix ./hardware-configuration.nix
../../base.nix ../../base.nix
../../gnome.nix ../../gnome.nix
../../jawz.nix
../../home-manager/default.nix ../../home-manager/default.nix
../../services/network.nix # ../../services/systemd-user/tasks.nix
../../services/nvidia.nix
../../services/printing.nix
../../services/sound.nix
../../services/systemd-user/tasks.nix
../../modules/apps.nix
../../modules/dev.nix
]; ];
myGaming.enable = true; my = {
apps = {
art.enable = true;
dictionaries.enable = true;
fonts.enable = true;
gaming.enable = true;
internet.enable = true;
office.enable = true;
};
dev = {
haskell.enable = true;
nix.enable = true;
python.enable = true;
gameDev.enable = true;
};
services = {
network.enable = true;
nvidia.enable = true;
printing.enable = true;
sound.enable = true;
};
};
networking = { networking = {
hostName = "workstation"; hostName = "workstation";
@@ -66,7 +80,6 @@ in {
}; };
}; };
nixpkgs.overlays = [ (import ../../overlays/blanket.nix) ];
users = { users = {
groups.nixremote.gid = 555; groups.nixremote.gid = 555;
users = { users = {

View File

@@ -1,83 +0,0 @@
{ inputs }:
let
myLib = (import ./default.nix) { inherit inputs; };
outputs = inputs.self.outputs;
in rec {
pkgsFor = sys: inputs.nixpkgs.legacyPackages.${sys};
# ========================== Buildables ========================== #
mkSystem = config:
inputs.nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs outputs myLib; };
modules = [ config outputs.nixosModules.default ];
};
mkHome = sys: config:
inputs.home-manager.lib.homeManagerConfiguration {
pkgs = pkgsFor sys;
extraSpecialArgs = { inherit inputs myLib outputs; };
modules = [ config outputs.homeManagerModules.default ];
};
# =========================== Functions ============================ #
filesIn = dir:
(map (fileName: dir + "/${fileName}")
(builtins.attrNames (builtins.readDir dir)));
dirsIn = dir:
inputs.nixpkgs.lib.filterAttrs (name: value: value == "directory")
(builtins.readDir dir);
fileNameOf = path: (builtins.head (builtins.split "\\." (baseNameOf path)));
# ========================== Extenders =========================== #
# Evaluates nixos/home-manager module and extends it's options / config
extendModule = { path, ... }@args:
{ pkgs, ... }@margs:
let
eval = if (builtins.isString path) || (builtins.isPath path) then
import path margs
else
path margs;
evalNoImports = builtins.removeAttrs eval [ "imports" "options" ];
extra = if (builtins.hasAttr "extraOptions" args)
|| (builtins.hasAttr "extraConfig" args) then
[
({ ... }: {
options = args.extraOptions or { };
config = args.extraConfig or { };
})
]
else
[ ];
in {
imports = (eval.imports or [ ]) ++ extra;
options = if builtins.hasAttr "optionsExtension" args then
(args.optionsExtension (eval.options or { }))
else
(eval.options or { });
config = if builtins.hasAttr "configExtension" args then
(args.configExtension (eval.config or evalNoImports))
else
(eval.config or evalNoImports);
};
# Applies extendModules to all modules
# modules can be defined in the same way
# as regular imports, or taken from "filesIn"
extendModules = extension: modules:
map (f:
let name = fileNameOf f;
in (extendModule ((extension name) // { path = f; }))) modules;
# ============================ Shell ============================= #
forAllSystems = pkgs:
inputs.nixpkgs.lib.genAttrs [ "x86_64-linux" ]
(system: pkgs inputs.nixpkgs.legacyPackages.${system});
}

View File

@@ -9,11 +9,15 @@
./apps/internet.nix ./apps/internet.nix
./apps/office.nix ./apps/office.nix
]; ];
myArt.enable = lib.mkDefault false; my = {
myGameDev.enable = lib.mkDefault false; dev.gameDev.enable = lib.mkDefault false;
# myDictionaries.enable = lib.mkDefault false; apps = {
# myFonts.enable = lib.mkDefault false; art.enable = lib.mkDefault false;
myGaming.enable = lib.mkDefault false; dictionaries.enable = lib.mkDefault false;
# myInternet.enable = lib.mkDefault false; fonts.enable = lib.mkDefault false;
# myOffice.enable = lib.mkDefault false; gaming.enable = lib.mkDefault false;
internet.enable = lib.mkDefault false;
office.enable = lib.mkDefault false;
};
};
} }

View File

@@ -1,11 +1,15 @@
{ config, pkgs, lib, unstable, ... }: { config, pkgs, lib, unstable, ... }:
let
{ unstable = import
options = { (builtins.fetchTarball "https://github.com/nixos/nixpkgs/tarball/master") {
myArt.enable = lib.mkEnableOption "enable"; config = config.nixpkgs.config;
myGameDev.enable = lib.mkEnableOption "enable"; };
in {
options.my = {
apps.art.enable = lib.mkEnableOption "enable";
dev.gameDev.enable = lib.mkEnableOption "enable";
}; };
config = lib.mkIf config.myArt.enable { config = lib.mkIf config.my.apps.art.enable {
users.users.jawz.packages = with pkgs; users.users.jawz.packages = with pkgs;
([ ([
gimp # the coolest bestest art program to never exist gimp # the coolest bestest art program to never exist
@@ -16,7 +20,7 @@
# drawpile # arty party with friends!! # drawpile # arty party with friends!!
pureref # create inspiration/reference boards pureref # create inspiration/reference boards
blender # cgi animation and sculpting blender # cgi animation and sculpting
]) ++ (if config.myGameDev.enable then [ ]) ++ (if config.my.dev.gameDev.enable then [
godot_4 # game development godot_4 # game development
unstable.gdtoolkit # gdscript language server unstable.gdtoolkit # gdscript language server
] else ] else

View File

@@ -1,11 +1,14 @@
{ config, pkgs, ... }: { config, pkgs, lib, unstable, ... }:
{ {
users.users.jawz.packages = with pkgs; ([ options.my.apps.dictionaries.enable = lib.mkEnableOption "enable";
hunspell config = lib.mkIf config.my.apps.dictionaries.enable {
hunspellDicts.it_IT users.users.jawz.packages = with pkgs; ([
hunspellDicts.es_MX hunspell
hunspellDicts.es_ES hunspellDicts.it_IT
hunspellDicts.en_CA-large hunspellDicts.es_MX
]); hunspellDicts.es_ES
hunspellDicts.en_CA-large
]);
};
} }

View File

@@ -1,10 +1,13 @@
{ config, pkgs, ... }: { config, pkgs, lib, unstable, ... }:
{ {
users.users.jawz.packages = with pkgs; ([ options.my.apps.fonts.enable = lib.mkEnableOption "enable";
(nerdfonts.override { config = lib.mkIf config.my.apps.fonts.enable {
fonts = [ "CascadiaCode" "ComicShannsMono" "Iosevka" ]; users.users.jawz.packages = with pkgs; ([
}) (nerdfonts.override {
symbola fonts = [ "CascadiaCode" "ComicShannsMono" "Iosevka" ];
]); })
symbola
]);
};
} }

View File

@@ -1,14 +1,12 @@
{ config, pkgs, lib, ... }: { config, pkgs, lib, ... }:
{ {
options = { myGaming.enable = lib.mkEnableOption "enable"; }; options.my.apps.gaming.enable = lib.mkEnableOption "enable";
config = lib.mkIf config.myGaming.enable { config = lib.mkIf config.my.apps.gaming.enable {
programs = { programs.steam = {
steam = { enable = true;
enable = true; remotePlay.openFirewall = true;
remotePlay.openFirewall = true; dedicatedServer.openFirewall = true;
dedicatedServer.openFirewall = true;
};
}; };
users.users.jawz.packages = with pkgs; ([ users.users.jawz.packages = with pkgs; ([
(lutris.override { (lutris.override {

View File

@@ -1,27 +1,30 @@
{ config, pkgs, ... }: { config, pkgs, lib, unstable, ... }:
{ {
programs = { options.my.apps.internet.enable = lib.mkEnableOption "enable";
geary.enable = true; config = lib.mkIf config.my.apps.internet.enable {
firefox = { programs = {
enable = true; geary.enable = true;
languagePacks = [ "en-CA" "es-MX" "it" ]; firefox = {
enable = true;
languagePacks = [ "en-CA" "es-MX" "it" ];
};
}; };
services = { psd.enable = true; };
users.users.jawz.packages = with pkgs; ([
nextcloud-client # self-hosted google-drive alternative
fragments # beautiful torrent client
protonmail-bridge # bridge for protonmail
tor-browser-bundle-bin # dark web, so dark!
chromium # web browser with spyware included
telegram-desktop # furry chat
nicotine-plus # remember Ares?
vesktop
(pkgs.discord.override {
withOpenASAR = true;
# withVencord = true;
})
# hugo # website engine
]);
}; };
services = { psd.enable = true; };
users.users.jawz.packages = with pkgs; ([
nextcloud-client # self-hosted google-drive alternative
fragments # beautiful torrent client
protonmail-bridge # bridge for protonmail
tor-browser-bundle-bin # dark web, so dark!
chromium # web browser with spyware included
telegram-desktop # furry chat
nicotine-plus # remember Ares?
vesktop
(pkgs.discord.override {
withOpenASAR = true;
# withVencord = true;
})
# hugo # website engine
]);
} }

View File

@@ -1,13 +1,16 @@
{ config, pkgs, ... }: { config, pkgs, lib, unstable, ... }:
{ {
users.users.jawz.packages = with pkgs; ([ options.my.apps.office.enable = lib.mkEnableOption "enable";
libreoffice # office, but based config = lib.mkIf config.my.apps.office.enable {
calibre # ugly af eBook library manager users.users.jawz.packages = with pkgs; ([
newsflash # feed reader, syncs with nextcloud libreoffice # office, but based
furtherance # I packaged this one tehee track time utility calibre # ugly af eBook library manager
# foliate # gtk eBook reader newsflash # feed reader, syncs with nextcloud
# wike # gtk wikipedia wow! furtherance # I packaged this one tehee track time utility
# denaro # manage your finances # foliate # gtk eBook reader
]); # wike # gtk wikipedia wow!
# denaro # manage your finances
]);
};
} }

View File

@@ -1,55 +0,0 @@
{ lib, config, inputs, outputs, myLib, pkgs, ... }:
let cfg = config.myNixOS;
in {
options.myNixOS.home-users = lib.mkOption {
type = lib.types.attrsOf (lib.types.submodule {
options = {
userConfig = lib.mkOption {
default = ./../../home-manager/work.nix;
example = "DP-1";
};
userSettings = lib.mkOption {
default = { };
example = "{}";
};
};
});
default = { };
};
config = {
programs.zsh.enable = true;
programs.hyprland.enable = cfg.sharedSettings.hyprland.enable;
services.xserver = lib.mkIf cfg.sharedSettings.hyprland.enable {
displayManager = { defaultSession = "hyprland"; };
};
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
extraSpecialArgs = {
inherit inputs;
inherit myLib;
outputs = inputs.self.outputs;
};
users = builtins.mapAttrs (name: user:
{ ... }: {
imports =
[ (import user.userConfig) outputs.homeManagerModules.default ];
}) (config.myNixOS.home-users);
};
users.users = builtins.mapAttrs (name: user:
{
isNormalUser = true;
initialPassword = "12345";
description = "";
shell = pkgs.zsh;
extraGroups = [ "libvirtd" "networkmanager" "wheel" ];
} // user.userSettings) (config.myNixOS.home-users);
};
}

View File

@@ -2,7 +2,9 @@
{ {
imports = [ ./dev/haskell.nix ./dev/nix.nix ./dev/python.nix ]; imports = [ ./dev/haskell.nix ./dev/nix.nix ./dev/python.nix ];
myHaskell.enable = lib.mkDefault false; my.dev = {
myNix.enable = lib.mkDefault true; haskell.enable = lib.mkDefault false;
myPython.enable = lib.mkDefault false; nix.enable = lib.mkDefault false;
python.enable = lib.mkDefault false;
};
} }

View File

@@ -1,8 +1,8 @@
{ config, pkgs, lib, ... }: { config, pkgs, lib, ... }:
{ {
options = { myHaskell.enable = lib.mkEnableOption "enable"; }; options.my.dev.haskell.enable = lib.mkEnableOption "enable";
config = lib.mkIf config.myHaskell.enable { config = lib.mkIf config.my.dev.haskell.enable {
users.users.jawz.packages = with pkgs; ([ users.users.jawz.packages = with pkgs; ([
ghc # compiler ghc # compiler
haskell-language-server # lsp haskell-language-server # lsp

View File

@@ -1,8 +1,8 @@
{ config, pkgs, lib, ... }: { config, pkgs, lib, ... }:
{ {
options = { myNix.enable = lib.mkEnableOption "enable"; }; options.my.dev.nix.enable = lib.mkEnableOption "enable";
config = lib.mkIf config.myNix.enable { config = lib.mkIf config.my.dev.nix.enable {
users.users.jawz.packages = with pkgs; ([ users.users.jawz.packages = with pkgs; ([
expect # keep color when nom'ing expect # keep color when nom'ing
nix-output-monitor # autistic nix builds nix-output-monitor # autistic nix builds

View File

@@ -1,8 +1,8 @@
{ config, pkgs, lib, ... }: { config, pkgs, lib, ... }:
{ {
options = { myPython.enable = lib.mkEnableOption "enable"; }; options.my.dev.python.enable = lib.mkEnableOption "enable";
config = lib.mkIf config.myPython.enable { config = lib.mkIf config.my.dev.python.enable {
users.users.jawz.packages = with pkgs; ([ users.users.jawz.packages = with pkgs; ([
pipenv # python development workflow for humans pipenv # python development workflow for humans
(python3.withPackages (ps: (python3.withPackages (ps:

View File

@@ -1,18 +0,0 @@
{
nix.settings = {
substituters = [
"https://nix-gaming.cachix.org"
"https://nixpkgs-python.cachix.org"
"https://devenv.cachix.org"
"https://cuda-maintainers.cachix.org"
"https://ai.cachix.org"
];
trusted-public-keys = [
"nix-gaming.cachix.org-1:nbjlureqMbRAxR1gJ/f3hxemL9svXaZF/Ees8vCUUs4="
"nixpkgs-python.cachix.org-1:hxjI7pFxTyuTHn2NkvWCrAUcNZLNS3ZAvfYNuYifcEU="
"devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw="
"cuda-maintainers.cachix.org-1:0dq3bujKpuEPMCX6U4WylrUDZ9JyUG0VpVZa7CNfq5E="
"ai.cachix.org-1:N9dzRK+alWwoKXQlnn0H6aUx0lU/mspIoz8hMvGvbbc="
];
};
}

16
modules/services.nix Normal file
View File

@@ -0,0 +1,16 @@
{ config, lib, pkgs, ... }:
{
imports = [
./services/network.nix
./services/nvidia.nix
./services/printing.nix
./services/sound.nix
];
my.services = {
network.enable = lib.mkDefault false;
nvidia.enable = lib.mkDefault false;
printing.enable = lib.mkDefault false;
sound.enable = lib.mkDefault false;
};
}

View File

@@ -1,47 +0,0 @@
{ config, pkgs, lib, ... }:
with lib; {
users.users.satisfactory = {
home = "/var/lib/satisfactory";
createHome = true;
isSystemUser = true;
group = "satisfactory";
};
users.groups.satisfactory = { };
# boot.kernel.sysctl."net.ipv6.conf.eth0.disable_ipv6" = true;
networking.enableIPv6 = false;
# nixpkgs.config.allowUnfree = true;
#
networking = {
firewall = {
allowedUDPPorts = [ 15777 15000 7777 27015 ];
allowedUDPPortRanges = [{
from = 27031;
to = 27036;
}];
allowedTCPPorts = [ 27015 27036 ];
};
};
# -beta experimental \
systemd.services.satisfactory = {
preStart = ''
${pkgs.steamcmd}/bin/steamcmd \
+force_install_dir /var/lib/satisfactory/SatisfactoryServer \
+login anonymous \
+app_update 1690800 \
validate \
+quit
'';
script = ''
${pkgs.steam-run}/bin/steam-run /var/lib/satisfactory/SatisfactoryServer/FactoryServer.sh -DisablePacketRouting
'';
serviceConfig = {
Nice = "-5";
Restart = "always";
User = "satisfactory";
WorkingDirectory = "/var/lib/satisfactory";
};
};
}

View File

@@ -0,0 +1,18 @@
{ config, pkgs, lib, ... }:
{
options.my.services.network.enable = lib.mkEnableOption "enable";
config = lib.mkIf config.my.services.network.enable {
networking = {
useDHCP = lib.mkDefault true;
enableIPv6 = false;
networkmanager.enable = true;
extraHosts = ''
192.168.1.64 workstation
192.168.1.69 server
192.168.1.100 miniserver
'';
firewall = { enable = true; };
};
};
}

View File

@@ -0,0 +1,25 @@
{ config, pkgs, lib, ... }:
{
options.my.services.nvidia.enable = lib.mkEnableOption "enable";
config = lib.mkIf config.my.services.nvidia.enable {
services.xserver.videoDrivers = [ "nvidia" ];
hardware = {
opengl = {
enable = true;
driSupport = true;
driSupport32Bit = true;
extraPackages = with pkgs; [
nvidia-vaapi-driver
vaapiVdpau
libvdpau-va-gl
];
};
nvidia = {
modesetting.enable = true;
powerManagement.enable = true;
powerManagement.finegrained = false;
};
};
};
}

View File

@@ -0,0 +1,16 @@
{ config, pkgs, lib, ... }:
let printingDrivers = [ pkgs.hplip pkgs.hplipWithPlugin ];
in {
options.my.services.printing.enable = lib.mkEnableOption "enable";
config = lib.mkIf config.my.services.printing.enable {
services.printing = {
enable = true;
drivers = printingDrivers;
};
hardware.sane = {
enable = true;
extraBackends = printingDrivers;
};
users.users.jawz.packages = [ pkgs.gnome.simple-scan ];
};
}

View File

@@ -0,0 +1,27 @@
{ config, pkgs, lib, ... }:
# let
# nixGaming = import (builtins.fetchTarball
# "https://github.com/fufexan/nix-gaming/archive/master.tar.gz");
# in
{
imports = [
# nixGaming.nixosModules.pipewireLowLatency
];
options.my.services.sound.enable = lib.mkEnableOption "enable";
config = lib.mkIf config.my.services.sound.enable {
hardware.pulseaudio.enable = false;
security.rtkit.enable = true;
sound.enable = false;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
# lowLatency = {
# enable = true;
# quantum = 64;
# rate = 48000;
# };
};
};
}

View File

@@ -1,17 +0,0 @@
{ config, pkgs, lib, ... }:
{
networking = {
useDHCP = lib.mkDefault true;
enableIPv6 = false;
networkmanager.enable = true;
extraHosts = ''
192.168.1.64 workstation
192.168.1.69 server
192.168.1.100 miniserver
'';
firewall = {
enable = true;
};
};
}

View File

@@ -1,22 +0,0 @@
{ config, lib, pkgs, ... }:
{
services.xserver.videoDrivers = [ "nvidia" ];
hardware = {
opengl = {
enable = true;
driSupport = true;
driSupport32Bit = true;
extraPackages = with pkgs; [
nvidia-vaapi-driver
vaapiVdpau
libvdpau-va-gl
];
};
nvidia = {
modesetting.enable = true;
powerManagement.enable = true;
powerManagement.finegrained = false;
};
};
}

View File

@@ -1,13 +0,0 @@
{ config, lib, pkgs, ... }:
let printingDrivers = [ pkgs.hplip pkgs.hplipWithPlugin ];
in {
services.printing = {
enable = true;
drivers = printingDrivers;
};
hardware.sane = {
enable = true;
extraBackends = printingDrivers;
};
users.users.jawz.packages = [ pkgs.gnome.simple-scan ];
}

View File

@@ -1,24 +0,0 @@
{ config, lib, pkgs, ... }:
# let
# nixGaming = import (builtins.fetchTarball
# "https://github.com/fufexan/nix-gaming/archive/master.tar.gz");
# in
{
imports = [
# nixGaming.nixosModules.pipewireLowLatency
];
hardware.pulseaudio.enable = false;
security.rtkit.enable = true;
sound.enable = false;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
# lowLatency = {
# enable = true;
# quantum = 64;
# rate = 48000;
# };
};
}