This commit is contained in:
Hadi 2024-03-13 19:42:50 +01:00
parent a189d592ed
commit 3498cf42bf
7 changed files with 74 additions and 67 deletions

View File

@ -2,6 +2,9 @@
This is my dotfiles repo. It's a work in progress, and I'm still learning how to use nix. This is my dotfiles repo. It's a work in progress, and I'm still learning how to use nix.
Every things that you *must* change got a "CHANGEME" comment.
You can search for it with ripgrep: `rg "CHANGEME"`
# TODOLIST # TODOLIST
- [ ] Variable user & homeDir - [ ] Variable user & homeDir

View File

@ -25,10 +25,15 @@
{ _module.args = { inherit inputs; }; } { _module.args = { inherit inputs; }; }
home-manager.nixosModules.home-manager home-manager.nixosModules.home-manager
{ {
home-manager.useGlobalPkgs = true; home-manager = {
home-manager.useUserPackages = true; useGlobalPkgs = true;
home-manager.users.hadi = import ./home/home.nix; useUserPackages = true;
home-manager.extraSpecialArgs = { inherit inputs; inherit spicetify-nix; }; users.hadi = import ./home/home.nix; # CHANGEME - replace "hadi"
extraSpecialArgs = {
inherit inputs;
inherit spicetify-nix;
};
};
} }
]; ];
}; };

View File

