diff --git a/flake.lock b/flake.lock index bdabfd4..74a1072 100644 --- a/flake.lock +++ b/flake.lock @@ -1283,10 +1283,10 @@ "secrets": { "flake": false, "locked": { - "lastModified": 1725312829, - "narHash": "sha256-gyt/pZkq+yEFGhHp+YTMK+m87auxJ/NsP2jESXHLqng=", + "lastModified": 1726413025, + "narHash": "sha256-9xYTQF6WkA3oZ8qbIgOK+VKxUtw8BXzGG0Azi5Hdrgs=", "ref": "main", - "rev": "5580b2b0aa04635a62c04767ee4aeeeb601b8666", + "rev": "f20e7854a4754c8851387527ecd7bcff967a9a0a", "shallow": true, "type": "git", "url": "https://github.com/arunoruto/secrets.nix.git" diff --git a/flake.nix b/flake.nix index 9b9de48..7ee4c23 100644 --- a/flake.nix +++ b/flake.nix @@ -152,7 +152,25 @@ ]; in { nixosConfigurations = { - # Framework Laptop + # Framework Laptop AMD 7040 + isshin = nixpkgs.lib.nixosSystem { + inherit system; + specialArgs = { + inherit inputs; + inherit theme; + inherit image; + username = "mirza"; + }; + modules = + nixos-modules + ++ [ + ./hosts/isshin + home-manager.nixosModules.home-manager + ./homes + ]; + }; + + # Framework Laptop Intel 11th zangetsu = nixpkgs.lib.nixosSystem { inherit system; specialArgs = { diff --git a/hosts/isshin/configuration.nix b/hosts/isshin/configuration.nix new file mode 100644 index 0000000..fce3e90 --- /dev/null +++ b/hosts/isshin/configuration.nix @@ -0,0 +1,22 @@ +{lib, ...}: { + # Set hostname + networking.hostName = lib.mkForce "isshin"; # Define your hostname. + + # Eanble fingerprint for framework laptop + fingerprint.enable = true; + + amd.enable = true; + + # Framework specific kernel Params + boot = { + kernelParams = [ + #"quiet" + #"splash" + # "ahci.mobile_lpm_policy=3" + # For Power consumption + # https://kvark.github.io/linux/framework/2021/10/17/framework-nixos.html + # "mem_sleep_default=deep" + ]; + # initrd.kernelModules = ["i915"]; + }; +} diff --git a/hosts/isshin/default.nix b/hosts/isshin/default.nix new file mode 100644 index 0000000..16aa3a2 --- /dev/null +++ b/hosts/isshin/default.nix @@ -0,0 +1,11 @@ +{inputs, ...}: { + imports = [ + # inputs.nixos-hardware.nixosModules.framework-11th-gen-intel + inputs.nixos-hardware.nixosModules.framework-13-7040-amd + + ./configuration.nix + ./hardware-configuration.nix + + ../../modules/nixos + ]; +} diff --git a/hosts/isshin/hardware-configuration.nix b/hosts/isshin/hardware-configuration.nix new file mode 100644 index 0000000..69a1f92 --- /dev/null +++ b/hosts/isshin/hardware-configuration.nix @@ -0,0 +1,38 @@ +# 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") + ]; + + boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "thunderbolt" "usb_storage" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/b01b8966-afbd-47a4-9532-c520e2789584"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/BD45-D145"; + fsType = "vfat"; + options = [ "fmask=0022" "dmask=0022" ]; + }; + + 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 + # still possible to use this option, but it's recommended to use it in conjunction + # with explicit per-interface declarations with `networking.interfaces..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.wlp1s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/modules/nixos/hosts/zangetsu/home.nix b/hosts/isshin/home.nix similarity index 100% rename from modules/nixos/hosts/zangetsu/home.nix rename to hosts/isshin/home.nix diff --git a/hosts/zangetsu/configuration.nix b/hosts/zangetsu/configuration.nix index d3c98fd..05332a8 100644 --- a/hosts/zangetsu/configuration.nix +++ b/hosts/zangetsu/configuration.nix @@ -7,7 +7,9 @@ networking.hostName = lib.mkForce "zangetsu"; # Define your hostname. # Eanble fingerprint for framework laptop - fingerprint.enable = true; + fingerprint.enable = false; + + intel.enable = true; # Framework specific kernel Params boot = { @@ -23,22 +25,23 @@ }; # Enable TLP and powertop for better battery life - services = { - power-profiles-daemon.enable = false; - tlp = { - enable = true; - settings = { - CPU_BOOST_ON_AC = 1; - CPU_BOOST_ON_BAT = 0; - CPU_SCALING_GOVERNOR_ON_AC = "performance"; - CPU_SCALING_GOVERNOR_ON_BAT = "powersave"; - PCIE_ASPM_ON_BAT = "powersupersave"; - RESTORE_DEVICE_STATE_ON_STARTUP = 1; - RUNTIME_PM_ON_BAT = "auto"; - }; - }; - }; - powerManagement.powertop.enable = true; + tlp.enable = true; + # services = { + # power-profiles-daemon.enable = false; + # tlp = { + # enable = true; + # settings = { + # CPU_BOOST_ON_AC = 1; + # CPU_BOOST_ON_BAT = 0; + # CPU_SCALING_GOVERNOR_ON_AC = "performance"; + # CPU_SCALING_GOVERNOR_ON_BAT = "powersave"; + # PCIE_ASPM_ON_BAT = "powersupersave"; + # RESTORE_DEVICE_STATE_ON_STARTUP = 1; + # RUNTIME_PM_ON_BAT = "auto"; + # }; + # }; + # }; + # powerManagement.powertop.enable = true; # nixpkgs.config.packageOverrides = pkgs: { # intel-vaapi-driver = pkgs.intel-vaapi-driver.override {enableHybridCodec = true;}; diff --git a/modules/home-manager/pc/desktop/default.nix b/modules/home-manager/pc/desktop/default.nix index 7542fc5..6650158 100644 --- a/modules/home-manager/pc/desktop/default.nix +++ b/modules/home-manager/pc/desktop/default.nix @@ -36,13 +36,6 @@ #qbittorrent exercism - - gnomeExtensions.appindicator - gnomeExtensions.emoji-copy - # gnomeExtensions.focus - #gnomeExtensions.spotify-controller - gnomeExtensions.tailscale-status - gnomeExtensions.transparent-top-bar ]; }; } diff --git a/modules/home-manager/pc/desktop/gnome/dconf.nix b/modules/home-manager/pc/desktop/gnome/dconf.nix index 19bf705..4f530b8 100644 --- a/modules/home-manager/pc/desktop/gnome/dconf.nix +++ b/modules/home-manager/pc/desktop/gnome/dconf.nix @@ -45,6 +45,19 @@ # gtk-theme = lib.mkForce "Catppuccin-Macchiato-Standard-Green-Dark"; icon-theme = lib.mkForce "candy-icons"; }; + # Power settings + "org/gnome/settings-daemon/plugins/power" = { + ambient-enabled = false; + idle-dim = false; + sleep-inactive-ac-timeout = 1800; + sleep-inactive-ac-type = "suspend"; + sleep-inactive-battery-timeout = 900; + sleep-inactive-battery-type = "suspend"; + }; + # Session + "org/gnome/desktop/session" = { + idle-delay = "uint32 900"; + }; # Set list of custom keybinding "org/gnome/settings-daemon/plugins/media-keys" = { custom-keybindings = [ @@ -72,7 +85,10 @@ binding = "less"; }; # i3 keybindings - "org/gnome/mutter".dynamic-workspaces = false; + "org/gnome/mutter" = { + experimental-features = ["scale-monitor-framebuffer"]; + dynamic-workspaces = false; + }; "org/gnome/desktop/wm/preferences".num-workspaces = 9; "org/gnome/shell/keybindings" = { switch-to-application-1 = []; diff --git a/modules/home-manager/pc/desktop/gnome/default.nix b/modules/home-manager/pc/desktop/gnome/default.nix index d38c411..1d5a7dd 100644 --- a/modules/home-manager/pc/desktop/gnome/default.nix +++ b/modules/home-manager/pc/desktop/gnome/default.nix @@ -1,5 +1,6 @@ { lib, + pkgs, config, ... }: { @@ -15,5 +16,19 @@ dconf.enable = lib.mkDefault true; theming.enable = lib.mkDefault true; }; + + home.packages = + (with pkgs.gnomeExtensions; [ + appindicator + emoji-copy + # focus + # spotify-controller + tailscale-status + # tiling-shell + transparent-top-bar + ]) + ++ (with pkgs.unstable.gnomeExtensions; [ + tiling-shell + ]); }; } diff --git a/modules/home-manager/server/secrets.nix b/modules/home-manager/server/secrets.nix index d2aea9f..6920bf3 100644 --- a/modules/home-manager/server/secrets.nix +++ b/modules/home-manager/server/secrets.nix @@ -22,6 +22,7 @@ in { path = config.home.homeDirectory + "/.ssh/sops_key"; }; "tokens/copilot" = {}; + "tokens/cachix" = {}; }; }; diff --git a/modules/home-manager/server/shell/zsh.nix b/modules/home-manager/server/shell/zsh.nix index d9fc3cf..0858906 100644 --- a/modules/home-manager/server/shell/zsh.nix +++ b/modules/home-manager/server/shell/zsh.nix @@ -40,6 +40,11 @@ # defaultKeymap = "vim"; initExtra = '' + # Variables + export LS_COLORS="$(vivid generate gruvbox-dark)"; + export COPILOT_API_KEY="$(cat ${config.sops.secrets."tokens/copilot".path})" + export CACHIX_AUTH_TOKEN="$(cat ${config.sops.secrets."tokens/cachix".path})" + # Disable all sounds unsetopt BEEP @@ -65,10 +70,6 @@ echo " { config = config.nixpkgs.config; };" } - # Variables - export LS_COLORS="$(vivid generate gruvbox-dark)"; - export COPILOT_API_KEY="$(cat ${config.sops.secrets."tokens/copilot".path})" - ## Autocompletions # tailscale # eval "tailscale completion zsh &> ~/.config/zsh/_tailscale" diff --git a/modules/nixos/environment/amd.nix b/modules/nixos/environment/amd.nix new file mode 100644 index 0000000..d3191ff --- /dev/null +++ b/modules/nixos/environment/amd.nix @@ -0,0 +1,64 @@ +{ + pkgs, + config, + lib, + ... +}: { + options = { + amd.enable = lib.mkEnableOption "Setup amd tools"; + }; + + config = lib.mkIf config.amd.enable { + boot.initrd.kernelModules = ["amdgpu"]; + + services.xserver.videoDrivers = ["amdgpu"]; + + environment.systemPackages = + (with pkgs; [ + amdgpu_top + clinfo + ]) + ++ (with pkgs.rocmPackages; [ + rocminfo + ]); + + hardware.opengl = { + enable = true; + driSupport = true; + driSupport32Bit = true; + extraPackages = + (with pkgs; [ + amdvlk + ]) + ++ (with pkgs.rocmPackages; [ + clr.icd + ]); + }; + + systemd.tmpfiles.rules = let + rocmEnv = pkgs.symlinkJoin { + name = "rocm-combined"; + paths = with pkgs.rocmPackages; [ + clr + hipcc + hipsolver + hipblas + rocblas + rocalution + rocfft + rocm-runtime + rocrand + rocsparse + rocsolver + rccl + # miopen + ]; + }; + in [ + "L+ /opt/rocm - - - - ${rocmEnv}" + "L+ /opt/rocm/hip - - - - ${pkgs.rocmPackages.clr}" + ]; + # systemd.tmpfiles.rules = [ + # ]; + }; +} diff --git a/modules/nixos/environment/cachix.nix b/modules/nixos/environment/cachix.nix new file mode 100644 index 0000000..f1c2e5d --- /dev/null +++ b/modules/nixos/environment/cachix.nix @@ -0,0 +1,14 @@ +{ + pkgs, + lib, + config, + ... +}: { + options.cachix.enable = lib.mkEnableOption "Use cachix to manage nix caches for packages"; + + config = lib.mkIf config.cachix.enable { + environment.systemPackages = with pkgs; [ + cachix + ]; + }; +} diff --git a/modules/nixos/environment/default.nix b/modules/nixos/environment/default.nix index b0b342d..7aa8d37 100644 --- a/modules/nixos/environment/default.nix +++ b/modules/nixos/environment/default.nix @@ -1,6 +1,7 @@ {lib, ...}: { imports = [ ./packages.nix + ./cachix.nix ./firefox.nix ./fonts.nix ./ld.nix @@ -10,9 +11,16 @@ ./python.nix ./wayland.nix + + ./amd.nix + ./intel.nix ]; + cachix.enable = lib.mkDefault true; chrome.enable = lib.mkDefault true; firefox.enable = lib.mkDefault true; steam.enable = lib.mkDefault true; + + amd.enable = lib.mkDefault false; + intel.enable = lib.mkDefault false; } diff --git a/modules/nixos/environment/intel.nix b/modules/nixos/environment/intel.nix new file mode 100644 index 0000000..93c157e --- /dev/null +++ b/modules/nixos/environment/intel.nix @@ -0,0 +1,16 @@ +{ + pkgs, + config, + lib, + ... +}: { + options = { + intel.enable = lib.mkEnableOption "Setup intel tools"; + }; + + config = lib.mkIf config.intel.enable { + environment.systemPackages = with pkgs; [ + intel-gpu-tools + ]; + }; +} diff --git a/modules/nixos/environment/packages.nix b/modules/nixos/environment/packages.nix index 7c9ffc9..cc6898e 100644 --- a/modules/nixos/environment/packages.nix +++ b/modules/nixos/environment/packages.nix @@ -19,7 +19,6 @@ git htop imagemagickBig - intel-gpu-tools iperf killall nmap @@ -53,7 +52,7 @@ libsForQt5.kdenlive libsForQt5.okular #mailspring - masterpdfeditor + # masterpdfeditor # mprime unstable.plex-desktop remmina diff --git a/modules/nixos/hosts/kuchiki/configuration.nix b/modules/nixos/hosts-bak/kuchiki/configuration.nix similarity index 100% rename from modules/nixos/hosts/kuchiki/configuration.nix rename to modules/nixos/hosts-bak/kuchiki/configuration.nix diff --git a/modules/nixos/hosts/kuchiki/hardware-configuration.nix b/modules/nixos/hosts-bak/kuchiki/hardware-configuration.nix similarity index 100% rename from modules/nixos/hosts/kuchiki/hardware-configuration.nix rename to modules/nixos/hosts-bak/kuchiki/hardware-configuration.nix diff --git a/modules/nixos/hosts/kyuubi/configuration.nix b/modules/nixos/hosts-bak/kyuubi/configuration.nix similarity index 100% rename from modules/nixos/hosts/kyuubi/configuration.nix rename to modules/nixos/hosts-bak/kyuubi/configuration.nix diff --git a/modules/nixos/hosts/kyuubi/hardware-configuration.nix b/modules/nixos/hosts-bak/kyuubi/hardware-configuration.nix similarity index 100% rename from modules/nixos/hosts/kyuubi/hardware-configuration.nix rename to modules/nixos/hosts-bak/kyuubi/hardware-configuration.nix diff --git a/modules/nixos/hosts/kyuubi/home.nix b/modules/nixos/hosts-bak/kyuubi/home.nix similarity index 100% rename from modules/nixos/hosts/kyuubi/home.nix rename to modules/nixos/hosts-bak/kyuubi/home.nix diff --git a/modules/nixos/hosts/kyuubi/monitors.xml b/modules/nixos/hosts-bak/kyuubi/monitors.xml similarity index 100% rename from modules/nixos/hosts/kyuubi/monitors.xml rename to modules/nixos/hosts-bak/kyuubi/monitors.xml diff --git a/modules/nixos/hosts/zangetsu/configuration.nix b/modules/nixos/hosts-bak/zangetsu/configuration.nix similarity index 100% rename from modules/nixos/hosts/zangetsu/configuration.nix rename to modules/nixos/hosts-bak/zangetsu/configuration.nix diff --git a/modules/nixos/hosts/zangetsu/hardware-configuration.nix b/modules/nixos/hosts-bak/zangetsu/hardware-configuration.nix similarity index 100% rename from modules/nixos/hosts/zangetsu/hardware-configuration.nix rename to modules/nixos/hosts-bak/zangetsu/hardware-configuration.nix diff --git a/modules/nixos/hosts-bak/zangetsu/home.nix b/modules/nixos/hosts-bak/zangetsu/home.nix new file mode 100644 index 0000000..70eae83 --- /dev/null +++ b/modules/nixos/hosts-bak/zangetsu/home.nix @@ -0,0 +1,5 @@ +{ + wayland.windowManager.hyprland.settings = { + monitor = ",preferred,auto,1.175"; + }; +} diff --git a/modules/nixos/services/default.nix b/modules/nixos/services/default.nix index e4a1621..7d40672 100644 --- a/modules/nixos/services/default.nix +++ b/modules/nixos/services/default.nix @@ -14,6 +14,7 @@ ./oneapi.nix ./secrets.nix ./ssh.nix + ./tlp.nix ]; davmail.enable = lib.mkDefault false; @@ -22,4 +23,5 @@ oneapi.enable = lib.mkDefault false; # oneapi.enable = lib.mkDefault true; ssh.enable = lib.mkDefault true; + tlp.enable = lib.mkDefault false; } diff --git a/modules/nixos/services/hardware/fwupd.nix b/modules/nixos/services/hardware/fwupd.nix index 3c3d207..5cfaf37 100644 --- a/modules/nixos/services/hardware/fwupd.nix +++ b/modules/nixos/services/hardware/fwupd.nix @@ -1,10 +1,16 @@ -{config, lib, ...}: { + config, + lib, + ... +}: { options = { fwupd.enable = lib.mkEnableOption "Firmware update manager"; }; config = lib.mkIf config.fwupd.enable { - services.fwupd.enable = true; + services.fwupd = { + enable = true; + extraRemotes = ["lvfs-testing"]; + }; }; } diff --git a/modules/nixos/services/tlp.nix b/modules/nixos/services/tlp.nix new file mode 100644 index 0000000..446412c --- /dev/null +++ b/modules/nixos/services/tlp.nix @@ -0,0 +1,27 @@ +{ + lib, + config, + ... +}: { + options.tlp.enable = lib.mkEnableOption "Enable power saving using TLP"; + + config = lib.mkIf config.tlp.enable { + # Enable TLP and powertop for better battery life + services = { + power-profiles-daemon.enable = false; + tlp = { + enable = true; + settings = { + CPU_BOOST_ON_AC = 1; + CPU_BOOST_ON_BAT = 0; + CPU_SCALING_GOVERNOR_ON_AC = "performance"; + CPU_SCALING_GOVERNOR_ON_BAT = "powersave"; + PCIE_ASPM_ON_BAT = "powersupersave"; + RESTORE_DEVICE_STATE_ON_STARTUP = 1; + RUNTIME_PM_ON_BAT = "auto"; + }; + }; + }; + powerManagement.powertop.enable = true; + }; +}