This commit is contained in:
Hadi
2024-06-14 10:00:54 +02:00
parent 70a3473916
commit aae1271cf0
117 changed files with 616 additions and 1461 deletions

View File

@@ -1,18 +1,14 @@
{ pkgs, config, ... }:
let
variable = import ../../variables.nix;
baseImports = [ ./hardware-configuration.nix ];
extraImports = [
(if variable.enableNvidia then ./nvidia.nix else null)
(if variable.enablePrime then ./prime.nix else null)
{ pkgs, config, ... }: {
imports = [
./hardware-configuration.nix
../shared/fonts.nix
# ../shared/nvidia.nix
# ../shared/prime.nix
../shared/testnvidia.nix
../shared/tuigreet.nix
./variables.nix
];
filteredImports = builtins.filter (x: x != null) extraImports;
in {
imports = baseImports ++ filteredImports;
# Bootloader.
boot = {
loader.efi.canTouchEfiVariables = true;
@@ -21,42 +17,48 @@ in {
consoleMode = "auto";
};
tmp.cleanOnBoot = true;
kernelPackages =
pkgs.linuxPackages_latest; # _zen, _hardened, _rt, _rt_latest, etc.
};
# Networking
networking.networkmanager.enable = true;
networking.hostName = config.var.hostname;
networking.hostName = variable.hostName;
time.timeZone = variable.timeZone;
i18n.defaultLocale = variable.defaultLocale;
# Timezone and locale
time.timeZone = config.var.timeZone;
i18n.defaultLocale = config.var.defaultLocale;
i18n.extraLocaleSettings = {
LC_ADDRESS = variable.extraLocale;
LC_IDENTIFICATION = variable.extraLocale;
LC_MEASUREMENT = variable.extraLocale;
LC_MONETARY = variable.extraLocale;
LC_NAME = variable.extraLocale;
LC_NUMERIC = variable.extraLocale;
LC_PAPER = variable.extraLocale;
LC_TELEPHONE = variable.extraLocale;
LC_TIME = variable.extraLocale;
LC_ADDRESS = config.var.extraLocale;
LC_IDENTIFICATION = config.var.extraLocale;
LC_MEASUREMENT = config.var.extraLocale;
LC_MONETARY = config.var.extraLocale;
LC_NAME = config.var.extraLocale;
LC_NUMERIC = config.var.extraLocale;
LC_PAPER = config.var.extraLocale;
LC_TELEPHONE = config.var.extraLocale;
LC_TIME = config.var.extraLocale;
};
users.users.${variable.username} = {
# Users
users.users.${config.var.username} = {
isNormalUser = true;
description = "${variable.username} account";
description = "${config.var.username} account";
extraGroups = [ "networkmanager" "wheel" ];
};
services = {
xserver = {
xkb.layout = variable.keyboardLayout;
enable = true;
xkb.layout = config.var.keyboardLayout;
xkb.variant = "";
};
blueman.enable = true;
gnome.gnome-keyring.enable = true;
};
console.keyMap = variable.keyboardLayout;
console.keyMap = config.var.keyboardLayout;
# Shell
programs.zsh = {
enable = true;
loginShellInit = ''
@@ -65,24 +67,6 @@ in {
};
users.defaultUserShell = pkgs.zsh;
# faster rebuilding
documentation = {
enable = true;
doc.enable = false;
man.enable = true;
dev.enable = false;
};
# Allow unfree packages
nixpkgs.config.allowUnfree = true;
environment.systemPackages = with pkgs; [ networkmanagerapplet ];
nixpkgs.config.permittedInsecurePackages = [
"electron-25.9.0"
"nix-2.16.2"
]; # TODO: Remove this if not needed anymore
hardware.bluetooth = {
enable = true;
powerOnBoot = true;
@@ -118,8 +102,12 @@ in {
settings = {
auto-optimise-store = true;
experimental-features = [ "nix-command" "flakes" ];
substituters = [ "https://hyprland.cachix.org" ];
trusted-public-keys = [
"hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="
];
};
gc = if variable.enableAutoGarbageCollector then {
gc = if config.var.autoGarbageCollector then {
automatic = true;
persistent = true;
dates = "weekly";
@@ -128,22 +116,37 @@ in {
{ };
};
system.autoUpgrade = if variable.enableAutoUpgrade then {
nixpkgs.config.allowUnfree = true;
environment.systemPackages = with pkgs; [ networkmanagerapplet ];
nixpkgs.config.permittedInsecurePackages = [ "electron-25.9.0" ];
system.autoUpgrade = if config.var.autoUpgrade then {
enable = true;
dates = "04:00";
flake = "${config.users.users.${variable.username}.home}/.config/nixos";
flake = "${config.users.users.${config.var.username}.home}/.config/nixos";
flags = [ "--update-input" "nixpkgs" "--commit-lock-file" ];
allowReboot = false;
} else
{ };
nix.settings = {
substituters = [ "https://hyprland.cachix.org" ];
trusted-public-keys =
[ "hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc=" ];
xdg.portal = {
enable = true;
configPackages = with pkgs; [ xdg-desktop-portal-gtk ];
};
services.libinput.enable = true;
programs.dconf.enable = true;
# Faster rebuilding
documentation = {
enable = true;
doc.enable = false;
man.enable = true;
dev.enable = false;
};
services.dbus.enable = true;
system.stateVersion = variable.stateVersion;
# Don't touch this
system.stateVersion = "24.05";
}

View File

@@ -1,42 +0,0 @@
{ pkgs, inputs, ... }: {
fonts = {
packages = with pkgs; [
material-icons
material-design-icons
roboto
work-sans
comic-neue
source-sans
twemoji-color-font
comfortaa
inter
lato
lexend
jost
dejavu_fonts
iosevka-bin
noto-fonts
noto-fonts-cjk
noto-fonts-emoji
jetbrains-mono
(nerdfonts.override { fonts = [ "FiraCode" ]; })
inputs.apple-fonts.packages.${pkgs.system}.sf-pro-nerd
inputs.apple-fonts.packages.${pkgs.system}.sf-mono-nerd
openmoji-color
];
enableDefaultPackages = false;
# this fixes emoji stuff
fontconfig = {
defaultFonts = {
monospace = [ "FiraCode Nerd Font Mono" "Noto Color Emoji" ];
sansSerif = [ "SFProDisplay Nerd Font" "Noto Color Emoji" ];
serif = [ "SFProDisplay Nerd Font" "Noto Color Emoji" ];
emoji = [ "Noto Color Emoji" ];
};
};
};
}

View File

@@ -1,21 +0,0 @@
{ config, pkgs, ... }: {
hardware.opengl = {
enable = true;
driSupport = true;
driSupport32Bit = true;
extraPackages = with pkgs; [ vaapiVdpau libvdpau-va-gl ];
};
services.xserver.videoDrivers = [ "nvidia" ];
boot.kernelParams = [ "nvidia.NVreg_PreserveVideoMemoryAllocations=1" ];
hardware.nvidia = {
modesetting.enable = true;
powerManagement.enable = false;
powerManagement.finegrained = false;
open = false;
nvidiaSettings = true;
package = config.boot.kernelPackages.nvidiaPackages.production;
};
}

View File

@@ -1,13 +0,0 @@
{
hardware.nvidia.prime = {
offload = {
enable = true;
enableOffloadCmd = true;
};
# sync.enable = true;
amdgpuBusId = "PCI:5:0:0";
nvidiaBusId = "PCI:1:0:0";
};
}

View File

@@ -1,6 +0,0 @@
{
services.tailscale = {
enable = true;
authKeyFile = "/etc/tailscalepwd";
};
}

View File

@@ -1,29 +0,0 @@
{ pkgs, ... }: {
services.greetd = {
enable = true;
settings = {
default_session = {
command =
"${pkgs.greetd.tuigreet}/bin/tuigreet --remember --asterisks --container-padding 2 --time --time-format '%I:%M %p | %a %h | %F' --cmd Hyprland";
user = "greeter";
};
};
};
environment.systemPackages = with pkgs; [ greetd.tuigreet ];
# this is a life saver.
# literally no documentation about this anywhere.
# might be good to write about this...
# https://www.reddit.com/r/NixOS/comments/u0cdpi/tuigreet_with_xmonad_how/
systemd.services.greetd.serviceConfig = {
Type = "idle";
StandardInput = "tty";
StandardOutput = "tty";
StandardError = "journal"; # Without this errors will spam on screen
# Without these bootlogs will spam on screen
TTYReset = true;
TTYVHangup = true;
TTYVTDisallocate = true;
};
}

View File

@@ -0,0 +1,79 @@
{ config, ... }: {
imports = [ ../shared/variables-config.nix ];
config.var = {
hostname = "nixy";
username = "hadi";
homeDirectory = "/home/" + config.var.username;
keyboardLayout = "fr";
timeZone = "Europe/Paris";
defaultLocale = "en_US.UTF-8";
extraLocale = "fr_FR.UTF-8";
git = {
username = "Hadi";
email = "112569860+anotherhadi@users.noreply.github.com";
};
stateVersion = "24.05";
autoUpgrade = false;
autoGarbageCollector = false;
sops = true;
nextcloud = true;
nvidia = true;
nvidiaPrime = true;
theme = {
wallpaper = "Lofi-Computer.png";
font-mono = "FiraCode Nerd Font Mono";
font = "SFProDisplay Nerd Font";
rounding = 15;
gaps-in = 12;
gaps-out = config.var.theme.gaps-in * 2;
border-size = 4;
fetch = "nerdfetch"; # "nerdfetch" | "neofetch" | "none"
waybar = {
transparent = true;
float = true;
};
colors = {
c0 = "2F2F2F"; # black
c1 = "f7768e"; # red
c2 = "73daca"; # green
c3 = "e0af68"; # yellow
c4 = "4973CB"; # blue
c5 = "A594FD"; # magenta
c6 = "7dcfff"; # cyan
c7 = "FFFFFF"; # white
c8 = "3F3F3F"; # bright black
c9 = "f7869e"; # bright red
c10 = "83eada"; # bright green
c11 = "f0bf78"; # bright yellow
c12 = "8ab2f7"; # bright blue
c13 = "A988F8"; # bright magenta
c14 = "8ddfff"; # bright cyan
c15 = "f4f5f7"; # bright white
bg = "040404";
fg = config.var.theme.colors.c7;
bgalt = "131313";
fgalt = config.var.theme.colors.c15;
accent = config.var.theme.colors.c4;
accentFg = config.var.theme.colors.c0;
# Should make those automtic
accentName = "blue";
accentNumber = "4";
};
};
};
}