Modularize hardware config and remove specific nix folder

This commit is contained in:
DashieTM 2024-07-20 01:56:54 +02:00
parent a5042bb645
commit 9ac5b25036
72 changed files with 322 additions and 100 deletions

82
base/base_packages.nix Normal file
View file

@ -0,0 +1,82 @@
{ pkgs, config, ... }:
{
imports = [
# is wrapped in if statement to enable when needed
../programs/gaming/default.nix
../programs/themes/stylix.nix
];
environment.systemPackages = with pkgs; [
openssl
dbus
glib
gtk4
gtk3
libadwaita
gtk-layer-shell
gtk4-layer-shell
direnv
dconf
gsettings-desktop-schemas
gnome.nixos-gsettings-overrides
bibata-cursors
xorg.xkbutils
libxkbcommon
icon-library
adwaita-icon-theme
hicolor-icon-theme
morewaita-icon-theme
kdePackages.breeze-icons
seahorse
upower
(lib.mkIf config.conf.streamdeck.enable (callPackage
../override/streamdeck.nix
{ }))
];
gtk.iconCache.enable = false;
fonts.packages = with pkgs; [
cantarell-fonts
];
nix.settings.experimental-features = "nix-command flakes";
virtualisation.docker.enable = true;
services.upower.enable = true;
services.printing.enable = true;
services.dbus.enable = true;
services.dbus.packages = with pkgs; [
gnome2.GConf
];
services.avahi = {
enable = true;
nssmdns4 = true;
openFirewall = true;
};
programs.fish.enable = true;
programs.fish.promptInit = ''
${pkgs.any-nix-shell}/bin/any-nix-shell fish --info-right | source
'';
programs.nix-ld.enable = true;
programs.nix-ld.libraries = with pkgs; [
jdk
zlib
];
programs.dconf.enable = true;
programs.direnv = {
package = pkgs.direnv;
silent = false;
loadInNixShell = true;
direnvrcExtra = "";
nix-direnv = {
enable = true;
package = pkgs.nix-direnv;
};
};
programs.ssh.startAgent = true;
programs.gnupg.agent.enable = true;
}

12
base/big_g.nix Normal file
View file

@ -0,0 +1,12 @@
{ pkgs, ... }: {
services = {
# needed for GNOME services outside of GNOME Desktop
dbus.packages = with pkgs; [
gcr
gnome.gnome-settings-daemon
];
gnome.gnome-keyring.enable = true;
gvfs.enable = true;
};
}

BIN
base/black.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 127 KiB

124
base/common_hardware.nix Normal file
View file

@ -0,0 +1,124 @@
{ pkgs, config, lib, modulesPath, ... }:
let
username = config.conf.username;
in
{
imports = [
(modulesPath + "/installer/scan/not-detected.nix")
];
# Bootloader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
# Enable networking
networking.networkmanager.enable = true;
services.flatpak.enable = true;
# Set your time zone.
time.timeZone = "Europe/Zurich";
# Select internationalisation properties.
i18n.defaultLocale = "en_US.UTF-8";
# Enable the X11 windowing system.
services.xserver.enable = true;
# Configure keymap in X11
services.xserver = {
xkb.layout = "us";
xkb.variant = "";
};
# Enable CUPS to print documents.
services.printing.enable = true;
services.printing.browsing = true;
services.printing.drivers = [ pkgs.hplip ];
services.printing.startWhenNeeded = true; # optional
services.avahi = {
enable = true;
nssmdns4 = true;
openFirewall = true;
};
# Enable sound with pipewire.
hardware.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
};
environment.variables = {
XDG_CACHE_HOME = "$HOME/.cache";
DIRENV_LOG_FORMAT = "";
};
nix.settings.trusted-users = [
username
];
boot.kernelPackages = config.conf.kernel;
boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ];
boot.kernelParams = [
"resume=\"PARTLABEL=SWAP\""
] ++ config.conf.boot_params;
networking.hostName = config.conf.hostname;
# allows user change later on
users.mutableUsers = true;
users.users.${username} = {
isNormalUser = true;
description = username;
extraGroups = [ "networkmanager" "wheel" "gamemode" "docker" "vboxusers" ];
packages = with pkgs; [
home-manager
xdg-desktop-portal-gtk
];
# this password will only last for the first login
# e.g. login, then change to whatever else, this also ensures no public hash is available
password = "firstlogin";
};
system.stateVersion = "unstable";
fileSystems."/" =
{
device = "/dev/disk/by-label/ROOT";
fsType = "btrfs";
options = [
"noatime"
"nodiratime"
"discard"
];
};
fileSystems."/boot" =
{
device = "/dev/disk/by-label/BOOT";
fsType = "vfat";
options = [ "rw" "fmask=0022" "dmask=0022" "noatime" ];
};
fileSystems."/home" =
{
device = "/dev/disk/by-label/HOME";
fsType = "btrfs";
options = [
"noatime"
"nodiratime"
"discard"
];
};
swapDevices =
[{ device = "/dev/disk/by-label/SWAP"; }];
nixpkgs.hostPlatform = lib.mkDefault config.conf.system;
hardware.cpu.${config.conf.cpu}.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
services.fstrim.enable = lib.mkDefault true;
nix.settings.auto-optimise-store = true;
networking.useDHCP = lib.mkDefault true;
}

