diff options
| -rw-r--r-- | modules/flake/darwin.nix | 17 | ||||
| -rw-r--r-- | modules/flake/nixos.nix | 32 | ||||
| -rw-r--r-- | modules/home/media/jellyfin-mpv-shim/default.nix | 59 | ||||
| -rw-r--r-- | modules/home/media/mpv/default.nix | 67 | ||||
| -rw-r--r-- | modules/home/shells/zsh/default.nix | 34 | ||||
| -rw-r--r-- | modules/nixos/desktop/kde/default.nix | 13 | ||||
| -rw-r--r-- | modules/nixos/plymouth/default.nix | 25 | ||||
| -rw-r--r-- | modules/nixos/sunshine/default.nix | 22 |
8 files changed, 233 insertions, 36 deletions
diff --git a/modules/flake/darwin.nix b/modules/flake/darwin.nix index 84eb74d..cc59bf6 100644 --- a/modules/flake/darwin.nix +++ b/modules/flake/darwin.nix @@ -1,10 +1,18 @@ -{ inputs, config, self, ... }: +{ + inputs, + config, + self, + ... +}: { flake.darwinConfigurations = { lilith = inputs.nix-darwin.lib.darwinSystem { system = "aarch64-darwin"; - specialArgs = { inherit inputs; host = "lilith"; }; + specialArgs = { + inherit inputs; + host = "lilith"; + }; modules = [ inputs.home-manager.darwinModules.home-manager { @@ -14,7 +22,10 @@ (self + /hosts/lilith/configuration.nix) { nixpkgs.config.allowUnfree = true; - nix.settings.experimental-features = [ "nix-command" "flakes" ]; + nix.settings.experimental-features = [ + "nix-command" + "flakes" + ]; } ]; }; diff --git a/modules/flake/nixos.nix b/modules/flake/nixos.nix index efc6d15..40145ea 100644 --- a/modules/flake/nixos.nix +++ b/modules/flake/nixos.nix @@ -1,4 +1,9 @@ -{ inputs, config, self, ... }: +{ + inputs, + config, + self, + ... +}: let inherit (inputs.nixpkgs) lib; @@ -11,7 +16,10 @@ let commonNixosModules = nixosModuleFiles ++ [ { nixpkgs.config.allowUnfree = true; - nix.settings.experimental-features = [ "nix-command" "flakes" ]; + nix.settings.experimental-features = [ + "nix-command" + "flakes" + ]; } ]; @@ -19,6 +27,7 @@ let homeManagerModules = [ inputs.home-manager.nixosModules.home-manager { + home-manager.backupFileExtension = "backup"; home-manager.extraSpecialArgs = { inherit inputs; }; home-manager.sharedModules = [ config.flake.homeModules.default ]; } @@ -28,15 +37,24 @@ in flake.nixosConfigurations = { adam = lib.nixosSystem { system = "x86_64-linux"; - specialArgs = { inherit inputs; host = "adam"; }; - modules = commonNixosModules ++ homeManagerModules ++ [ - (self + /hosts/adam/configuration.nix) - ]; + specialArgs = { + inherit inputs; + host = "adam"; + }; + modules = + commonNixosModules + ++ homeManagerModules + ++ [ + (self + /hosts/adam/configuration.nix) + ]; }; sachiel = lib.nixosSystem { system = "x86_64-linux"; - specialArgs = { inherit inputs; host = "sachiel"; }; + specialArgs = { + inherit inputs; + host = "sachiel"; + }; modules = commonNixosModules ++ [ (self + /hosts/sachiel/configuration.nix) ]; diff --git a/modules/home/media/jellyfin-mpv-shim/default.nix b/modules/home/media/jellyfin-mpv-shim/default.nix new file mode 100644 index 0000000..53826f6 --- /dev/null +++ b/modules/home/media/jellyfin-mpv-shim/default.nix @@ -0,0 +1,59 @@ +{ config, lib, ... }: +let + cfg = config.nx.media.jellyfin-mpv-shim; + # Reference your custom mpv options + mpvOpt = config.nx.media.mpv; + inherit (lib) + mkEnableOption + mkIf + mkOption + types + optionalAttrs + ; +in +{ + options.nx.media.jellyfin-mpv-shim = { + enable = mkEnableOption "Jellyfin MPV Shim"; + name = mkOption { + description = "Name of player"; + type = types.str; + default = "mpv-shim"; + }; + hdrExpansion = mkOption { + type = types.bool; + default = mpvOpt.hdrExpansion; + }; + targetPeak = mkOption { + type = types.int; + default = mpvOpt.targetPeak; + }; + }; + + config = mkIf cfg.enable { + systemd.user.services.jellyfin-mpv-shim.Service.Environment = [ + "ENABLE_HDR_WSI=1" + ]; + + services.jellyfin-mpv-shim = { + enable = true; + settings = { + player_name = cfg.name; + allow_transcode_to_h256 = true; + }; + mpvConfig = { + vo = "gpu-next"; + gpu-api = "vulkan"; + target-colorspace-hint = "yes"; + target-peak = cfg.targetPeak; + } + // (optionalAttrs cfg.hdrExpansion { + target-trc = "pq"; + target-prim = "bt.2020"; + #target-peak = 406; + #tone-mapping = "spline"; + #tone-mapping-mode = "rgb"; + inverse-tone-mapping = "yes"; + }); + }; + }; +} diff --git a/modules/home/media/mpv/default.nix b/modules/home/media/mpv/default.nix new file mode 100644 index 0000000..f6ac360 --- /dev/null +++ b/modules/home/media/mpv/default.nix @@ -0,0 +1,67 @@ +{ config, lib, ... }: +let + cfg = config.nx.media.mpv; + inherit (lib) + mkEnableOption + types + optional + mkIf + mkOption + ; +in +{ + options.nx.media.mpv = { + enable = mkEnableOption "a free, open source, and cross-platform media player"; + hdrExpansion = mkEnableOption "SDR to HDR inverse tone mapping"; + targetPeak = mkOption { + description = "Peak brightness of the display"; + type = types.int; + default = 500; # For MO27Q28G + }; + }; + config = mkIf cfg.enable { + programs.mpv = { + enable = true; + config = { + vo = "gpu-next"; + gpu-api = "vulkan"; + target-peak = cfg.targetPeak; + target-colorspace-hint = "yes"; + }; + profiles = { + # Dolby Vision profile + "DOVI" = { + profile-restore = "copy"; + profile-cond = "p[\"video-dec-params/gamma\"] == \"auto\""; + target-trc = "pq"; + target-prim = "bt.2020"; + target-peak = cfg.targetPeak; + tone-mapping-mode = "auto"; + }; + + # SDR look while in HDR + "SDR" = { + profile-restore = "copy"; + target-trc = "pq"; + target-prim = "bt.2020"; + target-peak = 207; + tone-mapping = "bt.2390"; + tone-mapping-mode = "rgb"; + inverse-tone-mapping = "yes"; + }; + + # SDR to HDR inverse tone mapping + "SDR_HDR_EFFECT" = { + profile-restore = "copy"; + target-trc = "pq"; + target-prim = "bt.2020"; + target-peak = 406; + tone-mapping = "spline"; + tone-mapping-mode = "rgb"; + inverse-tone-mapping = "yes"; + }; + }; + defaultProfiles = optional cfg.hdrExpansion "HDR_MODE:SDR_HDR_EFFECT"; + }; + }; +} diff --git a/modules/home/shells/zsh/default.nix b/modules/home/shells/zsh/default.nix index 72d3f9a..5da67c9 100644 --- a/modules/home/shells/zsh/default.nix +++ b/modules/home/shells/zsh/default.nix @@ -25,23 +25,29 @@ in autosuggestion.enable = true; syntaxHighlighting.enable = true; initContent = '' - # view man pages with nvim - export MANPAGER="nvim +Man!" + # view man pages with nvim + export MANPAGER="nvim +Man!" - # Directory completion with trailing slash - zstyle ':completion:*' list-dirs-first true - zstyle ':completion:*' special-dirs true - zstyle ':completion:*' squeeze-slashes true - zstyle ':completion:*' add-space false + # Directory completion with trailing slash + zstyle ':completion:*' list-dirs-first true + zstyle ':completion:*' special-dirs true + zstyle ':completion:*' squeeze-slashes true + zstyle ':completion:*' add-space false - # Case-insensitive completion - zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}' - # vim keybindings - bindkey -v + # Case-insensitive completion + zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}' + # vim keybindings + bindkey -v - # zoxide smarter cmd command - eval "$(zoxide init zsh)" - ''; + # Auto cd - type directory name to cd into it + setopt AUTO_CD + + # Complete .. to ../ for directory navigation + setopt AUTO_PARAM_SLASH + + # zoxide smarter cmd command + eval "$(zoxide init zsh)" + ''; shellAliases = { ls = "ls --color=auto"; }; diff --git a/modules/nixos/desktop/kde/default.nix b/modules/nixos/desktop/kde/default.nix index 5a24f0d..c267d19 100644 --- a/modules/nixos/desktop/kde/default.nix +++ b/modules/nixos/desktop/kde/default.nix @@ -1,4 +1,9 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: let inherit (lib) mkEnableOption mkIf; cfg = config.nx.desktop.kde; @@ -13,6 +18,10 @@ in }; services.desktopManager.plasma6.enable = true; security.pam.services.sddm.enableKwallet = true; - environment.plasma6.excludePackages = with pkgs.kdePackages; [ elisa kate ]; + environment.plasma6.excludePackages = with pkgs.kdePackages; [ + elisa + kate + ]; + environment.systemPackages = with pkgs.kdePackages; [ kcalc ]; }; } diff --git a/modules/nixos/plymouth/default.nix b/modules/nixos/plymouth/default.nix index f89777e..dd8d79a 100644 --- a/modules/nixos/plymouth/default.nix +++ b/modules/nixos/plymouth/default.nix @@ -13,21 +13,26 @@ in config = mkIf cfg.enable { boot = { - kernelParams = [ - "quiet" - "splash" - "boot.shell_on_fail" - "udev.log_priority=3" - "rd.systemd.show_status=auto" - ]; - consoleLogLevel = 3; + # Show password prompt for encrypted root + initrd.systemd.enable = true; + kernelParams = [ "quiet" ]; loader.systemd-boot.consoleMode = "max"; plymouth = { enable = true; - theme = "lone"; + theme = "loader_2"; themePackages = with pkgs; [ (adi1090x-plymouth-themes.override { - selected_themes = [ "lone" ]; + selected_themes = [ + #"lone" + #"red_loader" + #"cuts_alt" + #"abstract_ring_alt" + "loader_2" + #"sliced" + #"spinner_alt" + #"sphere" + #"loader" + ]; }) ]; }; diff --git a/modules/nixos/sunshine/default.nix b/modules/nixos/sunshine/default.nix new file mode 100644 index 0000000..23a4cc0 --- /dev/null +++ b/modules/nixos/sunshine/default.nix @@ -0,0 +1,22 @@ +{ + config, + lib, + ... +}: +let + inherit (lib) mkEnableOption mkIf; + cfg = config.nx.sunshine; +in +{ + options.nx.sunshine.enable = mkEnableOption "Sunshine game streaming server"; + + config = mkIf cfg.enable { + services.sunshine = { + enable = true; + autoStart = true; + capSysAdmin = true; + openFirewall = true; + }; + hardware.graphics.enable = true; + }; +} |
