Giter Site home page Giter Site logo

dev-templates's People

Contributors

573 avatar bwkam avatar derekbelrose avatar drupol avatar g0dm0d avatar jakuzure avatar joelbenway avatar lucperkins avatar nothingmuch avatar sstubbs avatar ymgyt avatar yvieta avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dev-templates's Issues

difference with nix-flake-dev-environments

Hi, I don't really understand the difference between this repo and nix-flake-dev-environments.
They seem to deserve a pretty similar objective.
In my case, I set up a small shell function to be able to set up quickly dev env.

nix-quick () {
        nix flake new --template github:the-nix-way/dev-templates#$1 $2
}

Should I create two function for the two repos ?

Automate update flake.lock

Can you please add a workflow to the .github/workflows directory that automatically update the flake lock files? So if you initialize a template (for example rust) you get the newest version?

Add empty template

I don't think it is feasible to provide template for every single use case, so having an 'empty' template which would not contain any dependencies and give users ability to start with empty list of packages would be great.

rust-analyzer support in vscode

rust-analyzer support in vscode

In order for rust analyzer fails because it needs rust-src. Using oxalica's cheat-sheet, I was able to achieve that. However, I am unsure if this is the optimal way to do so, so I'm merely reproducing it below.

{
  description = "A Nix-flake-based Rust development environment";

  inputs = {
    flake-utils.url = "github:numtide/flake-utils";
    nixpkgs.url = "github:NixOS/nixpkgs";
    rust-overlay.url = "github:oxalica/rust-overlay";
  };

  outputs =
    { self
    , flake-utils
    , nixpkgs
    , rust-overlay
    }:

    flake-utils.lib.eachDefaultSystem (system:
    let
      overlays = [
        (import rust-overlay)
        (self: super: {
          rustToolchain =
            let
              rust = super.rust-bin;
              toolchain =
                if builtins.pathExists ./rust-toolchain.toml then
                  rust.fromRustupToolchainFile ./rust-toolchain.toml
                else if builtins.pathExists ./rust-toolchain then
                  rust.fromRustupToolchainFile ./rust-toolchain
                else
                  rust.stable.latest.default;
            in
            toolchain.override {
              extensions = [ "rust-src" ];
            };
        })
      ];

      pkgs = import nixpkgs { inherit system overlays; };
    in
    {
      devShell = pkgs.mkShell {
        nativeBuildInputs = with pkgs; [
          rustToolchain
          # rust-src
          openssl
          pkg-config
          cargo-audit
          cargo-deny
          cargo-cross
          rust-analyzer
        ] ++ pkgs.lib.optionals (pkgs.stdenv.isLinux) (with pkgs; [ cargo-watch ]); # Currently broken on macOS

        shellHook = ''
          ${pkgs.rustToolchain}/bin/cargo --version
        '';
      };
    });
}

Tweaked Python file throws error

I ended up with this:

flake-utils.lib.eachDefaultSystem (system:
    let
      # overlays = [
      #   (self: super: {
      #     python = super.python311;
      #   })
      # ];

      # pkgs = import nixpkgs { inherit overlays system; };
      pkgs = import nixpkgs { inherit system; };
    in
    {
      devShells.default = pkgs.mkShell {
        packages = with pkgs; [ python311 virtualenv protobuf ] ++
          (with pkgs.python311Packages; [ pip protobuf ]);

        shellHook = ''
          ${pkgs.python}/bin/python --version
        '';
      };
    });

Don't really see the point of the overlay or of mach-nix.

which is giving me this error:

error: builder for '/nix/store/8v2nc3j1z6m1k3fzw51nn8sxlmxjp0h0-python3.11-pyext-0.8.drv' failed with exit code 1;
       last 10 log lines:
       > Executing setuptoolsBuildPhase
       > Traceback (most recent call last):
       >   File "/private/tmp/nix-build-python3.11-pyext-0.8.drv-0/source/nix_run_setup", line 8, in <module>
       >     exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\\r\\n', '\\n'), __file__, 'exec'))
       >   File "setup.py", line 6, in <module>
       >     import pyext
       >   File "/private/tmp/nix-build-python3.11-pyext-0.8.drv-0/source/pyext.py", line 118, in <module>
       >     oargspec = inspect.getargspec
       >                ^^^^^^^^^^^^^^^^^^
       > AttributeError: module 'inspect' has no attribute 'getargspec'. Did you mean: 'getargs'?
       For full logs, run 'nix log /nix/store/8v2nc3j1z6m1k3fzw51nn8sxlmxjp0h0-python3.11-pyext-0.8.drv'.
error: 1 dependencies of derivation '/nix/store/45hvqqc10rgqjyn716cpb23x3xf2qhq1-python3.11-protobuf-4.21.8.drv' failed to build
error: 1 dependencies of derivation '/nix/store/ixisv4p5j0yw8l9d8a372x7xg3gyic5q-nix-shell-env.drv' failed to build

Not sure what is happening here.

Elixir flake does not work on Linux

Hi thanks a ton for these templates, they have been very helpful.

When I tried the elixir template it did not work on Linux as it tries to install the mac packages, it looks like it was just missing some braces.

I will open a PR if that helps.

Thanks again for your efforts.

Rust template: nixpkgs is a thunk while a string, Boolean, or integer is expected

It seems that there is a superfluous inputs in the inputs {} of the rust template.

How to reproduce:

nix flake new --template "github:the-nix-way/dev-templates#rust" test_project
direnv allow test_project
cd test_project

The error will be:

direnv: using flake
error:
       … while evaluating flake attribute 'nixpkgs'

         at /nix/store/w0rll2jadma2hc6fjmfmb69fjhlqz7n6-source/flake.nix:5:5:

            4|   inputs = {
            5|     inputs.nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1.*.tar.gz";
             |     ^
            6|     rust-overlay = {

       error: flake input attribute 'nixpkgs' is a thunk while a string, Boolean, or integer is expected

How can I add an unfree dependency to `buildInputs`?

Like jetbrains.idea-ultimate ref option b) below:

error: Package ‘idea-ultimate-2022.1.3’ in /nix/store/vxkgqbm8k5l9b6kp66dzcrb2w7qgdbgg-source/pkgs/applications/editors/jetbrains/default.nix:123 has an unfree license (‘unfree’), refusing to evaluate.

       a) To temporarily allow unfree packages, you can use an environment variable
          for a single invocation of the nix tools.

            $ export NIXPKGS_ALLOW_UNFREE=1

        Note: For `nix shell`, `nix build`, `nix develop` or any other Nix 2.4+
        (Flake) command, `--impure` must be passed in order to read this
        environment variable.

       b) For `nixos-rebuild` you can set
         { nixpkgs.config.allowUnfree = true; }
       in configuration.nix to override this.

       Alternatively you can configure a predicate to allow specific packages:
         { nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
             "idea-ultimate"
           ];
         }

       c) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add
         { allowUnfree = true; }
       to ~/.config/nixpkgs/config.nix.
(use '--show-trace' to show detailed location information)
direnv: nix-direnv: renewed cache
direnv: export ~XDG_DATA_DIRS

Support for both LTS and latest node version?

The node template is currently set to use version 18, which is the current LTS version of node (actually 18.16.0, but that's a nixpkgs channel cutoff issue). It would be great to have a template for both LTS and the latest release, although I am not sure this is possible without switching to nixpkgs unstable/master.

Perhaps we could add an unstable input to the flake and use that explicitly?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.