10
base/default.nix Normal file
View file

@ -0,0 +1,10 @@
{
imports = [
./big_g.nix
./login_manager.nix
./env.nix
./xkb_layout.nix
./base_packages.nix
./common_hardware.nix
];
}

20
base/env.nix Normal file
View file

@ -0,0 +1,20 @@
{ pkgs
, config
, ...
}: {
environment.variables = {
GSETTINGS_SCHEMA_DIR = "${pkgs.glib.getSchemaPath pkgs.gsettings-desktop-schemas}";
NEOVIDE_MAXIMIZED = "0";
GPG_TTY = "$(tty)";
EDITOR = "neovide --no-fork";
SUDO_EDITOR = "neovide --no-fork";
SCRIPTS = "$HOME/.config/scripts";
};
environment.sessionVariables = {
NIXOS_OZONE_WL = "1";
GOPATH = "$HOME/.go";
FLAKE = "home/${config.conf.username}/gits/dotFiles/nix";
# don't ask... marksman somehow requires this
DOTNET_SYSTEM_GLOBALIZATION_INVARIANT = 1;
};
}

1
base/extra.nix Normal file
View file

@ -0,0 +1 @@
{ options, ... }: options.extra.extraHardwareConfig

59
base/login_manager.nix Normal file
View file

@ -0,0 +1,59 @@
{ lib
, config
, pkgs
, inputs
, ...
}:
let
username = config.conf.username;
session = {
command = "${lib.getExe inputs.hyprland.packages.${config.conf.system}.hyprland} --config /etc/greetd/hyprgreet.conf";
user = username;
};
in
{
services.xserver.displayManager.session = [
{
manage = "desktop";
name = "Hyprland";
start = ''
${lib.getExe pkgs.hyprland} & waitPID=$!
'';
}
];
# greetd display manager
programs.hyprland.enable = true;
services.greetd = {
enable = true;
settings = {
terminal.vt = 1;
default_session = session;
};
};
environment.etc."greetd/environments".text = ''
Hyprland
'';
environment.etc."greetd/hyprgreet.conf".text = ''
exec-once=gsettings set org.gnome.desktop.interface color-scheme 'prefer-dark'
monitor=${config.conf.monitor},3440x1440@180,0x0,${config.conf.scale}
monitor=_,disable
input {
force_no_accel = true
}
misc {
disable_splash_rendering = true
disable_hyprland_logo = true
}
exec-once=regreet --style /home/${username}/.config/gtk-3.0/gtk.css; hyprctl dispatch exit
'';
# unlock GPG keyring on login
security.pam.services.greetd.enableGnomeKeyring = true;
}

23
base/xkb_layout.nix Normal file
View file

@ -0,0 +1,23 @@
{ pkgs, ... }:
let
layout = pkgs.writeText "dashie" ''
xkb_symbols "dashie"
{
include "us(basic)"
include "level3(ralt_switch)"
key <AC01> { [ a, A, adiaeresis, Adiaeresis ] };
key <AD09> { [ o, O, odiaeresis, Odiaeresis ] };
key <AD07> { [ u, U, udiaeresis, Udiaeresis ] };
};
'';
in
{
environment.systemPackages = [ pkgs.xorg.xkbcomp ];
services.xserver.xkb.extraLayouts.dashie = {
description = "US layout with 'umlaut'";
languages = [ "eng" ];
symbolsFile = "${layout}";
};
}