Skip to content

rencire/devix

Repository files navigation

About

Devix is a project created to easily setup and configure your develoepr environment. This is done through configuring "devProfiles" and "devModules" in a nix flake file.

Getting Started

Quickstart

1.Create a new project nix template...

nix flake new -t github:rencire/devix/main#minimal <your_project>

or initialize exsting project with template in your project directory:

cd <your_project>
nix flake init -t github:rencire/devix/main#minimal

Note: Replace "minimal" with the template you want. See templates folder for details.

  1. Go to <your_project> and allow direnv to autoload your shell
direnv allow
  1. Modify flake.nix with modules and settings for your proejct (See below section for example)

  2. Save file, return to shell, and watch your dependencies download automatically.

Example flake

You can call this flake directly and enable modules as needed from your flake.nix. Here's an example creating a developer environment with android module:

{
  inputs.devix.url = "github:rencire/devix";
  outputs = { devix, ... }: devix ./. {
    # Developer profiles available under `devProfiles`.
    inherit inputs;
    systems = [
      # Add systems for your machine here
      "aarch64-darwin"
    ];
    # This is main attribute set where we define our developer environment settings
    devProfiles = {
      android-dev-env = {
        enable = true;
        # See  module/android for available options
        platform.versions = [ "34" ];
        abis = [
          "arm64-v8a"
        ];
      };
    };
    # Can add other nix flake outputs attributes here
  };
}

Alternatively, if you're already using flakelight, you can add devix as a flakelight module. This is useful if you also have other flakelight modules to import:

{
  inputs = {
    flakelight.url = "github:nix-community/flakelight";
    devix.url = "github:rencire/devix";
  };
  outputs = { flakelight, flakelight-rust, ... }: flakelight ./. {
    imports = [
      devix.flakelightModules.default
      # Add other flakelight modules here
    ];
    devProfiles = {
       # Devix profile settings here
    };
    # Rest of nix flake configuration goes here...
  };
}

Other than devProfiles and devModules, you can add other standardflakelight/nix flake attributes as well.

Here's an example with devShell:

{
  inputs.devix.url = "github:rencire/devix";
  outputs = { devix, ... }: devix ./. {
    # Developer profiles and modules available under `devProfiles` and `devModules`.
    inherit inputs;
    systems = [
      # Add systems for your machine here
      "aarch64-darwin"
    ];
    # This is main attribute set where we define our module settings
    devProfiles = {
    # Dev profile settings here. Most likely would use this over `devModules`
    };
    devModules = {
    # Dev module settings here. 
    };
    # Can add other nix flake outputs attributes here.  
    devShell = pkgs: {
      packages = with pkgs; [hello];
      env = {
        MY_ENV_VAR = "my env var";
      }
      shellHook = ''
        echo $MY_ENV_VAR
      '';
    }
  };
}

Note: These attributes tend to accept a function with pkgs available, since devix itself is a flakelight module.

Resources

About

Configure your nix flake developer shell with developer profiles and modules

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published