{"id":19847760,"url":"https://github.com/kkharji/nixenv","last_synced_at":"2026-02-25T22:04:15.550Z","repository":{"id":42201050,"uuid":"449841001","full_name":"kkharji/nixenv","owner":"kkharji","description":"Nix Library for creating OS independent Systems.","archived":false,"fork":false,"pushed_at":"2022-07-05T07:48:53.000Z","size":71,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-02-06T21:25:34.865Z","etag":null,"topics":["nix","nixos"],"latest_commit_sha":null,"homepage":"","language":"Nix","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kkharji.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-01-19T20:14:01.000Z","updated_at":"2023-09-26T15:48:53.000Z","dependencies_parsed_at":"2022-07-10T20:34:17.804Z","dependency_job_id":null,"html_url":"https://github.com/kkharji/nixenv","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/kkharji/nixenv","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kkharji%2Fnixenv","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kkharji%2Fnixenv/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kkharji%2Fnixenv/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kkharji%2Fnixenv/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kkharji","download_url":"https://codeload.github.com/kkharji/nixenv/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kkharji%2Fnixenv/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29842875,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-25T21:18:31.832Z","status":"ssl_error","status_checked_at":"2026-02-25T21:18:29.265Z","response_time":61,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["nix","nixos"],"created_at":"2024-11-12T13:15:04.767Z","updated_at":"2026-02-25T22:04:15.535Z","avatar_url":"https://github.com/kkharji.png","language":"Nix","readme":"# NixEnv\n\nNix Flake Library to create Nix-based system regardless of system architecture or context. (EXPERIMENTAL)\n\n## Status:\n\nWorking on Darwin. Further tests required.\n\n## Concepts\n\n- **Top-level Profiles/Hosts**: The main entry to the setup. This is mixed within\n  profile directory, but unlike profiles it returns a derivation that will be\n  injected.\n- **Profile**: A collection of modules or configurations categorized by a profile.\n  For example, a desktop profile might have only desktop related packages,\n  modules, and/or configurations.\n- **Module**: A set of options and processors for theses options. For example,\n  an bash module might contain a set of options to control the bash environment\n  + ways to set configuration based on the options provided in **Top-level\n  Profiles/hosts**\n- **Patches**: Same as modules in term of being injected to user environment,\n  but unlike modules they directly override context options.\n- **Packages**: additional packages not available in nixpkgs.\n- **Overlays**: modifications to packages available in nixpkgs.\n\n## Examples\n\n- [My Personal setup](https://github.com/kkharji/system)\n\n\n## Getting Started\n\n### Detailed flake\n```nix\n{\n  description = \"My awesome Setup.\";\n  inputs = {\n    # Required: Avoid following master to avoid breaking changes\n    nixenv.url = \"github:kkharji/nixenv/release-1.0\";\n\n    # Require: nixpkgs source.\n    nixpkgs.url = \"github:nixos/nixpkgs/master\";\n\n    # Require: home-manager source.\n    home-manager = {\n      url = \"github:nix-community/home-manager\";\n      inputs.nixpkgs.follows = \"nixpkgs\";\n    };\n\n    # Require: darwin source.\n    nix-darwin = {\n      url = \"github:lnl7/nix-darwin\";\n      inputs.nixpkgs.follows = \"nixpkgs\";\n    };\n\n    # Optional example Overlays:\n    nur.url = \"github:nix-community/nur\";\n    neovim-nightly.url = \"github:nix-community/neovim-nightly-overlay\";\n\n    # Optional example packages\n    mkalias.url = \"github:reckenrode/mkalias\";\n\n    # Custom modules TODO: support\n    base16.url = \"github:kkharji/base16\";\n  };\n  outputs = { self, ... }@inputs:\n    inputs.nixenv.lib.commonSystem {\n      inherit inputs;\n      # Optional: List of context to generate for,\n      # default: \"homeManagerConfigurations\" \"nixosConfigurations\"\n      # \"darwinConfigurations\". Do not set empty!!!.\n      context = [ ];\n\n      # Optional: List of system to generate for, default all systems defined\n      # in nixpkgs. Do not set empty!!!.\n      systems = [ ];\n\n      # List of overlays provided by packages such as neovim-nightly;\n      overlays = [ inputs.nur.overlay inputs.neovim-nightly.overlay ];\n\n      # List of external modules. modules key must provide home,darwin,common like local modules\n      # NOTE: not support yet\n      modules = [ inputs.base16.modules ];\n\n      # EXPERIMENTAL: Injects variable called xpkgs to access x86 packages in\n      # aarch64 systems. for when users can run the x86 packages and some\n      # packages are not yet supported\n      injectX86AsXpkgs = false;\n\n      # List of additional packages to be made merge into system pkgs.\n      packages = [ inputs.mkalias.packages ];\n\n      # Optional: Nix Configuration\n      configs.nix = {\n        binaryCaches = [ \"https://cachix.cachix.org\" ];\n        extraOptions = \"experimental-features = nix-command flakes\"; # This is the default.\n      };\n\n      # Optional: Nix-Darwin configuration\n      configs.darwin = {\n        # Required for multi-user installation.\n        multi-user = false;\n      };\n\n      # Optional: NixPkgs Configuration\n      configs.nixpkgs = { allowUnfree = true; };\n\n      # Optional: Home-Manager Configuration\n      configs.home-manager = { useGlobalPkgs = true; };\n\n      # Roots doesn't have to exists to be defined here. define and create them later when you need them.\n      # Where modules to be found.\n      # NOTE!: modules are defined in keys { home, darwin, nixos, common };\n      roots.modules = ./modules;\n\n      # Where services are found. same as modules, but logical for services.\n      roots.services = ./services;\n\n      # Where patches to be found. Pretty much like modules, except it\n      # directly modifies contexts in some way.\n      # Do not return a derivation!, but similar to modules.\n      roots.patches = ./patches;\n\n      # Where profiles and top-level derivations to be found.\n      # Profiles are an additional abstraction layer for grouping modules.\n      # NOTE!: Profiles that return derivations will be used as top level profile. i.e. to setup system.\n      roots.profiles = ./profiles;\n\n      # Where overlays are found. overlay should return (final: prev: attrs)\n      roots.overlays = ./overlays;\n\n      # Where additional packages are to be found. Each file must export a\n      # derivation that can be processed by typical callPackage function.\n      roots.packages = ./packages;\n    };\n}\n```\n\n### Minimal flake:\n\n```nix\n{\n  description = \"Personal development and work environment.\";\n  inputs = {\n    # Required: Avoid following master to avoid breaking changes\n    nixenv.url = \"github:kkharji/nixenv/release-1.0\";\n    nixpkgs.url = \"github:nixos/nixpkgs/nixpkgs-unstable\";\n    nix-darwin.url = \"github:lnl7/nix-darwin\";\n    home-manager.url = \"\"github:nix-community/home-manager\";\n  };\n  outputs = { self, ... }@inputs:\n    inputs.nix-env.lib.commonSystem {\n      inherit inputs;\n      overlays = [ ];\n      packages = [ ];\n      configs = {\n        nix.extraOptions = \"experimental-features = nix-command flakes\";\n        nix.binaryCaches = [ \"https://cachix.cachix.org\" ];\n        nixpkgs.allowUnfree = true;\n        nix-darwin.multi-user = true;\n        home-manager.useGlobalPkgs = true;\n      };\n      roots = {\n        modules = ./modules;\n        patches = ./patches;\n        profiles = ./profiles;\n        overlays = ./overlays;\n        packages = ./packages;\n      };\n    };\n}\n```\n\n## Example Profile\n```nix\n{ pkgs, ... }: {\n  # Common Context i.e. darwin or nixos.\n\n  # If this isn't defined, profile name will be used as username.\n  nixenv.username = \"kkharji\";\n\n  nixenv.home = { pkgs, ... }: {\n    # Home Manager Context\n  };\n}\n```\n\n## Usage\n\nBuild main profile, or `./\u003cprofiles-path\u003e/main` `./\u003cprofiles-path\u003e/main.nix`\n\n```bash\n# Build nixos system\nnix build .\\#nixosConfigurations.main\n\n# Build home-manager\nnix build .\\#homeManagerConfigurations.main\n\n# Build darwin\nnix build .\\#darwinConfigurations.main\n```\n\n## Credit\n\n- [@EdenEast](https://github.com/EdenEast/nyx)\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkkharji%2Fnixenv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkkharji%2Fnixenv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkkharji%2Fnixenv/lists"}