diff --git a/README.md b/README.md index 93da778..955f629 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,9 @@ 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 - [ ] Variable user & homeDir diff --git a/flake.nix b/flake.nix index 9e3a473..81cd6d8 100644 --- a/flake.nix +++ b/flake.nix @@ -25,10 +25,15 @@ { _module.args = { inherit inputs; }; } home-manager.nixosModules.home-manager { - home-manager.useGlobalPkgs = true; - home-manager.useUserPackages = true; - home-manager.users.hadi = import ./home/home.nix; - home-manager.extraSpecialArgs = { inherit inputs; inherit spicetify-nix; }; + home-manager = { + useGlobalPkgs = true; + useUserPackages = true; + users.hadi = import ./home/home.nix; # CHANGEME - replace "hadi" + extraSpecialArgs = { + inherit inputs; + inherit spicetify-nix; + }; + }; } ]; }; diff --git a/home/git/default.nix b/home/git/default.nix index b4555e8..45029f7 100644 --- a/home/git/default.nix +++ b/home/git/default.nix @@ -1,8 +1,8 @@ { programs.git = { enable = true; - userName = "Hadi"; - userEmail = "112569860+anotherhadi@users.noreply.github.com"; + userName = "Hadi"; # CHANGEME + userEmail = "112569860+anotherhadi@users.noreply.github.com"; # CHANGEME extraConfig = { init.defaultBranch = "main"; # Automatically track remote branch diff --git a/home/home.nix b/home/home.nix index ce04ffe..fd13467 100644 --- a/home/home.nix +++ b/home/home.nix @@ -20,8 +20,8 @@ ./wallpaper ]; - home.username = "hadi"; - home.homeDirectory = "/home/hadi"; + home.username = "hadi"; # CHANGEME + home.homeDirectory = "/home/hadi"; # CHANGEME home.packages = with pkgs; [ swappy diff --git a/nixos/configuration.nix b/nixos/configuration.nix index bcd679e..a6a76ea 100644 --- a/nixos/configuration.nix +++ b/nixos/configuration.nix @@ -1,5 +1,5 @@ { pkgs, config, ... }: { - imports = [ ./hardware-configuration.nix ]; + imports = [ ./hardware-configuration.nix ./nvidia.nix ]; # Bootloader. boot.loader.efi.canTouchEfiVariables = true; @@ -8,15 +8,14 @@ consoleMode = "auto"; }; - networking.hostName = "nixy"; - - # Enable networking networking.networkmanager.enable = true; - # Set your time zone. + ############## + + # CHANGEME + networking.hostName = "nixy"; time.timeZone = "Europe/Paris"; i18n.defaultLocale = "en_US.UTF-8"; - i18n.extraLocaleSettings = { LC_ADDRESS = "fr_FR.UTF-8"; LC_IDENTIFICATION = "fr_FR.UTF-8"; @@ -29,22 +28,36 @@ LC_TIME = "fr_FR.UTF-8"; }; - # Configure keymap in X11 - services.xserver = { - xkb.layout = "fr"; - xkb.variant = ""; + users.users.hadi = { # CHANGEME + 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.variant = ""; + }; + blueman.enable = true; + gnome.gnome-keyring.enable = true; }; console.keyMap = "fr"; programs.zsh.enable = true; users.defaultUserShell = pkgs.zsh; - users.users.hadi = { - isNormalUser = true; - description = "hadi"; - extraGroups = [ "networkmanager" "wheel" ]; - }; - # Allow unfree packages nixpkgs.config.allowUnfree = true; @@ -52,28 +65,10 @@ 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 = { enable = true; powerOnBoot = true; }; - services.blueman.enable = true; # Set environment variables environment.variables = { @@ -100,15 +95,6 @@ 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 = { settings = { auto-optimise-store = true; diff --git a/nixos/hardware-configuration.nix b/nixos/hardware-configuration.nix index 2b5308b..93b95c2 100644 --- a/nixos/hardware-configuration.nix +++ b/nixos/hardware-configuration.nix @@ -1,21 +1,16 @@ # Do not modify this file! It was generated by ‘nixos-generate-config’ # and may be overwritten by future invocations. Please make changes # to /etc/nixos/configuration.nix instead. -{ - config, - lib, - pkgs, - modulesPath, - ... -}: { - imports = [ - (modulesPath + "/installer/scan/not-detected.nix") - ]; +{ config, lib, pkgs, modulesPath, ... }: { + imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; - boot.initrd.availableKernelModules = ["nvme" "xhci_pci" "usb_storage" "sd_mod"]; - boot.initrd.kernelModules = []; - boot.kernelModules = ["kvm-amd"]; - boot.extraModulePackages = []; + boot = { + initrd.availableKernelModules = + [ "nvme" "xhci_pci" "usb_storage" "sd_mod" ]; + initrd.kernelModules = [ ]; + kernelModules = [ "kvm-amd" ]; + extraModulePackages = [ ]; + }; fileSystems."/" = { device = "/dev/disk/by-uuid/6c2487ec-20ff-4ce3-9396-281c2094aba1"; @@ -27,7 +22,7 @@ fsType = "vfat"; }; - swapDevices = []; + swapDevices = [ ]; # 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 @@ -38,5 +33,6 @@ # networking.interfaces.wlo1.useDHCP = lib.mkDefault true; 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; } diff --git a/nixos/nvidia.nix b/nixos/nvidia.nix new file mode 100644 index 0000000..6cd2e7e --- /dev/null +++ b/nixos/nvidia.nix @@ -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; + }; +}