jiebi/CodeConvo huggingface dataset:
sha256 = "161050sx3sdxqcpjkjcpf6wl4kx0jydihga7mcvrj9c2f8ly0g07"; }; <ins> patches = [ # Make PyGObject’s gi library available. (substituteAll { src = ./fix-paths.patch; pythonPaths = lib.concatMapStringsSep ", " (pkg: "'${pkg}/${python3.sitePackages}'") [ python3.pkgs.pygobject3 ]; }) ]; </ins> nativeBuildInputs = [ pkg-config which
<ins> diff --git a/src/nautilus-python.c b/src/nautilus-python.c index 843e3c6..466a513 100644 --- a/src/nautilus-python.c +++ b/src/nautilus-python.c @@ -184,6 +184,9 @@ nautilus_python_init_python (void) { return FALSE; } +    debug("Add PyGObject to path"); +    PyRun_SimpleString("import site;import functools; functools.reduce(lambda k, p: site.addsitedir(p, k), [@pythonPaths@], site._init_pathinfo())"); + /* import gobject */ debug("init_pygobject"); if (!np_init_pygobject()) { </ins>
# https://downloads.haskell.org/~ghc/8.10.2/ src = fetchurl ({ i686-linux = { <del> url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-i386-deb9-linux.tar.xz"; </del> <ins> url = "${downloadsUrl}/${version}/ghc-${version}-i386-deb9-linux.tar.xz"; </ins> sha256 = "0bvwisl4w0z5z8z0da10m9sv0mhm9na2qm43qxr8zl23mn32mblx"; }; x86_64-linux = { <del> url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-x86_64-deb10-linux.tar.xz"; </del> <ins> url = "${downloadsUrl}/${version}/ghc-${version}-x86_64-deb10-linux.tar.xz"; </ins> sha256 = "0chnzy9j23b2wa8clx5arwz8wnjfxyjmz9qkj548z14cqf13slcl"; }; armv7l-linux = { <del> url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-armv7-deb10-linux.tar.xz"; </del> <ins> url = "${downloadsUrl}/${version}/ghc-${version}-armv7-deb10-linux.tar.xz"; </ins> sha256 = "1j41cq5d3rmlgz7hzw8f908fs79gc5mn3q5wz277lk8zdf19g75v"; }; aarch64-linux = { <del> url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-aarch64-deb10-linux.tar.xz"; </del> <ins> url = "${downloadsUrl}/${version}/ghc-${version}-aarch64-deb10-linux.tar.xz"; </ins> sha256 = "14smwl3741ixnbgi0l51a7kh7xjkiannfqx15b72svky0y4l3wjw"; }; x86_64-darwin = { <del> url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-x86_64-apple-darwin.tar.xz"; </del> <ins> url = "${downloadsUrl}/${version}/ghc-${version}-x86_64-apple-darwin.tar.xz"; </ins> sha256 = "1hngyq14l4f950hzhh2d204ca2gfc98pc9xdasxihzqd1jq75dzd"; }; }.${stdenv.hostPlatform.system}
src = fetchurl ({ i686-linux = { # Don't use the Fedora27 build (as below) because there isn't one! <del> url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-i386-deb9-linux.tar.xz"; </del> <ins> url = "${downloadsUrl}/${version}/ghc-${version}-i386-deb9-linux.tar.xz"; </ins> sha256 = "1p2h29qghql19ajk755xa0yxkn85slbds8m9n5196ris743vkp8w"; }; x86_64-linux = { # This is the Fedora build because it links against ncurses6 where the # deb9 one links against ncurses5, see here # https://github.com/NixOS/nixpkgs/issues/85924 for a discussion <del> url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-x86_64-fedora27-linux.tar.xz"; </del> <ins> url = "${downloadsUrl}/${version}/ghc-${version}-x86_64-fedora27-linux.tar.xz"; </ins> sha256 = "18dlqm5d028fqh6ghzn7pgjspr5smw030jjzl3kq6q1kmwzbay6g"; }; aarch64-linux = { <del> url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-aarch64-ubuntu18.04-linux.tar.xz"; </del> <ins> url = "${downloadsUrl}/${version}/ghc-${version}-aarch64-ubuntu18.04-linux.tar.xz"; </ins> sha256 = "11n7l2a36i5vxzzp85la2555q4m34l747g0pnmd81cp46y85hlhq"; }; x86_64-darwin = { <del> url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-x86_64-apple-darwin.tar.xz"; </del> <ins> url = "${downloadsUrl}/${version}/ghc-${version}-x86_64-apple-darwin.tar.xz"; </ins> sha256 = "0s9188vhhgf23q3rjarwhbr524z6h2qga5xaaa2pma03sfqvvhfz"; }; }.${stdenv.hostPlatform.system}
license = licenses.agpl3; maintainers = with maintainers; [ mmahut _1000101 ]; platforms = platforms.unix; <ins> # go dependency tecbot/gorocksdb requires rocksdb 5.x but nixpkgs has only rocksdb 6.x # issue in upstream can be tracked here: https://github.com/trezor/blockbook/issues/617 broken = true; </ins> }; }
programs.feedbackd.enable = true; <del> # https://source.puri.sm/Librem5/phosh/-/issues/303 security.pam.services.phosh = { text = '' auth    requisite       pam_nologin.so auth    required        pam_succeed_if.so user != root quiet_success auth    required        pam_securetty.so auth    requisite       pam_nologin.so ''; }; </del> <ins> security.pam.services.phosh = {}; </ins> services.gnome.core-shell.enable = true; services.gnome.core-os-services.enable = true;
nativeBuildInputs = [ pkgconfig gettext perl python ]; <del> propagatedBuildInputs = [ pcre zlib libffi ] ++ libiconvOrEmpty ++ libintlOrEmpty; </del> <ins> propagatedBuildInputs = [ pcre zlib libffi ] ++ optional (!stdenv.isDarwin) libiconvOrEmpty ++ libintlOrEmpty; </ins> configureFlags = optional stdenv.isDarwin "--disable-compile-warnings"
propagatedBuildInputs = with xlibs; with stdenv.lib; [ glib cairo pango gdk_pixbuf atk ] <del> ++ optionals stdenv.isLinux [ libXrandr libXrender libXcomposite libXi libXcursor ] ++ optional stdenv.isDarwin x11 </del> <ins> ++ optionals (stdenv.isLinux || stdenv.isDarwin) [ libXrandr libXrender libXcomposite libXi libXcursor ] ++ optionals stdenv.isDarwin [ x11 libXdamage ] </ins> ++ libintlOrEmpty ++ optional xineramaSupport libXinerama ++ optionals cupsSupport [ cups ]; <del> configureFlags = "--with-xinput=yes"; </del> <ins> configureFlags = if stdenv.isDarwin then "--disable-glibtest --disable-introspection --disable-visibility" else "--with-xinput=yes"; </ins> postInstall = "rm -rf $out/share/gtk-doc";
{ stdenv, fetchurl, pkgconfig, glib, freetype, cairo, libintlOrEmpty , icu, graphite2 , withIcu ? false # recommended by upstream as default, but most don't needed and it's big <del> , withGraphite2 ? true # it is small and major distros do include it </del> <ins> , withGraphite2 ? !stdenv.isDarwin # it is small and major distros do include it </ins> }: # TODO: split non-icu and icu lib into different outputs?
enableParallelBuilding = true; <del> doCheck = true; </del> <ins> # jww (2014-05-05): The tests currently fail on Darwin: # # ERROR:testiter.c:139:iter_char_test: assertion failed: (extents.width == x1 - x0) # .../bin/sh: line 5: 14823 Abort trap: 6 srcdir=. PANGO_RC_FILE=./pangorc ${dir}$tst # FAIL: testiter doCheck = !stdenv.isDarwin; </ins> postInstall = "rm -rf $out/share/gtk-doc"; meta = {
buildCommand = "sed s/dot_root/agroot/g ${raw_patch} > $out"; }; # 2.42 has the patch included <del> patches = optional (lib.versionOlder version "2.42") patchToUse; </del> <ins> patches = optional (lib.versionOlder version "2.42") patchToUse ++ optionals (lib.versionOlder version "2.46.0") [ (fetchpatch { name = "CVE-2020-18032.patch"; url = "https://gitlab.com/graphviz/graphviz/-/commit/784411ca3655c80da0f6025ab20634b2a6ff696b.patch"; sha256 = "1nkw9ism8lkfvxsp5fh95i2l5s5cbjsidbb3g1kjfv10rxkyb41m"; }) ]; </ins> in stdenv.mkDerivation {
in { openvpn_24 = generic { <del> version = "2.4.9"; sha256 = "1qpbllwlha7cffsd5dlddb8rl22g9rar5zflkz1wrcllhvfkl7v4"; </del> <ins> version = "2.4.11"; sha256 = "06s4m0xvixjhd3azrzbsf4j86kah4xwr2jp6cmcpc7db33rfyyg5"; </ins> }; openvpn = generic { <del> version = "2.5.0"; sha256 = "sha256-AppCbkTWVstOEYkxnJX+b8mGQkdyT1WZ2Z35xMNHj70="; </del> <ins> version = "2.5.2"; sha256 = "sha256-sSdDg2kB82Xvr4KrJJOWfhshwh60POmo2hACoXycHcg="; </ins> }; }
<ins> diff --color -ur a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt	2021-05-30 13:46:22.256040282 +0200 +++ b/CMakeLists.txt	2021-05-30 14:15:42.530181216 +0200 @@ -333,7 +333,7 @@ # So, try first to find the CMake module provided by libxml2 package, then fallback # on the CMake's FindLibXml2.cmake module (which can lack some definition, especially # in static build case). -find_package(LibXml2 QUIET NO_MODULE) +find_package(LibXml2 QUIET MODULE) if(DEFINED LIBXML2_VERSION_STRING) set(LIBXML2_FOUND ON) set(LIBXML2_INCLUDE_DIR ${LIBXML2_INCLUDE_DIRS}) Seulement dans b: good.patch </ins>
sha256 = "0psw67mzysdb8fkh8xpcwicm7z94k8plkcc8ymxyvl6inshq0mc7"; }; <ins> # Revert after https://github.com/NixOS/nixpkgs/issues/125008 is # fixed properly patches = [ ./cmake-fix-libxml2-find-package.patch ]; </ins> nativeBuildInputs = [ cmake flex
Rglpk = [ pkgs.glpk ]; RGtk2 = [ pkgs.gtk2.dev ]; rhdf5 = [ pkgs.zlib ]; <del> Rhdf5lib = [ pkgs.zlib ]; </del> <ins> Rhdf5lib = [ pkgs.zlib.dev ]; </ins> Rhpc = [ pkgs.zlib pkgs.bzip2.dev pkgs.icu pkgs.xz.dev pkgs.mpi pkgs.pcre.dev ]; Rhtslib = [ pkgs.zlib.dev pkgs.automake pkgs.autoconf pkgs.bzip2.dev pkgs.xz.dev pkgs.curl.dev ]; rjags = [ pkgs.jags ];
index e2d292e..b13c0db 100755 --- a/configure +++ b/configure <del> @@ -2880,6 +2880,7 @@ $MAKE </del> <ins> @@ -3874,6 +3874,7 @@ </ins> echo "building the hdf5 library..."; cd ../; <del> ## we add the '-w' flag to suppress all the warnings hdf5 prints </del> +sed -i 's#/bin/mv#mv#' configure <del> ./configure --with-pic --enable-shared=no --enable-cxx  --with-szlib  CXX="${CXX}" CXFLAGS="${CXXFLAGS} -w"  </del> <ins> ./configure --with-pic --enable-shared=no --enable-cxx --enable-hl  --with-szlib=${SZIP_HOME} --with-zlib=${ZLIB_HOME}  ${WITH_S3_VFD}  </ins>
config = mkIf cfg.enable { environment.systemPackages = [ pkgs.auto-cpufreq ]; <del> systemd.packages = [ pkgs.auto-cpufreq ]; systemd.services.auto-cpufreq.path = with pkgs; [ bash coreutils ]; </del> <ins> systemd = { packages = [ pkgs.auto-cpufreq ]; services.auto-cpufreq = { # Workaround for https://github.com/NixOS/nixpkgs/issues/81138 wantedBy = [ "multi-user.target" ]; path = with pkgs; [ bash coreutils ]; }; }; </ins> }; }
python3Packages.buildPythonPackage rec { pname = "auto-cpufreq"; <del> version = "1.6.1"; </del> <ins> version = "1.6.4"; </ins> src = fetchFromGitHub { owner = "AdnanHodzic"; repo = pname; rev = "v${version}"; <del> sha256 = "sha256-oz3C1150CPfT0kkx1x7VIX/Rm06dkjyxeDPFCRJaWNc="; </del> <ins> sha256 = "sha256-9WYuAWcJGosYEsnnkqvZLXXvqF+1nBEozh6F84Kit6w="; </ins> }; propagatedBuildInputs = with python3Packages; [ click distro psutil ];
diff --git a/auto_cpufreq/core.py b/auto_cpufreq/core.py <del> index a685db8..1ca1ca1 100644 </del> <ins> index 83d0d64..04b5035 100644 </ins> --- a/auto_cpufreq/core.py +++ b/auto_cpufreq/core.py <del> @@ -72,7 +72,7 @@ def app_version(): print("Git commit:", check_output(["git", "describe", "--always"]).strip().decode()) else: print(getoutput("pacman -Qi auto-cpufreq | grep Version")) -    else: +    else: # source code (auto-cpufreq-installer) try: print("Git commit:", check_output(["git", "describe", "--always"]).strip().decode()) @@ -179,31 +179,13 @@ def get_current_gov(): return print("Currently using:", getoutput("cpufreqctl.auto-cpufreq --governor").strip().split(" ")[0], "governor") </del> <ins> @@ -204,35 +204,13 @@ def get_current_gov(): </ins> def cpufreqctl(): -    """
-    """ - -    # detect if running on a SNAP <del> -    if os.getenv('PKG_MARKER') == "SNAP": </del> <ins> -    if os.getenv("PKG_MARKER") == "SNAP": </ins> -        pass -    else: -        # deploy cpufreqctl.auto-cpufreq script -        if os.path.isfile("/usr/bin/cpufreqctl"): <del> -            shutil.copy(SCRIPTS_DIR / "cpufreqctl.sh", "/usr/bin/cpufreqctl.auto-cpufreq") </del> <ins> -            shutil.copy( -                SCRIPTS_DIR / "cpufreqctl.sh", "/usr/bin/cpufreqctl.auto-cpufreq" -            ) </ins> -        else: <del> -            shutil.copy(SCRIPTS_DIR / "cpufreqctl.sh", "/usr/bin/cpufreqctl.auto-cpufreq") </del> <ins> -            shutil.copy( -                SCRIPTS_DIR / "cpufreqctl.sh", "/usr/bin/cpufreqctl.auto-cpufreq" -            ) </ins> +    # scripts are already in the correct place +    pass
-    remove cpufreqctl.auto-cpufreq script -    """ -    # detect if running on a SNAP <del> -    if os.getenv('PKG_MARKER') == "SNAP": </del> <ins> -    if os.getenv("PKG_MARKER") == "SNAP": </ins> -        pass -    else: -        if os.path.isfile("/usr/bin/cpufreqctl.auto-cpufreq"):
+    # no need to restore +    pass def footer(l=79): <del> print("n" + "-" * l + "n") @@ -233,74 +215,12 @@ def remove_complete_msg(): footer() </del> <ins> @@ -276,76 +254,13 @@ def remove_complete_msg(): </ins> def deploy_daemon(): -    print("n" + "-" * 21 + " Deploying auto-cpufreq as a daemon " + "-" * 22 + "n")
-            f.seek(0) -            f.truncate() -            f.write(content.replace(orig_set, change_set)) <del> -    except: -        print("nERROR:nWas unable to turn off bluetooth on boot") </del> <ins> -    except Exception as e: -        print(f"nERROR:nWas unable to turn off bluetooth on bootn{repr(e)}") </ins> - -    auto_cpufreq_stats_path.touch(exist_ok=True) - -    print("n* Deploy auto-cpufreq install script") <del> -    shutil.copy(SCRIPTS_DIR / "auto-cpufreq-install.sh", "/usr/bin/auto-cpufreq-install") </del> <ins> -    shutil.copy( -        SCRIPTS_DIR / "auto-cpufreq-install.sh", "/usr/bin/auto-cpufreq-install" -    ) </ins> - -    print("n* Deploy auto-cpufreq remove script") -    shutil.copy(SCRIPTS_DIR / "auto-cpufreq-remove.sh", "/usr/bin/auto-cpufreq-remove") - -    call("/usr/bin/auto-cpufreq-install", shell=True) <del> - </del> +    # prevent needless copying and system changes +    pass # remove auto-cpufreq daemon def remove(): -
-            f.seek(0) -            f.truncate() -            f.write(content.replace(change_set, orig_set)) <del> -    except: -        print("nERROR:nWas unable to turn on bluetooth on boot") </del> <ins> -    except Exception as e: -        print(f"nERROR:nWas unable to turn on bluetooth on bootn{repr(e)}") </ins> - -    # run auto-cpufreq daemon install script -    call("/usr/bin/auto-cpufreq-remove", shell=True)
def gov_check(): for gov in get_avail_gov(): <del> @@ -331,7 +251,7 @@ def countdown(s): if auto_cpufreq_stats_file is not None: auto_cpufreq_stats_file.seek(0) auto_cpufreq_stats_file.truncate(0) - + # execution timestamp from datetime import datetime now = datetime.now() </del> diff --git a/scripts/cpufreqctl.sh b/scripts/cpufreqctl.sh index 63a2b5b..e157efe 100755 --- a/scripts/cpufreqctl.sh
]; in stdenv.mkDerivation rec { pname = "bluez"; <del> version = "5.59"; </del> <ins> version = "5.60"; </ins> src = fetchurl { url = "mirror://kernel/linux/bluetooth/${pname}-${version}.tar.xz"; <del> sha256 = "05kk8zdh3msf5j88jbai8m877rvya6fpkzhicfhv5gyhhsrrasq4"; </del> <ins> sha256 = "sha256-cQmZWA0B7lnsWF5efAf9lO3e3AAaom/nRkxUb52UUwQ="; </ins> }; buildInputs = [
patches = [ # https://phab.mercurial-scm.org/D10638, needed for below patch to apply (fetchpatch { <del> url = "https://phab.mercurial-scm.org/file/data/oymk4awh2dd7q6cwjbzu/PHID-FILE-bfcr7qrp5spg42wspxpd/D10638.diff"; </del> <ins> url = "https://phab.mercurial-scm.org/file/data/l7p2r4zcctcr3pzlybv2/PHID-FILE-bwjzxlz6sbegk3s4irik/D10638.diff"; </ins> sha256 = "0mfi324is02l7cnd3j0gbmg5rpyyqn3afg3f73flnfwmz5njqa5f"; }) # https://phab.mercurial-scm.org/D10639, fixes https://bz.mercurial-scm.org/show_bug.cgi?id=6514 (fetchpatch { <del> url = "https://phab.mercurial-scm.org/file/data/re4uqdhtknjiacx2ogwu/PHID-FILE-4m26id65dno5gzix2ngh/D10639.diff"; </del> <ins> url = "https://phab.mercurial-scm.org/file/data/v53nhburhtkhpccyecei/PHID-FILE-6v34oll6r2gkqo4ng5nt/D10639.diff"; </ins> sha256 = "0h5ilrd2x1789fr6sf4k1mcvxdh0xdyr94yawdacw87v3x12c8cb"; }) ];
# Enable libfabric support (necessary for Omnipath networks) on x86_64 linux , fabricSupport ? stdenv.isLinux && stdenv.isx86_64 <ins> # Enable Fortran support , fortranSupport ? !(stdenv.isDarwin && stdenv.isAarch64) </ins> }: assert !cudaSupport || cudatoolkit != null; let <del> version = "4.1.1"; </del> cudatoolkit_joined = symlinkJoin { name = "${cudatoolkit.name}-unsplit"; paths = [ cudatoolkit.out cudatoolkit.lib ]; }; in stdenv.mkDerivation rec { pname = "openmpi"; <del> inherit version; </del> <ins> version = "4.1.1"; </ins> src = with lib.versions; fetchurl { url = "https://www.open-mpi.org/software/ompi/v${major version}.${minor version}/downloads/${pname}-${version}.tar.bz2";
find -name "Makefile.in" -exec sed -i "s/`date`/$ts/" {} ; ''; <del> buildInputs = with stdenv; [ gfortran zlib ] ++ lib.optionals isLinux [ libnl numactl pmix ucx ] </del> <ins> buildInputs = [ zlib ] ++ lib.optionals fortranSupport [ gfortran ] ++ lib.optionals stdenv.isLinux [ libnl numactl pmix ucx ] </ins> ++ lib.optionals cudaSupport [ cudatoolkit ] ++ [ libevent hwloc ] <del> ++ lib.optional (isLinux || isFreeBSD) rdma-core </del> <ins> ++ lib.optional (stdenv.isLinux || stdenv.isFreeBSD) rdma-core </ins> ++ lib.optional fabricSupport [ libpsm2 libfabric ]; nativeBuildInputs = [ perl ]; <del> configureFlags = with stdenv; lib.optional (!cudaSupport) "--disable-mca-dso" ++ lib.optionals isLinux  [ </del> <ins> configureFlags = lib.optional (!cudaSupport) "--disable-mca-dso" ++ lib.optional (!fortranSupport) "--disable-mpi-fortran" ++ lib.optionals stdenv.isLinux  [ </ins> "--with-libnl=${libnl.dev}" "--with-pmix=${pmix}" "--with-pmix-libdir=${pmix}/lib"
sed -i 's:compiler=.*:compiler=${targetPackages.stdenv.cc}/bin/${targetPackages.stdenv.cc.targetPrefix}c++:'  $out/share/openmpi/mpic++-wrapper-data.txt <ins> '' + lib.optionalString fortranSupport '' </ins> sed -i 's:compiler=.*:compiler=${gfortran}/bin/${gfortran.targetPrefix}gfortran:'   $out/share/openmpi/mpifort-wrapper-data.txt
# fails to configure on darwin due to gmp not found configureFlags = [ "LIBS=-L${gmp}/lib" "CXXFLAGS=-I${gmp.dev}/include" ]; <del> # disable stackprotector on aarch64-darwin for now # https://github.com/NixOS/nixpkgs/issues/127608 hardeningDisable = lib.optionals (stdenv.isAarch64 && stdenv.isDarwin) [ "stackprotector" ]; </del> postPatch = '' sed -e "s@ /bin/bash@bash@g" -i Makefile.std find . -exec sed -e "s@/usr/bin/perl@${perl}/bin/perl@g" -i '{}' ';'
install_name_tool -change libblas.dylib ${blas}/lib/libblas.dylib $out/lib/libarpack.dylib ''; <del> # disable stackprotector on aarch64-darwin for now # https://github.com/NixOS/nixpkgs/issues/127608 hardeningDisable = lib.optionals (stdenv.isAarch64 && stdenv.isDarwin) [ "stackprotector" ]; </del> meta = { homepage = "https://github.com/opencollab/arpack-ng"; description = ''
)] ; <del> # disable stackprotector on aarch64-darwin for now # https://github.com/NixOS/nixpkgs/issues/127608 # # build error: # # /private/tmp/nix-build-sundials-6.3.0.drv-0/ccD2dUtR.s:21:15: error: index must be an integer in range [-256, 255]. #         ldr     x0, [x0, ___stack_chk_guard];momd #                          ^ # /private/tmp/nix-build-sundials-6.3.0.drv-0/ccD2dUtR.s:46:15: error: index must be an integer in range [-256, 255]. #         ldr     x0, [x0, ___stack_chk_guard];momd # # See also a proposed solution: https://github.com/NixOS/nixpkgs/pull/151983 hardeningDisable = lib.optionals (stdenv.isAarch64 && stdenv.isDarwin) [ "stackprotector" ]; </del> doCheck = true; checkTarget = "test";
<ins> # Adding Custom Packages {#sec-custom-packages} It's possible that a package you need is not available in NixOS. In that case, you can do two things. First, you can clone the Nixpkgs repository, add the package to your clone, and (optionally) submit a patch or pull request to have it accepted into the main Nixpkgs repository. This is described in detail in the [Nixpkgs manual](https://nixos.org/nixpkgs/manual). In short, you clone Nixpkgs: ```ShellSession $ git clone https://github.com/NixOS/nixpkgs $ cd nixpkgs ``` Then you write and test the package as described in the Nixpkgs manual. Finally, you add it to [](#opt-environment.systemPackages), e.g. ```nix environment.systemPackages = [ pkgs.my-package ]; ``` and you run `nixos-rebuild`, specifying your own Nixpkgs tree: ```ShellSession # nixos-rebuild switch -I nixpkgs=/path/to/my/nixpkgs ``` The second possibility is to add the package outside of the Nixpkgs tree. For instance, here is how you specify a build of the [GNU Hello](https://www.gnu.org/software/hello/) package directly in `configuration.nix`: ```nix environment.systemPackages = let my-hello = with pkgs; stdenv.mkDerivation rec { name = "hello-2.8"; src = fetchurl { url = "mirror://gnu/hello/${name}.tar.gz"; sha256 = "0wqd8sjmxfskrflaxywc7gqw7sfawrfvdxd9skxawzfgyy0pzdz6"; }; }; in [ my-hello ]; ``` Of course, you can also move the definition of `my-hello` into a separate Nix expression, e.g. ```nix environment.systemPackages = [ (import ./my-hello.nix) ]; ``` where `my-hello.nix` contains: ```nix with import <nixpkgs> {}; # bring all of Nixpkgs into scope stdenv.mkDerivation rec { name = "hello-2.8"; src = fetchurl { url = "mirror://gnu/hello/${name}.tar.gz"; sha256 = "0wqd8sjmxfskrflaxywc7gqw7sfawrfvdxd9skxawzfgyy0pzdz6"; }; } ``` This allows testing the package easily: ```ShellSession $ nix-build my-hello.nix $ ./result/bin/hello Hello, world! ``` </ins>
<del> <section xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude" version="5.0" xml:id="sec-custom-packages"> <title>Adding Custom Packages</title> <para> It’s possible that a package you need is not available in NixOS. In that case, you can do two things. First, you can clone the Nixpkgs repository, add the package to your clone, and (optionally) submit a patch or pull request to have it accepted into the main Nixpkgs repository. This is described in detail in the <link xlink:href="https://nixos.org/nixpkgs/manual">Nixpkgs manual</link>. In short, you clone Nixpkgs: <screen> <prompt>$ </prompt>git clone https://github.com/NixOS/nixpkgs <prompt>$ </prompt>cd nixpkgs </screen> Then you write and test the package as described in the Nixpkgs manual. Finally, you add it to <literal>environment.systemPackages</literal>, e.g. <programlisting> <xref linkend="opt-environment.systemPackages"/> = [ pkgs.my-package ]; </programlisting> and you run <command>nixos-rebuild</command>, specifying your own Nixpkgs tree: <screen> <prompt># </prompt>nixos-rebuild switch -I nixpkgs=/path/to/my/nixpkgs</screen> </para> <para> The second possibility is to add the package outside of the Nixpkgs tree. For instance, here is how you specify a build of the <link xlink:href="https://www.gnu.org/software/hello/">GNU Hello</link> package directly in <filename>configuration.nix</filename>: <programlisting> <xref linkend="opt-environment.systemPackages"/> = let my-hello = with pkgs; stdenv.mkDerivation rec { name = "hello-2.8"; src = fetchurl { url = "mirror://gnu/hello/${name}.tar.gz"; sha256 = "0wqd8sjmxfskrflaxywc7gqw7sfawrfvdxd9skxawzfgyy0pzdz6"; }; }; in [ my-hello ]; </programlisting> Of course, you can also move the definition of <literal>my-hello</literal> into a separate Nix expression, e.g. <programlisting> <xref linkend="opt-environment.systemPackages"/> = [ (import ./my-hello.nix) ]; </programlisting> where <filename>my-hello.nix</filename> contains: <programlisting> with import &lt;nixpkgs> {}; # bring all of Nixpkgs into scope stdenv.mkDerivation rec { name = "hello-2.8"; src = fetchurl { url = "mirror://gnu/hello/${name}.tar.gz"; sha256 = "0wqd8sjmxfskrflaxywc7gqw7sfawrfvdxd9skxawzfgyy0pzdz6"; }; } </programlisting> This allows testing the package easily: <screen> <prompt>$ </prompt>nix-build my-hello.nix <prompt>$ </prompt>./result/bin/hello Hello, world! </screen> </para> </section> </del>