diff options
author | Alyssa Ross <hi@alyssa.is> | 2024-01-06 02:12:23 +0100 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2024-01-06 02:12:23 +0100 |
commit | f34a1b70eb86e4a63cfb88ea460345bb1aed88e3 (patch) | |
tree | 32834d23912250e0c4b86aa4420baacf8091c0fe /nixpkgs/nixos/modules/programs/wayland/sway.nix | |
parent | 003ab91dd67b093890db1dd0bab564345db6e496 (diff) | |
parent | 7a7cfff8915e06365bc2365ff33d4d413184fa9f (diff) | |
download | nixlib-f34a1b70eb86e4a63cfb88ea460345bb1aed88e3.tar nixlib-f34a1b70eb86e4a63cfb88ea460345bb1aed88e3.tar.gz nixlib-f34a1b70eb86e4a63cfb88ea460345bb1aed88e3.tar.bz2 nixlib-f34a1b70eb86e4a63cfb88ea460345bb1aed88e3.tar.lz nixlib-f34a1b70eb86e4a63cfb88ea460345bb1aed88e3.tar.xz nixlib-f34a1b70eb86e4a63cfb88ea460345bb1aed88e3.tar.zst nixlib-f34a1b70eb86e4a63cfb88ea460345bb1aed88e3.zip |
Merge branch 'nixos-unstable-small' of https://github.com/NixOS/nixpkgs
Conflicts: nixpkgs/pkgs/build-support/go/module.nix
Diffstat (limited to 'nixpkgs/nixos/modules/programs/wayland/sway.nix')
-rw-r--r-- | nixpkgs/nixos/modules/programs/wayland/sway.nix | 43 |
1 files changed, 30 insertions, 13 deletions
diff --git a/nixpkgs/nixos/modules/programs/wayland/sway.nix b/nixpkgs/nixos/modules/programs/wayland/sway.nix index f96c833856db..57ee629b2881 100644 --- a/nixpkgs/nixos/modules/programs/wayland/sway.nix +++ b/nixpkgs/nixos/modules/programs/wayland/sway.nix @@ -26,13 +26,28 @@ let }; }; - defaultSwayPackage = pkgs.sway.override { - extraSessionCommands = cfg.extraSessionCommands; - extraOptions = cfg.extraOptions; - withBaseWrapper = cfg.wrapperFeatures.base; - withGtkWrapper = cfg.wrapperFeatures.gtk; - isNixOS = true; - }; + genFinalPackage = pkg: + let + expectedArgs = lib.naturalSort [ + "extraSessionCommands" + "extraOptions" + "withBaseWrapper" + "withGtkWrapper" + "isNixOS" + ]; + existedArgs = with lib; + naturalSort + (intersectLists expectedArgs (attrNames (functionArgs pkg.override))); + in if existedArgs != expectedArgs then + pkg + else + pkg.override { + extraSessionCommands = cfg.extraSessionCommands; + extraOptions = cfg.extraOptions; + withBaseWrapper = cfg.wrapperFeatures.base; + withGtkWrapper = cfg.wrapperFeatures.gtk; + isNixOS = true; + }; in { options.programs.sway = { enable = mkEnableOption (lib.mdDoc '' @@ -44,14 +59,16 @@ in { package = mkOption { type = with types; nullOr package; - default = defaultSwayPackage; + default = pkgs.sway; + apply = p: if p == null then null else genFinalPackage p; defaultText = literalExpression "pkgs.sway"; description = lib.mdDoc '' - Sway package to use. Will override the options - 'wrapperFeatures', 'extraSessionCommands', and 'extraOptions'. - Set to `null` to not add any Sway package to your - path. This should be done if you want to use the Home Manager Sway - module to install Sway. + Sway package to use. If the package does not contain the override arguments + `extraSessionCommands`, `extraOptions`, `withBaseWrapper`, `withGtkWrapper`, + `isNixOS`, then the module options {option}`wrapperFeatures`, + {option}`wrapperFeatures` and {option}`wrapperFeatures` will have no effect. + Set to `null` to not add any Sway package to your path. This should be done if + you want to use the Home Manager Sway module to install Sway. ''; }; |