create new versions of modules in temp dir

This commit is contained in:
NullBite 2024-02-08 13:05:53 +01:00
parent bfd40d5a1d
commit 63ffbcfe89
Signed by: nullbite
GPG Key ID: 6C4D545385D4925A
20 changed files with 555 additions and 0 deletions

View File

@ -4,6 +4,7 @@ let
in in
{ {
imports = [ imports = [
./temp-new
]; ];
config = {}; config = {};
options.nixfiles = { options.nixfiles = {

View File

@ -0,0 +1,2 @@
# system
This directory contains modules and configuration specific to my NixOS configuration. `default.nix` is the entrypoint to my module set; it can safely be loaded without making any configuration changes by default.

90
system/temp-new/base.nix Normal file
View File

@ -0,0 +1,90 @@
{ config, lib, pkgs, options, inputs, ...}@args:
let
cfg = config.nixfiles.profile.base;
in
{
options.nixfiles.profile.base = {
enable = lib.mkEnableOption "base config";
};
# TODO was gonna add something but i forgor and now i'm too lazy
# to delete this
config = lib.mkMerge [
(lib.mkIf cfg.enable {
# Enable my account
nixfiles.common.me = lib.mkDefault true;
# locale settings
i18n = {
defaultLocale = "en_US.UTF-8";
extraLocaleSettings = {
LC_ALL = "en_US.UTF-8";
};
};
# Enable flakes
nix.settings.experimental-features = ["nix-command" "flakes" ];
# fallback to building locally if binary cache fails (home-manager should be
# able to handle simple rebuilds offline)
nix.settings.fallback = true;
# Allow unfree packages
nixpkgs.config.allowUnfree = true;
# networking.hostName = "nixos"; # Define your hostname.
# Pick only one of the below networking options.
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
networking.networkmanager.enable = lib.mkDefault true; # Easiest to use and most distros use this by default.
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
neovim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
wget
curl
git
git-lfs
stow
zsh
ntfs3g
openssh
sshfs
file
fd
ripgrep
sbctl # TODO move this elsewhere
comma
nil
# network utilities
inetutils
socat
nmap
hping
# system utilities
htop
lshw
pciutils
];
# this makes comma and legacy nix utils use the flake nixpkgs for ABI
# compatibility becasue once `, vkcube` couldn't find the correct opengl
# driver or something (also it reduces the download size of temporary shell
# closures)
nix.nixPath = [ "nixpkgs=${inputs.nixpkgs}" ] ++ options.nix.nixPath.default;
programs.ssh.enableAskPassword = false;
programs.fuse.userAllowOther = true;
programs.gnupg.agent = {
enable = lib.mkDefault true;
enableSSHSupport = lib.mkDefault true;
};
boot.loader.systemd-boot.configurationLimit = lib.mkDefault 15;
})
];
}

View File

@ -0,0 +1,11 @@
{ pkgs, config, lib, options, ... }@args:
let
cfg = config.nixfiles;
in
{
imports = [
];
config = {};
options.nixfiles = {
};
}

View File

@ -0,0 +1,58 @@
{ config, lib, pkgs, outputs, ...}:
let
cfg = config.nixfiles.common.desktop;
inherit (lib) mkIf mkDefault mkForce mkEnableOption;
in
{
# imports = [
# ./base.nix
# ./fragments/sound.nix
# ./fragments/multimedia.nix
# ./fragments/software/syncthing.nix
# ./fragments/hardware/bluetooth.nix
# ];
options.nixfiles.common.desktop = {
enable = mkEnableOption "common desktop options";
};
config = mkIf cfg.enable {
# enable option sets
nixfiles = {
packageSets.multimedia.enable = true;
common = {
syncthing.enable = true;
bluetooth.enable = true;
sound.enable = true;
};
};
# Enable the X11 windowing system.
services.xserver.enable = true;
environment.systemPackages = with pkgs; [
arc-theme
wl-clipboard
];
# Enable flatpak
services.flatpak.enable = mkDefault true;
# Enable CUPS to print documents.
services.printing.enable = mkDefault true;
fonts.packages = with pkgs; [
(nerdfonts.override { fonts = [ "FiraCode" ]; })
noto-fonts-cjk
(outputs.packages.${pkgs.system}.google-fonts.override { fonts = [ "NovaSquare" ];})
];
# TODO this should be defined in home-manager or not at all probably
# FIXME also my name is hardcoded
users.users.nullbite = {
packages = with pkgs; [
firefox
];
};
};
}

View File

@ -0,0 +1,16 @@
{ config, lib, pkgs, ...}:
let
cfg = config.nixfiles.common.bluetooth;
in
{
options.nixfiles.common.bluetooth = {
enable = lib.mkEnableOption "Bluetooth";
};
config = lib.mkIf cfg.enable {
hardware.bluetooth = {
enable = lib.mkDefault true;
powerOnBoot = lib.mkDefault true;
};
};
}

View File

@ -0,0 +1,47 @@
{ config, lib, pkgs, ...}:
let
cfg = config.nixfiles.common.nvidia;
in
{
# imports = [
# ../opengl.nix
# ];
# Load nvidia driver for Xorg and Wayland
options.nixfiles.common.nvidia = {
modesetting.enable = lib.mkEnableOption "NVIDIA configuration with modesetting";
};
config = lib.mkIf cfg.modesetting.enable {
services.xserver.videoDrivers = ["nvidia"];
nixfiles.common.opengl.enable = true;
hardware.nvidia = {
# Modesetting is required.
modesetting.enable = lib.mkDefault true;
# Nvidia power management. Experimental, and can cause sleep/suspend to fail.
powerManagement.enable = lib.mkDefault false;
# Fine-grained power management. Turns off GPU when not in use.
# Experimental and only works on modern Nvidia GPUs (Turing or newer).
powerManagement.finegrained = lib.mkDefault false;
# Use the NVidia open source kernel module (not to be confused with the
# independent third-party "nouveau" open source driver).
# Support is limited to the Turing and later architectures. Full list of
# supported GPUs is at:
# https://github.com/NVIDIA/open-gpu-kernel-modules#compatible-gpus
# Only available from driver 515.43.04+
# Currently alpha-quality/buggy, so false is currently the recommended setting.
open = lib.mkDefault false;
# Enable the Nvidia settings menu,
# accessible via `nvidia-settings`.
nvidiaSettings = lib.mkDefault true;
# Optionally, you may need to select the appropriate driver version for your specific GPU.
package = lib.mkDefault config.boot.kernelPackages.nvidiaPackages.production;
};
};
}

View File

@ -0,0 +1,25 @@
{ config, lib, pkgs, ...}:
let
cfg = config.nixfiles.common.me;
in
{
options.nixfiles.common.me = lib.mkEnableOption "my user account";
config = lib.mkIf cfg.enable {
users.users.nullbite = {
isNormalUser = true;
extraGroups = [ "wheel" ];
packages = with pkgs; [
keychain
];
initialPassword = "changeme";
shell = pkgs.zsh;
};
# shell config
programs.zsh.enable = true;
programs.fzf = {
keybindings = true;
fuzzyCompletion = true;
};
};
}

View File

@ -0,0 +1,22 @@
{ config, lib, pkgs, ...}:
let
cfg = config.nixfiles.packageSets.multimedia;
inherit (lib) optionals mkEnableOption mkIf;
in
{
options.nixfiles.packageSets.multimedia = {
enable = mkEnableOption "multimedia packages";
};
config = mkIf cfg.enable {
environment.systemPackages = with pkgs; optionals config.services.xserver.enable [
mpv
gimp-with-plugins
krita
inkscape
] ++ [
yt-dlp
imagemagick
ffmpeg
];
};
}

View File

@ -0,0 +1,15 @@
{ config, lib, pkgs, ...}:
let
cfg = config.nixfiles.common.opengl;
in
{
options.nixfiles.common.opengl.enable = lib.mkEnableOption "OpenGL configuration";
config = lib.mkIf cfg.enable {
# Enable OpenGL
hardware.opengl = {
enable = true;
driSupport = lib.mkDefault true;
driSupport32Bit = lib.mkDefault config.hardware.opengl.driSupport;
};
};
}

View File

@ -0,0 +1,19 @@
{ config, lib, pkgs, ...}:
let
inherit (lib) mkEnableOption mkIf;
cfg = config.nixfiles.programs.syncthing;
in
{
options.nixfiles.programs.syncthing = {
enable = mkEnableOption "Syncthing configuration";
};
config = mkIf cfg.enable {
services.syncthing = {
enable = lib.mkDefault true;
user = lib.mkDefault "nullbite";
dataDir = lib.mkDefault "/home/nullbite/Documents";
configDir = lib.mkDefault "/home/nullbite/.config/syncthing";
};
};
}

View File

@ -0,0 +1,34 @@
{ config, lib, pkgs, ...}:
let
cfg = config.nixfiles.common.sound;
inherit (lib) mkEnableOption mkIf mkDefault;
in
{
# Enable sound.
# sound.enable = true;
# hardware.pulseaudio.enable = true;
options.nixfiles.common.sound = {
enable = mkEnableOption "sound configuration";
};
config = mkIf cfg.enable {
security.rtkit.enable = mkDefault true;
services.pipewire = {
enable = true;
alsa.enable = mkDefault true;
alsa.support32Bit = mkDefault config.services.pipewire.alsa.enable;
pulse.enable = mkDefault true;
jack.enable = mkDefault true;
};
environment.systemPackages = with pkgs; [
qpwgraph
easyeffects
] ++ optionals config.services.pipewire.pulse.enable [
pavucontrol
ncpamixer
pulsemixer
];
};
}

View File

@ -0,0 +1,40 @@
{ config, lib, pkgs, ...}:
let
cfg = config.nixfiles.packageSets.gaming;
in
{
# oopsies this is for home-manager
# programs.mangohud.enable = lib.mkDefault true;
options.nixfiles.packageSets.gaming = {
enable = lib.mkEnableOption "gaming package set";
};
config = lib.mkIf cfg.enable {
programs.steam = {
enable = lib.mkDefault true;
gamescopeSession = {
enable = lib.mkDefault true;
};
};
programs.gamemode = {
enable = lib.mkDefault true;
enableRenice = lib.mkDefault true;
};
programs.gamescope = {
enable = lib.mkDefault true;
capSysNice = lib.mkDefault false;
};
environment.systemPackages = with pkgs; [
mangohud
goverlay
prismlauncher
glxinfo
vulkan-tools
legendary-gl
heroic
];
};
}

View File

@ -0,0 +1,45 @@
{ lib, pkgs, config, ... }:
let
cfg = config.nixfiles.sessions.hyprland;
in
{
# imports = [
# ./desktop-common.nix
# # FIXME make this into an option
# ./wm-common.nix
# ];
options.nixfiles.sessions.hyprland = {
enable = lib.mkEnableOption "hyprland configuration";
};
config = lib.mkIf cfg.enable {
services.xserver.displayManager.sddm.enable = true;
programs.hyprland = {
enable = true;
# TODO base this on if nvidia is enabled
enableNvidiaPatches = lib.mkDefault true;
xwayland.enable = true;
};
xdg.portal = {
enable = true;
extraPortals = [
pkgs.xdg-desktop-portal-gtk
];
};
environment.systemPackages = with pkgs; [
kitty
dunst
polkit-kde-agent
eww
hyprpaper
rofi
hyprpicker
udiskie
polkit-kde-agent
];
};
}

View File

@ -0,0 +1,19 @@
# Fragments
These are Nix modules which aim to configure only one aspect of the system.
This can include installing and configuring single programs such as Steam,
MangoHud, Syncthing, or OpenSSH, as well as setting generic options for certain
hardware setups, such as NVIDIA PRIME Offloading.
## TODO
These are some fragments that I want to create:
- hardware/nvidia
- hardware/nvidia-supergfxd
- hardware/printing
- CUPS
- QZTray (maybe?)
- software/steam
- software/syncthing
- software/libreoffice
- software/ssh
- software/gnupg
- software/pam-gnupg (dep. software/gnupg)

View File

@ -0,0 +1,9 @@
{ config, lib, pkgs, outputs, vars, ...}@args:
{
imports = [ outputs.nixosModules.adb ];
config = {
programs.adb.enable = true;
users.users.${vars.username}.extraGroups = [ "adbusers" ];
};
}

View File

@ -0,0 +1,9 @@
{ config, lib, pkgs, ...}:
{
environment = {
enableDebugInfo = true;
systemPackages = with pkgs; [
gdb
];
};
}

View File

@ -0,0 +1,49 @@
{ config, lib, pkgs, ...}:
let
sleep = "${pkgs.coreutils}/bin/sleep";
systemctl = "${pkgs.systemd}/bin/systemctl";
inherit (lib) mkIf mkEnableOption mkForce mkDefault;
cfg = config.nixfiles.session.plasma;
in
{
# imports = [
# ./desktop-common.nix
# ];
options.nixfiles.session.plasma = {
enable = mkEnableOption "KDE Plasma session";
};
config = mkIf cfg.enable {
nixfiles.common.desktop.enable = true;
services.xserver.displayManager.sddm.enable = mkDefault true;
services.xserver.desktopManager.plasma5.enable = true;
services.xserver.displayManager.defaultSession = "plasmawayland";
programs.kdeconnect.enable = mkDefault true;
systemd.user = {
services.restart-xdg-desktop-portal-kde = {
enable = true;
description = "hack to fix xdg-desktop-portal on kde";
wantedBy = [ "graphical-session.target" ];
after = [ "plasma-core.target" "xdg-desktop-portal.service" ];
requisite = [ "plasma-core.target" ];
serviceConfig = {
ExecStart = [
"${sleep} 5"
"${systemctl} --user restart xdg-desktop-portal.service"
];
Type = "oneshot";
RemainAfterExit = "yes";
};
};
};
environment.systemPackages = with pkgs; [
# this fixes tiny file dialogs for Minecraft
libsForQt5.kdialog
];
};
}

View File

@ -0,0 +1,23 @@
{ config, lib, pkgs, ... }:
with lib; let
cfg = config.nixfiles.common.remoteAccess;
in
{
config = lib.mkIf cfg.enable {
# Enable the OpenSSH daemon.
# services.openssh.enable = true;
services.openssh = {
enable = true;
openFirewall = true;
settings = {
};
};
services.tailscale.enable = true;
networking.wireguard.enable = true;
};
options = {
nixfiles.common.remoteAccess = mkEnbaleOption "remote access options" ; };
}

View File

@ -0,0 +1,21 @@
{ pkgs, lib, config, options, ...}:
let
inherit (lib) mkDefault mkIf mkEnableOption;
cfg = config.nixfiles.common.window-manager;
in
{
config = mkIf cfg.enable {
# Common options for standalone window managers; many of these (or
# alternatives thereof) are pulled in by desktop environments.
services = {
power-profiles-daemon.enable = mkDefault true;
blueman.enable = mkDefault config.hardware.bluetooth.enable;
};
programs = {
nm-applet.enable = mkDefault config.networking.networkmanager.enable;
};
};
options = {
nixfiles.common.window-manager.enable = mkEnableOption "common window manager configuration";
};
}