Former-commit-id: 81ab14b256
This commit is contained in:
Hadi
2024-05-02 15:40:12 +02:00
parent 8e4d046365
commit fa0aa29974
86 changed files with 227 additions and 146 deletions

View File

@@ -1,5 +1,16 @@
{ pkgs, config, ... }: {
imports = [ ./hardware-configuration.nix ./nvidia.nix ];
{ pkgs, ... }:
let
variable = import ../variables.nix;
imports = [ ./hardware-configuration.nix ];
# Weird variable name to avoid conflict with the `imports` variable...
secondImports =
if variable.enableNvidia then imports ++ [ ./nvidia.nix ] else imports;
thirdImports = if variable.enablePrime then
secondImports ++ [ ./prime.nix ]
else
secondImports;
in {
imports = thirdImports;
# Bootloader.
boot.loader.efi.canTouchEfiVariables = true;
@@ -12,36 +23,36 @@
##############
# CHANGEME
networking.hostName = "nixy";
time.timeZone = "Europe/Paris";
i18n.defaultLocale = "en_US.UTF-8";
networking.hostName = variable.hostName;
time.timeZone = variable.timeZone;
i18n.defaultLocale = variable.defaultLocale;
i18n.extraLocaleSettings = {
LC_ADDRESS = "fr_FR.UTF-8";
LC_IDENTIFICATION = "fr_FR.UTF-8";
LC_MEASUREMENT = "fr_FR.UTF-8";
LC_MONETARY = "fr_FR.UTF-8";
LC_NAME = "fr_FR.UTF-8";
LC_NUMERIC = "fr_FR.UTF-8";
LC_PAPER = "fr_FR.UTF-8";
LC_TELEPHONE = "fr_FR.UTF-8";
LC_TIME = "fr_FR.UTF-8";
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;
};
users.users.hadi = { # CHANGEME
users.users.${variable.username} = {
isNormalUser = true;
description = "Hadi account";
description = "${variable.username} account";
extraGroups = [ "networkmanager" "wheel" ];
};
# Auto Update & Clean
system.autoUpgrade = {
enable = true;
dates = "04:00";
flake = "${config.users.users.hadi.home}/.config/nixos"; # CHANGEME
flags = [ "--update-input" "nixpkgs" "--commit-lock-file" ];
allowReboot = false;
};
# system.autoUpgrade = {
# enable = true;
# dates = "04:00";
# flake = "${config.users.users.${variable.username}.home}/.config/nixos";
# flags = [ "--update-input" "nixpkgs" "--commit-lock-file" ];
# allowReboot = false;
# };
##############
@@ -110,5 +121,5 @@
services.dbus.enable = true;
system.stateVersion = "23.11";
system.stateVersion = variable.stateVersion;
}

10
nixos/fonts.nix Normal file
View File

@@ -0,0 +1,10 @@
{ pkgs, inputs, ... }: {
fonts.packages = with pkgs; [
(nerdfonts.override { fonts = [ "FiraCode" ]; })
inputs.apple-fonts.packages.${pkgs.system}.sf-pro-nerd
inputs.apple-fonts.packages.${pkgs.system}.sf-mono-nerd
openmoji-color
];
}

View File

@@ -13,7 +13,7 @@
modesetting.enable = true;
powerManagement.enable = true;
powerManagement.finegrained = false;
open = false;
open = true;
nvidiaSettings = true;
};
}

13
nixos/prime.nix Normal file
View File

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

29
nixos/tuigreet.nix Normal file
View File

@@ -0,0 +1,29 @@
{ 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;
};
}