Loading lib/default.nix +1 −0 Original line number Diff line number Diff line Loading @@ -101,6 +101,7 @@ let upperChars toLower toUpper addContextFrom splitString removePrefix removeSuffix versionOlder versionAtLeast getName getVersion mesonOption mesonBool mesonEnable nameFromURL enableFeature enableFeatureAs withFeature withFeatureAs fixedWidthString fixedWidthNumber isStorePath toInt toIntBase10 readPathsFromFile fileContents; Loading lib/strings.nix +55 −0 Original line number Diff line number Diff line Loading @@ -661,6 +661,61 @@ rec { name = head (splitString sep filename); in assert name != filename; name; /* Create a -D<feature>=<value> string that can be passed to typical Meson invocations. Type: mesonOption :: string -> string -> string @param feature The feature to be set @param value The desired value Example: mesonOption "engine" "opengl" => "-Dengine=opengl" */ mesonOption = feature: value: assert (lib.isString feature); assert (lib.isString value); "-D${feature}=${value}"; /* Create a -D<condition>={true,false} string that can be passed to typical Meson invocations. Type: mesonBool :: string -> bool -> string @param condition The condition to be made true or false @param flag The controlling flag of the condition Example: mesonBool "hardened" true => "-Dhardened=true" mesonBool "static" false => "-Dstatic=false" */ mesonBool = condition: flag: assert (lib.isString condition); assert (lib.isBool flag); mesonOption condition (lib.boolToString flag); /* Create a -D<feature>={enabled,disabled} string that can be passed to typical Meson invocations. Type: mesonEnable :: string -> bool -> string @param feature The feature to be enabled or disabled @param flag The controlling flag Example: mesonEnable "docs" true => "-Ddocs=enabled" mesonEnable "savage" false => "-Dsavage=disabled" */ mesonEnable = feature: flag: assert (lib.isString feature); assert (lib.isBool flag); mesonOption feature (if flag then "enabled" else "disabled"); /* Create an --{enable,disable}-<feat> string that can be passed to standard GNU Autoconf scripts. Loading pkgs/applications/video/mpv/default.nix +16 −16 Original line number Diff line number Diff line Loading @@ -100,20 +100,20 @@ in stdenv.mkDerivation rec { NIX_LDFLAGS = lib.optionalString x11Support "-lX11 -lXext "; mesonFlags = let mesonFeatureFlag = feature: flag: "-D${feature}=${if flag then "enabled" else "disabled"}"; inherit (lib) mesonOption mesonBool mesonEnable; in [ "-Ddefault_library=shared" "-Dlibmpv=true" (mesonFeatureFlag "libarchive" archiveSupport) (mesonFeatureFlag "manpage-build" true) (mesonFeatureFlag "cdda" cddaSupport) (mesonFeatureFlag "dvbin" dvbinSupport) (mesonFeatureFlag "dvdnav" dvdnavSupport) (mesonFeatureFlag "openal" openalSupport) (mesonFeatureFlag "sdl2" sdl2Support) (mesonOption "default_library" "shared") (mesonBool "libmpv" true) (mesonEnable "libarchive" archiveSupport) (mesonEnable "manpage-build" true) (mesonEnable "cdda" cddaSupport) (mesonEnable "dvbin" dvbinSupport) (mesonEnable "dvdnav" dvdnavSupport) (mesonEnable "openal" openalSupport) (mesonEnable "sdl2" sdl2Support) # Disable whilst Swift isn't supported (mesonFeatureFlag "swift-build" swiftSupport) (mesonFeatureFlag "macos-cocoa-cb" swiftSupport) (mesonEnable "swift-build" swiftSupport) (mesonEnable "macos-cocoa-cb" swiftSupport) ]; mesonAutoFeatures = "auto"; Loading @@ -125,9 +125,9 @@ in stdenv.mkDerivation rec { ninja pkg-config python3 ] ++ lib.optionals stdenv.isDarwin [ xcbuild.xcrun ] ++ lib.optionals swiftSupport [ swift ] ] ++ lib.optionals stdenv.isDarwin [ xcbuild.xcrun ] ++ lib.optionals swiftSupport [ swift ] ++ lib.optionals waylandSupport [ wayland-scanner ]; buildInputs = [ Loading pkgs/development/tools/build-managers/muon/default.nix +6 −7 Original line number Diff line number Diff line Loading @@ -81,14 +81,13 @@ stdenv.mkDerivation (finalAttrs: { ''; buildPhase = let muonFeatureFlag = feature: flag: "-D${feature}=${if flag then "enabled" else "disabled"}"; muonConditionFlag = condition: flag: "-D${condition}=${lib.boolToString flag}"; muonBool = lib.mesonBool; muonEnable = lib.mesonEnable; cmdlineForMuon = lib.concatStringsSep " " [ (muonConditionFlag "static" stdenv.targetPlatform.isStatic) (muonFeatureFlag "docs" buildDocs) (muonFeatureFlag "samurai" embedSamurai) (muonBool "static" stdenv.targetPlatform.isStatic) (muonEnable "docs" buildDocs) (muonEnable "samurai" embedSamurai) ]; cmdlineForSamu = "-j$NIX_BUILD_CORES"; in '' Loading pkgs/tools/wayland/slurp/default.nix +15 −12 Original line number Diff line number Diff line { lib , stdenv , fetchFromGitHub , cairo , libxkbcommon , meson , ninja , pkg-config , cairo , libxkbcommon , scdoc , wayland , wayland-protocols , wayland-scanner , buildDocs ? true, scdoc , buildDocs ? true }: stdenv.mkDerivation rec { stdenv.mkDerivation (finalAttrs: { pname = "slurp"; version = "1.3.2"; version = "1.4.0"; src = fetchFromGitHub { owner = "emersion"; repo = "slurp"; rev = "v${version}"; sha256 = "sha256-5ZB34rqLyZmfjT/clxNRDmF0qgITFZ5xt/gIEXQzvQE="; rev = "v${finalAttrs.version}"; hash = "sha256-jUuY2wuN00libHDaJEmrvQAb1o989Ly3nLyKHV0jz8Q="; }; strictDeps = true; nativeBuildInputs = [ meson ninja Loading @@ -38,13 +38,16 @@ stdenv.mkDerivation rec { wayland-protocols ]; mesonFlags = lib.optional buildDocs "-Dman-pages=enabled"; strictDeps = true; mesonFlags = [ (lib.mesonEnable "man-pages" buildDocs) ]; meta = with lib; { description = "Select a region in a Wayland compositor"; homepage = "https://github.com/emersion/slurp"; description = "Select a region in a Wayland compositor"; changelog = "https://github.com/emersion/slurp/releases/tag/v${finalAttrs.version}"; license = licenses.mit; maintainers = with maintainers; [ buffet ]; platforms = platforms.linux; inherit (wayland.meta) platforms; }; } }) Loading
lib/default.nix +1 −0 Original line number Diff line number Diff line Loading @@ -101,6 +101,7 @@ let upperChars toLower toUpper addContextFrom splitString removePrefix removeSuffix versionOlder versionAtLeast getName getVersion mesonOption mesonBool mesonEnable nameFromURL enableFeature enableFeatureAs withFeature withFeatureAs fixedWidthString fixedWidthNumber isStorePath toInt toIntBase10 readPathsFromFile fileContents; Loading
lib/strings.nix +55 −0 Original line number Diff line number Diff line Loading @@ -661,6 +661,61 @@ rec { name = head (splitString sep filename); in assert name != filename; name; /* Create a -D<feature>=<value> string that can be passed to typical Meson invocations. Type: mesonOption :: string -> string -> string @param feature The feature to be set @param value The desired value Example: mesonOption "engine" "opengl" => "-Dengine=opengl" */ mesonOption = feature: value: assert (lib.isString feature); assert (lib.isString value); "-D${feature}=${value}"; /* Create a -D<condition>={true,false} string that can be passed to typical Meson invocations. Type: mesonBool :: string -> bool -> string @param condition The condition to be made true or false @param flag The controlling flag of the condition Example: mesonBool "hardened" true => "-Dhardened=true" mesonBool "static" false => "-Dstatic=false" */ mesonBool = condition: flag: assert (lib.isString condition); assert (lib.isBool flag); mesonOption condition (lib.boolToString flag); /* Create a -D<feature>={enabled,disabled} string that can be passed to typical Meson invocations. Type: mesonEnable :: string -> bool -> string @param feature The feature to be enabled or disabled @param flag The controlling flag Example: mesonEnable "docs" true => "-Ddocs=enabled" mesonEnable "savage" false => "-Dsavage=disabled" */ mesonEnable = feature: flag: assert (lib.isString feature); assert (lib.isBool flag); mesonOption feature (if flag then "enabled" else "disabled"); /* Create an --{enable,disable}-<feat> string that can be passed to standard GNU Autoconf scripts. Loading
pkgs/applications/video/mpv/default.nix +16 −16 Original line number Diff line number Diff line Loading @@ -100,20 +100,20 @@ in stdenv.mkDerivation rec { NIX_LDFLAGS = lib.optionalString x11Support "-lX11 -lXext "; mesonFlags = let mesonFeatureFlag = feature: flag: "-D${feature}=${if flag then "enabled" else "disabled"}"; inherit (lib) mesonOption mesonBool mesonEnable; in [ "-Ddefault_library=shared" "-Dlibmpv=true" (mesonFeatureFlag "libarchive" archiveSupport) (mesonFeatureFlag "manpage-build" true) (mesonFeatureFlag "cdda" cddaSupport) (mesonFeatureFlag "dvbin" dvbinSupport) (mesonFeatureFlag "dvdnav" dvdnavSupport) (mesonFeatureFlag "openal" openalSupport) (mesonFeatureFlag "sdl2" sdl2Support) (mesonOption "default_library" "shared") (mesonBool "libmpv" true) (mesonEnable "libarchive" archiveSupport) (mesonEnable "manpage-build" true) (mesonEnable "cdda" cddaSupport) (mesonEnable "dvbin" dvbinSupport) (mesonEnable "dvdnav" dvdnavSupport) (mesonEnable "openal" openalSupport) (mesonEnable "sdl2" sdl2Support) # Disable whilst Swift isn't supported (mesonFeatureFlag "swift-build" swiftSupport) (mesonFeatureFlag "macos-cocoa-cb" swiftSupport) (mesonEnable "swift-build" swiftSupport) (mesonEnable "macos-cocoa-cb" swiftSupport) ]; mesonAutoFeatures = "auto"; Loading @@ -125,9 +125,9 @@ in stdenv.mkDerivation rec { ninja pkg-config python3 ] ++ lib.optionals stdenv.isDarwin [ xcbuild.xcrun ] ++ lib.optionals swiftSupport [ swift ] ] ++ lib.optionals stdenv.isDarwin [ xcbuild.xcrun ] ++ lib.optionals swiftSupport [ swift ] ++ lib.optionals waylandSupport [ wayland-scanner ]; buildInputs = [ Loading
pkgs/development/tools/build-managers/muon/default.nix +6 −7 Original line number Diff line number Diff line Loading @@ -81,14 +81,13 @@ stdenv.mkDerivation (finalAttrs: { ''; buildPhase = let muonFeatureFlag = feature: flag: "-D${feature}=${if flag then "enabled" else "disabled"}"; muonConditionFlag = condition: flag: "-D${condition}=${lib.boolToString flag}"; muonBool = lib.mesonBool; muonEnable = lib.mesonEnable; cmdlineForMuon = lib.concatStringsSep " " [ (muonConditionFlag "static" stdenv.targetPlatform.isStatic) (muonFeatureFlag "docs" buildDocs) (muonFeatureFlag "samurai" embedSamurai) (muonBool "static" stdenv.targetPlatform.isStatic) (muonEnable "docs" buildDocs) (muonEnable "samurai" embedSamurai) ]; cmdlineForSamu = "-j$NIX_BUILD_CORES"; in '' Loading
pkgs/tools/wayland/slurp/default.nix +15 −12 Original line number Diff line number Diff line { lib , stdenv , fetchFromGitHub , cairo , libxkbcommon , meson , ninja , pkg-config , cairo , libxkbcommon , scdoc , wayland , wayland-protocols , wayland-scanner , buildDocs ? true, scdoc , buildDocs ? true }: stdenv.mkDerivation rec { stdenv.mkDerivation (finalAttrs: { pname = "slurp"; version = "1.3.2"; version = "1.4.0"; src = fetchFromGitHub { owner = "emersion"; repo = "slurp"; rev = "v${version}"; sha256 = "sha256-5ZB34rqLyZmfjT/clxNRDmF0qgITFZ5xt/gIEXQzvQE="; rev = "v${finalAttrs.version}"; hash = "sha256-jUuY2wuN00libHDaJEmrvQAb1o989Ly3nLyKHV0jz8Q="; }; strictDeps = true; nativeBuildInputs = [ meson ninja Loading @@ -38,13 +38,16 @@ stdenv.mkDerivation rec { wayland-protocols ]; mesonFlags = lib.optional buildDocs "-Dman-pages=enabled"; strictDeps = true; mesonFlags = [ (lib.mesonEnable "man-pages" buildDocs) ]; meta = with lib; { description = "Select a region in a Wayland compositor"; homepage = "https://github.com/emersion/slurp"; description = "Select a region in a Wayland compositor"; changelog = "https://github.com/emersion/slurp/releases/tag/v${finalAttrs.version}"; license = licenses.mit; maintainers = with maintainers; [ buffet ]; platforms = platforms.linux; inherit (wayland.meta) platforms; }; } })