diff --git a/flake.lock b/flake.lock index 523be46..d1891a1 100644 --- a/flake.lock +++ b/flake.lock @@ -207,11 +207,11 @@ ] }, "locked": { - "lastModified": 1733482664, - "narHash": "sha256-ZD+h1fwvZs+Xvg46lzTWveAqyDe18h9m7wZnTIJfFZ4=", + "lastModified": 1733572789, + "narHash": "sha256-zjO6m5BqxXIyjrnUziAzk4+T4VleqjstNudSqWcpsHI=", "owner": "nix-community", "repo": "home-manager", - "rev": "e38d3dd1d355a003cc63e8fe6ff66ef2257509ed", + "rev": "c7ffc9727d115e433fd884a62dc164b587ff651d", "type": "github" }, "original": { diff --git a/modules/nixos/apps/writing/default.nix b/modules/nixos/apps/writing/default.nix index 60df3f0..2657f21 100644 --- a/modules/nixos/apps/writing/default.nix +++ b/modules/nixos/apps/writing/default.nix @@ -10,7 +10,7 @@ let cfg = config.${namespace}.apps.writing; compile-manuscript = pkgs.writeShellScriptBin "compile-manuscript" ( - builtins.readFile ../../../../bin/compile-manuscript.sh + builtins.readFile (lib.snowfall.fs.get-file "bin/compile-manuscript.sh") ); in { diff --git a/modules/nixos/services/jellyfin/default.nix b/modules/nixos/services/jellyfin/default.nix index 4eab7d1..7688957 100644 --- a/modules/nixos/services/jellyfin/default.nix +++ b/modules/nixos/services/jellyfin/default.nix @@ -9,7 +9,7 @@ let cfg = config.${namespace}.services.jellyfin; jellyfin-audio-save = pkgs.unstable.jellyfin.overrideAttrs ( - finalAttrs: prevAttrs: { patches = [ ./jellyfin-audio-save-position.patch ]; } + _finalAttrs: _prevAttrs: { patches = [ ./jellyfin-audio-save-position.patch ]; } ); in { diff --git a/modules/nixos/system/default.nix b/modules/nixos/system/default.nix index 4fdf75b..71f68b9 100644 --- a/modules/nixos/system/default.nix +++ b/modules/nixos/system/default.nix @@ -43,18 +43,12 @@ in xxd ]; }; - - powerManagement.enable = lib.mkEnableOption "Enables power management, e.g. for laptops."; }; }; config = { # Install base packages environment.systemPackages = cfg.corePackages ++ cfg.packages; - # Configure power management via power-profiles-daemon - # https://gitlab.freedesktop.org/upower/power-profiles-daemon - services.power-profiles-daemon.enable = cfg.powerManagement.enable; - services = { # Automatically set the timezone based on location automatic-timezoned.enable = true; diff --git a/modules/nixos/system/gpu/default.nix b/modules/nixos/system/gpu/default.nix index 42bb974..1fd1275 100644 --- a/modules/nixos/system/gpu/default.nix +++ b/modules/nixos/system/gpu/default.nix @@ -57,7 +57,7 @@ in }) (lib.mkIf cfg.intel.enable { - services.xserver.videoDrivers = [ "intel" ]; + services.xserver.videoDrivers = [ "modesetting" ]; hardware.graphics = { enable = true; diff --git a/modules/nixos/system/nix/default.nix b/modules/nixos/system/nix/default.nix index 7ed3de7..c86c41f 100644 --- a/modules/nixos/system/nix/default.nix +++ b/modules/nixos/system/nix/default.nix @@ -13,7 +13,7 @@ let cfg = config.${namespace}; nixos-operations-script = pkgs.writeShellScriptBin "nixos-operations-script" ( - builtins.readFile ../../../../bin/nixos-operations-script.sh + builtins.readFile (lib.snowfall.fs.get-file "bin/nixos-operations-script.sh") ); in { diff --git a/modules/nixos/system/power/default.nix b/modules/nixos/system/power/default.nix new file mode 100644 index 0000000..f24d276 --- /dev/null +++ b/modules/nixos/system/power/default.nix @@ -0,0 +1,35 @@ +# Power management options +{ + pkgs, + config, + lib, + namespace, + ... +}: +let + cfg = config.${namespace}; + + ppd-patched = pkgs.power-profiles-daemon.overrideAttrs ( + _finalAttrs: _prevAttrs: { + patches = [ ./power-profiles-daemon.patch ]; + mesonFlags = [ + "-Dsystemdsystemunitdir=${placeholder "out"}/lib/systemd/system" + "-Dgtk_doc=true" + "-Dpylint=disabled" + "-Dzshcomp=${placeholder "out"}/share/zsh/site-functions" + "-Dtests=false" # Disable built-in tests, since they'll fail due to the patch + ]; + } + ); +in +{ + options.${namespace}.powerManagement.enable = + lib.mkEnableOption "Enables power management, e.g. for laptops."; + + # Configure power management via power-profiles-daemon + # https://gitlab.freedesktop.org/upower/power-profiles-daemon + config.services.power-profiles-daemon = lib.mkIf cfg.powerManagement.enable { + enable = true; + package = ppd-patched; + }; +} diff --git a/modules/nixos/system/power/power-profiles-daemon.patch b/modules/nixos/system/power/power-profiles-daemon.patch new file mode 100644 index 0000000..301d88a --- /dev/null +++ b/modules/nixos/system/power/power-profiles-daemon.patch @@ -0,0 +1,26 @@ +diff --git a/src/ppd-driver-amd-pstate.c b/src/ppd-driver-amd-pstate.c + index 55635b0..0ed87ab 100644 + --- a/src/ppd-driver-amd-pstate.c + +++ b/src/ppd-driver-amd-pstate.c + @@ -175,7 +175,7 @@ profile_to_epp_pref (PpdProfile profile, gboolean battery) + case PPD_PROFILE_POWER_SAVER: + return "power"; + case PPD_PROFILE_BALANCED: + - return battery ? "balance_power" : "balance_performance"; + + return "balance_performance"; + case PPD_PROFILE_PERFORMANCE: + return "performance"; + } + diff --git a/src/ppd-driver-intel-pstate.c b/src/ppd-driver-intel-pstate.c + index 90a5d17..4eaca2e 100644 + --- a/src/ppd-driver-intel-pstate.c + +++ b/src/ppd-driver-intel-pstate.c + @@ -300,7 +300,7 @@ profile_to_epp_pref (PpdProfile profile, gboolean battery) + case PPD_PROFILE_POWER_SAVER: + return "power"; + case PPD_PROFILE_BALANCED: + - return battery ? "balance_power" : "balance_performance"; + + return "balance_performance"; + case PPD_PROFILE_PERFORMANCE: + return "performance"; + } \ No newline at end of file diff --git a/modules/nixos/users/root/default.nix b/modules/nixos/users/root/default.nix index ab9b503..b974d3e 100644 --- a/modules/nixos/users/root/default.nix +++ b/modules/nixos/users/root/default.nix @@ -1,4 +1,4 @@ -{ namespace, ... }: +{ ... }: { home-manager.users.root = { imports = [ ../common/home-manager/zsh.nix ]; diff --git a/overlays/pkgs/unstable/default.nix b/overlays/pkgs/unstable/default.nix index b0b0a31..73d6b77 100644 --- a/overlays/pkgs/unstable/default.nix +++ b/overlays/pkgs/unstable/default.nix @@ -1,6 +1,6 @@ { channels, inputs, ... }: -final: prev: +final: _prev: { unstable = import inputs.nixpkgs-unstable { diff --git a/packages/freight-pro/default.nix b/packages/freight-pro/default.nix index b004c47..0194f0e 100644 --- a/packages/freight-pro/default.nix +++ b/packages/freight-pro/default.nix @@ -1,4 +1,8 @@ -{ stdenv, pkgs }: +{ + lib, + stdenv, + pkgs, +}: stdenv.mkDerivation rec { pname = "freight-pro-fonts"; @@ -6,7 +10,7 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ pkgs.unzip ]; buildInputs = [ pkgs.unzip ]; - src = ../../modules/nixos/secrets/Freight-20240828T164047Z-001.zip; + src = lib.snowfall.fs.get-file "modules/nixos/secrets/Freight-20240828T164047Z-001.zip"; unpackPhase = '' runHook preUnpack diff --git a/treefmt.nix b/treefmt.nix index dc91ddb..b97ec40 100644 --- a/treefmt.nix +++ b/treefmt.nix @@ -5,6 +5,10 @@ programs = { beautysh.enable = true; + deadnix = { + enable = true; + no-lambda-pattern-names = true; + }; nixfmt = { enable = true; package = pkgs.nixfmt-rfc-style; @@ -12,4 +16,8 @@ prettier.enable = true; yamlfmt.enable = true; }; + + settings = { + on-unmatched = "info"; + }; }