diff --git a/common/gaming.nix b/common/gaming.nix index 96429e2..a0c80a6 100644 --- a/common/gaming.nix +++ b/common/gaming.nix @@ -35,6 +35,7 @@ in environment.systemPackages = with pkgs; [ heroic prismlauncher + mangohud wootility (pkgs.symlinkJoin { name = "osu"; diff --git a/common/laptop_hardware.nix b/common/laptop_hardware.nix new file mode 100644 index 0000000..03dcdb2 --- /dev/null +++ b/common/laptop_hardware.nix @@ -0,0 +1,60 @@ +{ pkgs, config, lib, ... }: +let + cfg = config.grimmShared; +in +{ + config = with cfg; lib.mkIf (enable && laptop_hardware.enable) { + environment.systemPackages = with pkgs; [ + upower + acpi + lm_sensors + lshw + pciutils + usbutils + powertop + ]; + + services.ddccontrol.enable = true; + powerManagement.scsiLinkPolicy = lib.mkIf (!config.services.tlp.enable) "min_power"; + hardware.i2c.enable = true; + + boot = { + kernelParams = [ + "splash" + "quiet" + "intel_iommu=on" + "iommu=force" + "pcie_acs_override=downstream" + "mmio_stale_data=full,nosmt" + "pcie_aspm=off" + ]; # "vfio-pci.ids=10de:1aeb,10de:2191,10de:1aed,10de:1aec" ]; + kernelModules = [ "kvm-intel" "vfio_pci" "vfio_iommu_type1" "vfio" "i2c-dev" ]; + }; + + services.power-profiles-daemon.enable = false; + services.tlp = { + enable = true; + settings = { + USB_AUTOSUSPEND = 1; + USB_EXCLUDE_BTUSB = 1; + USB_EXCLUDE_PHONE = 1; + SOUND_POWER_SAVE_ON_AC = 0; + SOUND_POWER_SAVE_ON_BAT = 1; + SATA_LINKPWR_ON_AC = "max_performance"; + SATA_LINKPWR_ON_BAT = "min_power"; + MAX_LOST_WORK_SECS_ON_BAT = 15; + CPU_ENERGY_PERF_POLICY_ON_AC = "performance"; + CPU_ENERGY_PERF_POLICY_ON_BAT = "power"; + CPU_BOOST_ON_AC = 1; + CPU_BOOST_ON_BAT = 0; + RUNTIME_PM_ON_AC = "on"; + RUNTIME_PM_ON_BAT = "auto"; + }; + }; + }; + + options.grimmShared.laptop_hardware = { + enable = lib.mkEnableOption "grimm-laptop"; + }; + +} diff --git a/common/qt.nix b/common/qt.nix index e0776af..bc3eee3 100644 --- a/common/qt.nix +++ b/common/qt.nix @@ -34,5 +34,7 @@ in }; defaultSession = lib.optionalString cfg.sway.enable "sway"; }; + + boot.plymouth.enable = true; }; } diff --git a/common/toolchains.nix b/common/toolchains.nix index d2253a0..f02a4f2 100644 --- a/common/toolchains.nix +++ b/common/toolchains.nix @@ -1,4 +1,4 @@ -{ pkgs, config, lib, ... }: +{ pkgs, config, lib, inputs, ... }: let cfg = config.grimmShared; in @@ -13,9 +13,10 @@ in jdk17 python3 pkg-config + unzip + p7zip tea - acpi fbcat gomuks @@ -29,19 +30,16 @@ in util-linux visualvm ffmpeg-full - lm_sensors imagemagick nmap hyfetch - acpi - lshw - pciutils - usbutils - powertop parted glib glibc + # inputs.nix-locate.packages."${system}".default + nix-output-monitor + expect ] ++ lib.optionals cfg.graphical [ qdirstat libva-utils @@ -62,6 +60,7 @@ in core.editor = lib.getExe pkgs.neovim; user.name = cfg.tooling.git_user; user.email = cfg.tooling.git_email; + push.autoSetupRemote = true; }; }; @@ -71,7 +70,7 @@ in #keyMode = "vi"; }; - virtualisation.docker.enable = true; + # virtualisation.docker.enable = true; programs.neovim = { diff --git a/configuration.nix b/configuration.nix index 22e9f63..dcebfbc 100644 --- a/configuration.nix +++ b/configuration.nix @@ -1,8 +1,4 @@ -# Edit this configuration file to define what should be installed on -# your system. Help is available in the configuration.nix(5) man page -# and in the NixOS manual (accessible by running ‘nixos-help’). - -{ config, fetchpatch, pkgs, ... }: +{ config, pkgs, ... }: { imports = [ @@ -16,19 +12,12 @@ boot = { loader.systemd-boot.enable = true; loader.efi.canTouchEfiVariables = true; - kernelParams = [ "quiet" "intel_iommu=on" "iommu=force" "pcie_acs_override=downstream" "pcie_aspm=off" ]; # "vfio-pci.ids=10de:1aeb,10de:2191,10de:1aed,10de:1aec" ]; - kernelModules = [ "nvidia" "nvidia_modeset" "nvidia_drm" "kvm-intel" "vfio_virqfd" "vfio_pci" "vfio_iommu_type1" "vfio" "i2c-dev" ]; kernelPackages = pkgs.linuxPackages_zen; }; # Enable flatpaks - services.flatpak.enable = true; - services.ddccontrol.enable = true; - powerManagement.scsiLinkPolicy = "min_power"; - hardware.i2c.enable = true; - grimmShared = { enable = true; locale = true; @@ -77,9 +66,10 @@ # Allow unfree packages nixpkgs.config.allowUnfree = true; + boot.tmp.cleanOnBoot = true; nix.settings.experimental-features = [ "nix-command" "flakes" ]; - # nix.package = pkgs.nixVersions.unstable; + nix.package = pkgs.nixVersions.unstable; programs.dconf.enable = true; diff --git a/flake.lock b/flake.lock index 2411437..c9c1cf9 100644 --- a/flake.lock +++ b/flake.lock @@ -78,11 +78,11 @@ "yafas": "yafas" }, "locked": { - "lastModified": 1713212932, - "narHash": "sha256-FnKDhx5w9KRUJR0ZEI4kpL+KtAv2utAs6+ovDz1SmHo=", + "lastModified": 1713389985, + "narHash": "sha256-yq7LxfTHqp8cOEVWj0PbNC2AJMz6UPsPzqOjbBIcATg=", "owner": "chaotic-cx", "repo": "nyx", - "rev": "a2f034e707ad9e2be09454f171acd805015ae245", + "rev": "86b0f39a5f88964f72c9086927db83db455d5f15", "type": "github" }, "original": { @@ -229,6 +229,22 @@ "url": "https://flakehub.com/f/edolstra/flake-compat/%2A.tar.gz" } }, + "flake-compat_2": { + "flake": false, + "locked": { + "lastModified": 1673956053, + "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, "flake-parts": { "inputs": { "nixpkgs-lib": "nixpkgs-lib" @@ -331,11 +347,11 @@ ] }, "locked": { - "lastModified": 1712909442, - "narHash": "sha256-D+VrmsPLkEbxNcI7lp9rGFR33RumbQIyhhjJ4PooWBs=", + "lastModified": 1713333160, + "narHash": "sha256-iz4Uz3vykqsZwIY2hxEMfRrc1DvBgxHVCfSxppuj40s=", "owner": "Jovian-Experiments", "repo": "Jovian-NixOS", - "rev": "8886e3da78fcefb11935ea85da3d1572bf444c55", + "rev": "d3ce25a385ec7ed899ffb282d1e54ccb4ac9ef0d", "type": "github" }, "original": { @@ -357,11 +373,11 @@ "rust-overlay": "rust-overlay" }, "locked": { - "lastModified": 1713128310, - "narHash": "sha256-a5u73dLvcgKlI5OOlF6iKhLgliLiF3EsBxIBhdJExSo=", + "lastModified": 1713295938, + "narHash": "sha256-Qe292vyfowvzST0Dv0iM1yR97t7CfOrBTMQ1fCba140=", "owner": "martinvonz", "repo": "jj", - "rev": "0ef25bb4b6a95d5437963302f22f2e0428f6862c", + "rev": "87c4a2e46b20d50ed86400b25b665ae99f0ec39e", "type": "github" }, "original": { @@ -394,11 +410,11 @@ ] }, "locked": { - "lastModified": 1713090581, - "narHash": "sha256-1TZonJRiYAJSlwTIXahd+7Hmf/F0uDx70dd6/fNKrVM=", + "lastModified": 1713335746, + "narHash": "sha256-FxJezTeTI/4SrrJfVknOPD0rBEkUmNAgpKbfHkQO3i0=", "owner": "YaLTeR", "repo": "niri", - "rev": "568fbe26fe58be7de34e46ddb980a26d12e85ac6", + "rev": "c40d4f3268318ac295f21bfce38b9809c5e48f0d", "type": "github" }, "original": { @@ -466,13 +482,34 @@ "type": "github" } }, + "nix-locate": { + "inputs": { + "flake-compat": "flake-compat_2", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1713342678, + "narHash": "sha256-h+YsV4sODXtS2ZCi+SzdEGQivBXrChByciF+67ATWME=", + "owner": "nix-community", + "repo": "nix-index", + "rev": "3cc5fc9acfe4c739c60ea519188f7a795c3484ef", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nix-index", + "type": "github" + } + }, "nixpkgs": { "locked": { - "lastModified": 1712963716, - "narHash": "sha256-WKm9CvgCldeIVvRz87iOMi8CFVB1apJlkUT4GGvA0iM=", + "lastModified": 1713248628, + "narHash": "sha256-NLznXB5AOnniUtZsyy/aPWOk8ussTuePp2acb9U+ISA=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "cfd6b5fc90b15709b780a5a1619695a88505a176", + "rev": "5672bc9dbf9d88246ddab5ac454e82318d094bb8", "type": "github" }, "original": { @@ -537,6 +574,7 @@ "agenix": "agenix", "chaotic": "chaotic", "nix-gaming": "nix-gaming", + "nix-locate": "nix-locate", "nixpkgs": "nixpkgs", "nixpkgs-stable": "nixpkgs-stable_2" } diff --git a/flake.nix b/flake.nix index d452838..3a50bd2 100644 --- a/flake.nix +++ b/flake.nix @@ -20,9 +20,13 @@ url = "github:fufexan/nix-gaming"; inputs.nixpkgs.follows = "nixpkgs"; }; + nix-locate = { + url = "github:nix-community/nix-index"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; - outputs = inputs @ { self, nix-gaming, agenix, nixpkgs, nixpkgs-stable, chaotic, ... }: + outputs = inputs @ { self, nix-gaming, agenix, nixpkgs, nixpkgs-stable, nix-locate, chaotic, ... }: let system = "x86_64-linux"; stable = import nixpkgs-stable { inherit system; config.allowUnfree = true; }; diff --git a/load_common.nix b/load_common.nix index e2c2fdd..a715a8e 100644 --- a/load_common.nix +++ b/load_common.nix @@ -20,5 +20,6 @@ with lib; ./common/security.nix ./common/qt.nix ./common/spotify.nix + ./common/laptop_hardware.nix ]; } diff --git a/modules/system-packages.nix b/modules/system-packages.nix index acbe016..afb1603 100644 --- a/modules/system-packages.nix +++ b/modules/system-packages.nix @@ -1,6 +1,6 @@ -{ pkgs, ... }: { +{ pkgs, lib, ... }: { environment.systemPackages = with pkgs; [ oci-cli - (writeShellScriptBin "rebuild" "nixos-rebuild switch --flake .") + (writeShellScriptBin "rebuild" "bash -c \"nixos-rebuild switch --flake . |& nom\"") ]; } diff --git a/modules/tlp.nix b/modules/tlp.nix deleted file mode 100644 index a461019..0000000 --- a/modules/tlp.nix +++ /dev/null @@ -1,23 +0,0 @@ -{ pkgs, ... }: -{ - services.power-profiles-daemon.enable = false; - services.tlp = { - enable = true; - settings = { - USB_AUTOSUSPEND = 1; - USB_EXCLUDE_BTUSB = 1; - USB_EXCLUDE_PHONE = 1; - SOUND_POWER_SAVE_ON_AC = 0; - SOUND_POWER_SAVE_ON_BAT = 1; - SATA_LINKPWR_ON_AC = "max_performance"; - SATA_LINKPWR_ON_BAT = "min_power"; - MAX_LOST_WORK_SECS_ON_BAT = 15; - CPU_ENERGY_PERF_POLICY_ON_AC = "performance"; - CPU_ENERGY_PERF_POLICY_ON_BAT = "power"; - CPU_BOOST_ON_AC = 1; - CPU_BOOST_ON_BAT = 0; - RUNTIME_PM_ON_AC = "on"; - RUNTIME_PM_ON_BAT = "auto"; - }; - }; -} diff --git a/modules/users.nix b/modules/users.nix index 2aaa8e9..fa9b21f 100644 --- a/modules/users.nix +++ b/modules/users.nix @@ -1,7 +1,7 @@ { lib, config, pkgs, stable, ... }: { users.users.grimmauld = { isNormalUser = true; - shell = pkgs.xonsh; + # shell = pkgs.xonsh; description = "grimmauld"; extraGroups = [ "networkmanager" "kvm" "wheel" "input" "video" "lp" "scanner" "libvirt" "libvirt-qemu" "libvirtd" "pipewire" "gamemode" ]; diff --git a/specific/grimm-nixos-laptop/hardware-configuration.nix b/specific/grimm-nixos-laptop/hardware-configuration.nix index 81cd689..200fc65 100644 --- a/specific/grimm-nixos-laptop/hardware-configuration.nix +++ b/specific/grimm-nixos-laptop/hardware-configuration.nix @@ -25,6 +25,7 @@ { device = "/dev/disk/by-uuid/D20D-B5B0"; fsType = "vfat"; + options = [ "umask=077" ]; }; swapDevices = [{ @@ -32,16 +33,19 @@ size = 48 * 1024; }]; - grimmShared.screens = { - external = { - id = "HDMI-A-1"; - pos = "0,0"; - }; + grimmShared = { + screens = { + external = { + id = "HDMI-A-1"; + pos = "0,0"; + }; - internal = { - id = "eDP-1"; - fps = 144; + internal = { + id = "eDP-1"; + fps = 144; + }; }; + laptop_hardware.enable = true; }; nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; diff --git a/sway/sway-conf.nix b/sway/sway-conf.nix index b616b93..e6710be 100644 --- a/sway/sway-conf.nix +++ b/sway/sway-conf.nix @@ -43,7 +43,8 @@ "$mod+d" = "exec $menu"; "$mod+Shift+d" = "exec $menu_run"; "$mod+Shift+s" = ''exec ${getExe pkgs.grim} -g "$(${getExe pkgs.slurp} -d)" - | wl-copy''; - "$mod+Return" = "exec $term"; + "$mod+Return" = "exec $term -e xonsh"; + "$mod+Shift+Return" = "exec $term"; "$mod+Shift+q" = "kill"; "$mod+Shift+c" = "reload"; "$mod+Shift+e" = "exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -B 'Yes, exit sway' 'swaymsg exit'"; @@ -147,6 +148,7 @@ dunst (pkgs.writeShellScriptBin "rmenu-cache-clear" "rm -r $HOME/.cache/rmenu") # invalidate rmenu cache on sway restart "systemctl --user import-environment XDG_SESSION_TYPE XDG_CURRENT_DESKTOP" + "dbus-update-activation-environment" ]; extraConfig = '' output * bg ${./wallpapers/switzerland.jpg} fill