@ -1,8 +1,8 @@
{ {
programs.git = { programs.git = {
enable = true; enable = true;
userName = "Hadi"; userName = "Hadi"; # CHANGEME
userEmail = "112569860+anotherhadi@users.noreply.github.com"; userEmail = "112569860+anotherhadi@users.noreply.github.com"; # CHANGEME
extraConfig = { extraConfig = {
init.defaultBranch = "main"; init.defaultBranch = "main";
# Automatically track remote branch # Automatically track remote branch

View File

@ -20,8 +20,8 @@
./wallpaper ./wallpaper
]; ];
home.username = "hadi"; home.username = "hadi"; # CHANGEME
home.homeDirectory = "/home/hadi"; home.homeDirectory = "/home/hadi"; # CHANGEME
home.packages = with pkgs; [ home.packages = with pkgs; [
swappy swappy

View File

@ -1,5 +1,5 @@
{ pkgs, config, ... }: { { pkgs, config, ... }: {
imports = [ ./hardware-configuration.nix ]; imports = [ ./hardware-configuration.nix ./nvidia.nix ];
# Bootloader. # Bootloader.
boot.loader.efi.canTouchEfiVariables = true; boot.loader.efi.canTouchEfiVariables = true;
@ -8,15 +8,14 @@
consoleMode = "auto"; consoleMode = "auto";
}; };
networking.hostName = "nixy";
# Enable networking
networking.networkmanager.enable = true; networking.networkmanager.enable = true;
# Set your time zone. ##############
# CHANGEME
networking.hostName = "nixy";
time.timeZone = "Europe/Paris"; time.timeZone = "Europe/Paris";
i18n.defaultLocale = "en_US.UTF-8"; i18n.defaultLocale = "en_US.UTF-8";
i18n.extraLocaleSettings = { i18n.extraLocaleSettings = {
LC_ADDRESS = "fr_FR.UTF-8"; LC_ADDRESS = "fr_FR.UTF-8";
LC_IDENTIFICATION = "fr_FR.UTF-8"; LC_IDENTIFICATION = "fr_FR.UTF-8";
@ -29,22 +28,36 @@
LC_TIME = "fr_FR.UTF-8"; LC_TIME = "fr_FR.UTF-8";
}; };
# Configure keymap in X11 users.users.hadi = { # CHANGEME
services.xserver = { isNormalUser = true;
description = "Hadi 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 = true;
};
##############
services = {
xserver = {
xkb.layout = "fr"; xkb.layout = "fr";
xkb.variant = ""; xkb.variant = "";
}; };
blueman.enable = true;
gnome.gnome-keyring.enable = true;
};
console.keyMap = "fr"; console.keyMap = "fr";
programs.zsh.enable = true; programs.zsh.enable = true;
users.defaultUserShell = pkgs.zsh; users.defaultUserShell = pkgs.zsh;
users.users.hadi = {
isNormalUser = true;
description = "hadi";
extraGroups = [ "networkmanager" "wheel" ];
};
# Allow unfree packages # Allow unfree packages
nixpkgs.config.allowUnfree = true; nixpkgs.config.allowUnfree = true;
@ -52,28 +65,10 @@
nixpkgs.config.permittedInsecurePackages = [ "electron-25.9.0" "nix-2.16.2" ]; nixpkgs.config.permittedInsecurePackages = [ "electron-25.9.0" "nix-2.16.2" ];
hardware.opengl = {
enable = true;
driSupport = true;
driSupport32Bit = true;
};
services.xserver.videoDrivers = [ "nvidia" ];
services.gnome.gnome-keyring.enable = true;
hardware.nvidia = {
modesetting.enable = true;
powerManagement.enable = true;
powerManagement.finegrained = false;
open = false;
nvidiaSettings = true;
};
hardware.bluetooth = { hardware.bluetooth = {
enable = true; enable = true;
powerOnBoot = true; powerOnBoot = true;
}; };
services.blueman.enable = true;
# Set environment variables # Set environment variables
environment.variables = { environment.variables = {
@ -100,15 +95,6 @@
wireplumber.enable = true; wireplumber.enable = true;
}; };
# Auto Update & Clean
system.autoUpgrade = {
enable = true;
dates = "04:00";
flake = "${config.users.users.hadi.home}/.config/nixos";
flags = [ "--update-input" "nixpkgs" "--commit-lock-file" ];
allowReboot = true;
};
nix = { nix = {
settings = { settings = {
auto-optimise-store = true; auto-optimise-store = true;

View File

@ -1,21 +1,16 @@
# Do not modify this file! It was generated by nixos-generate-config # Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes # and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead. # to /etc/nixos/configuration.nix instead.
{ { config, lib, pkgs, modulesPath, ... }: {
config, imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
lib,
pkgs,
modulesPath,
...
}: {
imports = [
(modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = ["nvme" "xhci_pci" "usb_storage" "sd_mod"]; boot = {
boot.initrd.kernelModules = []; initrd.availableKernelModules =
boot.kernelModules = ["kvm-amd"]; [ "nvme" "xhci_pci" "usb_storage" "sd_mod" ];
boot.extraModulePackages = []; initrd.kernelModules = [ ];
kernelModules = [ "kvm-amd" ];
extraModulePackages = [ ];
};
fileSystems."/" = { fileSystems."/" = {
device = "/dev/disk/by-uuid/6c2487ec-20ff-4ce3-9396-281c2094aba1"; device = "/dev/disk/by-uuid/6c2487ec-20ff-4ce3-9396-281c2094aba1";
@ -27,7 +22,7 @@
fsType = "vfat"; fsType = "vfat";
}; };
swapDevices = []; swapDevices = [ ];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking # Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's # (the default) this is the recommended approach. When using systemd-networkd it's
@ -38,5 +33,6 @@
# networking.interfaces.wlo1.useDHCP = lib.mkDefault true; # networking.interfaces.wlo1.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; hardware.cpu.amd.updateMicrocode =
lib.mkDefault config.hardware.enableRedistributableFirmware;
} }

17
nixos/nvidia.nix Normal file
View File

@ -0,0 +1,17 @@
{ pkgs, config, ... }: {
hardware.opengl = {
enable = true;
driSupport = true;
driSupport32Bit = true;
};
services.xserver.videoDrivers = [ "nvidia" ];
hardware.nvidia = {
modesetting.enable = true;
powerManagement.enable = true;
powerManagement.finegrained = false;
open = false;
nvidiaSettings = true;
};
}