cross-posted from: https://group.lt/post/30446

1652 contributors, who authored 30371 commits since the previous release.

NixOS is already known as the most up to date distribution while also being the distribution with the most packages.

This release saw 16678 new packages and 14680 updated packages in nixpkgs. We also removed 2812 packages in an effort to keep the package set maintainable and secure. In addition to packages the NixOS distribution also features modules and tests that make it what it is. This release brought 91 new modules and removed 20. In that process we added 1322 options and removed 487.

    • wiki_me@lemmy.ml
      link
      fedilink
      arrow-up
      1
      ·
      2 years ago

      I looked at, it seems way more complex, it is still experimental and last i checked it does not have official documentation, nix-channel works now and is a lot simpler so i will stick to that for now. hopefully when it will be mature they will have an option to make it dead simple for busy people who just want a leaner flatpak, something like specifying a single line in the file:

      main-channel: https://nixos.org/channels/nixos-22.05

      • Yuu Yin@group.ltOP
        link
        fedilink
        arrow-up
        1
        ·
        edit-2
        2 years ago

        https://nixos.org/manual/nix/unstable/command-ref/new-cli/nix3-flake.html

        or man nix3-flake.

        For a NixOS flake example: https://git.sr.ht/~misterio/nix-config/tree/main/item/flake.nix

        For specific language examples https://github.com/NixOS/templates (which you can nix flake new my-project-name --template "templates#template-name". For real examples https://sourcegraph.com/search?q=context:global+.*+file:flake.nix+lang:Nix&patternType=regexp&sm=1

        here a pytorch example when I was learning Flakes

        # https://nixos.org/manual/nix/unstable/command-ref/new-cli/nix3-flake.html
        # https://discourse.nixos.org/t/pytorch-cuda-on-wsl/18267
        # https://discourse.nixos.org/t/pytorch-and-cuda-torch-not-compiled-with-cuda-enabled/11272
        # https://gitlab.com/abstract-binary/nix-nar-rs/-/blob/main/flake.nix
        # https://github.com/hasktorch/libtorch-nix
        # https://github.com/google-research/dex-lang/blob/main/flake.nix
        # https://yuanwang.ca/posts/getting-started-with-flakes.html
        
        {
          description = "PyTorch";
        
          # Specifies other flakes that this flake depends on.
          inputs = {
            devshell.url = "github:numtide/devshell";
            utils.url = "github:numtide/flake-utils";
            nixpkgs.url = "github:nixos/nixpkgs/nixos-22.11";
          };
        
          # Function that produces an attribute set.
          # Its function arguments are the flakes specified in inputs.
          # The self argument denotes this flake.
          outputs = inputs@{ self, nixpkgs, utils, ... }:
            (utils.lib.eachSystem [ "x86_64-linux" ] (system:
              let
                pkgs = (import nixpkgs {
                  inherit system;
                  config = {
                    # For CUDA.
                    allowUnfree = true;
                    # Enables CUDA support in packages that support it.
                    cudaSupport = true;
                  };
                });
              in rec {
                # Executed by `nix build .#<name>`
                packages = utils.lib.flattenTree {
                  hello = pkgs.hello;
                };
        
                # Executed by `nix build .`
                defaultPackage = packages.hello;
                # defaultPackage = pkgs.callPackage ./default.nix { };
        
                # Executed by `nix develop`
                devShell = with pkgs; mkShell {
                  buildInputs = ([
                    python39 # numba-0.54.1 not supported for interpreter python3.10
                  ] ++ (with python39.pkgs; [
                    inflect
                    librosa
                    pip
                    pytorch-bin
                    unidecode
                  ]) ++ (with cudaPackages; [
                    cudatoolkit
                  ]));
        
                  shellHook = ''
                    export CUDA_PATH=${pkgs.cudatoolkit}
                  '';
                };
              }
            ));
        }
        

        nix-channel works now and is a lot simpler

        It is not. Once you understand flakes, you will see how much better it is. If you do not understand why flakes exist to begin with, read https://www.tweag.io/blog/2020-05-25-flakes/

        also use in conjunction with flakes:

        • direnv, nix-direnv
        • devshell
        • wiki_me@lemmy.ml
          link
          fedilink
          arrow-up
          0
          ·
          2 years ago

          I read the article, flakes sound like an interesting solution that could make it a lot easier to contribute to open source projects (which reportedly often causes an increase in contributions).

          With that said, nix-channel still seems like a simpler (by simpler i mean easier to learn and use) at least for simple use case of replacing flatpak , I still don’t know how to replace nix-channel with it, I am not really trying hard but the bottom line it is hard to compete with the ease of use/learning of just doing:

          nix-channel --add some_channel nix-channel --update