{"id":18005529,"url":"https://github.com/eikek/devshell-tools","last_synced_at":"2025-04-04T10:42:12.234Z","repository":{"id":226486146,"uuid":"767204586","full_name":"eikek/devshell-tools","owner":"eikek","description":"A collection of tools for creating dev environments with nix flakes","archived":false,"fork":false,"pushed_at":"2025-02-04T11:25:09.000Z","size":73,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-04T12:27:11.667Z","etag":null,"topics":["devenvironments","nix","nix-flake"],"latest_commit_sha":null,"homepage":"","language":"Nix","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eikek.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-03-04T22:05:07.000Z","updated_at":"2025-02-04T11:25:13.000Z","dependencies_parsed_at":"2024-05-22T08:44:41.331Z","dependency_job_id":"b5506c39-ac28-4858-8e89-ea4f7f7188ca","html_url":"https://github.com/eikek/devshell-tools","commit_stats":null,"previous_names":["eikek/devshell-tools"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eikek%2Fdevshell-tools","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eikek%2Fdevshell-tools/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eikek%2Fdevshell-tools/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eikek%2Fdevshell-tools/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eikek","download_url":"https://codeload.github.com/eikek/devshell-tools/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247166092,"owners_count":20894652,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["devenvironments","nix","nix-flake"],"created_at":"2024-10-30T00:20:03.809Z","updated_at":"2025-04-04T10:42:12.216Z","avatar_url":"https://github.com/eikek.png","language":"Nix","funding_links":[],"categories":[],"sub_categories":[],"readme":"# devshell tools\n\nThis is a collection of tools for creating dev environments with nix\nflakes. It doesn't create something new, but relies on NixOS modules\nand nixpkgs. The flake provides services that are only a wrapper\naround existing ones with an opinionated config towards ease of use in\na dev environment.\n\n## Usage\n\nA template is provided to get started:\n```shell\nnix flake init -t github:eikek/devshell-tools\n```\n\nThe flake provides several modules that can be used selectively. There\nare two functions that create vm or a container with all modules\nincluded. You could use it like this:\n\n```nix\n  inputs.devshell-tools.url = ...\n  ...\n  nixosConfigurations = {\n    dev-vm = devshell-tools.lib.mkVm {\n      system = \"x86_64-linux\";\n      modules = [\n        {\n          services.dev-solr.enable = true;\n          services.dev-email.enable = true;\n          services.dev-postgres.enable = true;\n          services.dev-mariadb.enable = true;\n          services.openapi-docs.enable = true;\n        }\n      ];\n    };\n    container = devshell-tools.lib.mkContainer {\n      system = \"x86_64-linux\";\n      modules = [\n        {\n          services.dev-solr.enable = true;\n          services.dev-email.enable = true;\n          services.dev-postgres.enable = true;\n          services.dev-mariadb.enable = true;\n          services.openapi-docs.enable = true;\n        }\n      ];\n    };\n  }\n```\n\nThe vm has a root account with password `root`. Additionally, a\npasswordless ssh key is configured.\n\nIn your module you can then enable and configure the provided modules.\n\nThe vm adds port-forwarding to the services by default. This can be\nchanged in your module using the supplied shortcuts:\n\n```nix\nport-forward.ssh = 10022;\nport-forward.dev-postgres = 6543;\nport-forward.dev-smtp = 1587;\nport-forward.dev-imap = 1143;\nport-forward.dev-webmail = 8080;\n…\n```\n\nWith this, it is possible to ssh into the vm from port `10022` on the\nhost for example. Of course, the standard\n`virtualisation.forwardPorts` can be used as well.\n\n## Content\n\n### Packages\n\n#### solr\n\nNixpkgs dropped solr. So a simple package is included here.\n\n#### swagger-ui\n\nPackages the swagger-ui npm package to render openAPI specs in the\nbrowser. It is used by the `openapi-docs` package and module.\n\n#### openapi-docs\n\nUses `swagger-ui` to provide a simple script that accepts an url to an\nopenapi specification and will render its documentation in the\nbrowser by starting a simple http server.\n\n#### vm scripts\n\nA collection of small scripts to manage development vms that are\ndefined as `nixosConfigurations` in your flake. They are just some\nconvenience shortcuts to a bit longer nix commands.\n\nFor example, `vm-build` runs `nix build\n\".#nixosConfigurations.$name.config.system.build.vm\"` where `$name` is\nthe value of `DEV_VM` environment variable, or the default `dev-vm`.\nThis name must have a corresponding `nixosConfiguration` to build.\n\nThe vm-scripts all start with `vm-` for easier lookup. They are\nprovided as `vm-scripts` attribute set in `legacyPackages` so they can\nbe installed all at once.\n\nExample use:\n```nix\ninputs.devshell-tools.url = …\n\ndevShells.default = {\n  buildInputs = builtins.attrValues devshell-tools.legacyPackages.${system}.vm-scripts;\n};\n```\n\n#### postgres-fg\n\nThis package provides a simple shell script to start a postgresql\nserver given any data directory and port. It might be handy for\nquickly running postgres ad-hoc.\n\n#### cnt scripts\n\nA collection of small scripts to manage dev containers that are\ndefined as `nixosConfigurations` in your flake.\n\nFor example, `cnt-recreate` deletes an existing container, creates it\nanew and starts it. The container name is taken from the\n`DEV_CONTAINER` environment variable or defaults to `dev-cnt`. If no\ncontainer name is given it uses either `dev-cnt` or `container` if\n`dev-cnt` is not defined in `nixosConfigurations`.\n\nThe cnt-scripts all start with `cnt-` for easier lookup. They are\nprovided as `cnt-scripts` attribute set in `legacyPackages` so they\ncan be installed all at once.\n\nExample use:\n```nix\ninputs.devshell-tools.url = …\n\ndevShells.default = {\n  buildInputs = builtins.attrValues devshell-tools.legacyPackages.${system}.cnt-scripts;\n};\n```\n\n### Lib\n\nThe `lib` output has a few function that might be interesting to use\nin devshells.\n\n- `installScript`: Takes a script file as input, makes it executable\n  and puts it into the store behind a `bin/` path so it will be in\n  your environment. Like `writeScript` but referencing some file\n  instead of defining inline.\n\n- `mkVm` and `mkContainer`: Given a list of additional modules (and\n  `system`…), it creates a NixOS container or vm that has all packages\n  and modules of this flake included.\n\n### Modules\n\n#### SpiceDB\n\nThe `dev-spicedb` module enables spicedb with a preshared-key `dev`.\nIt depends on `dev-postgres` as it storage creating a `spicedb`\npostgres database.\n\n#### Authentik\n\nEnables authentik with user `akadmin` and password `dev`. It depends\non `dev-postgres` and `dev-redis`. The default port for the web\ninterface is 9010.\n\n#### keycloak\n\nEnables keycloak with http-only and an initial admin user with\npassword `dev`. It make use of the `dev-postgres` module to setup the\ndatabase by including a `keycloak` database. The default port\nconfigured is `8180`.\n\n#### solr\n\nThere is a very simple module that allows to run solr on systemd. It\nallows only a few configurations, but should be enough for\ndevelopment.\n\n\n#### postgresql\n\nEnables PostgreSQL with settings to be able to connect to it from\nanywhere. It creates a user `dev` with password `dev`.\n\nAdditionally, `pgweb` is enabled by default on port `5433` for the\nfirst database specified for dev-postgres or the one given to the\npgweb config.\n\n#### mariadb\n\nEnables MariaDB with settings to be able to connect to it easily. It\ncreates a user `dev` with password `dev`.\n\n\n#### email\n\nThe email modules configures a complete email setup: exim for smtp,\ndovecot2 for imap and roundcube for webmail.\n\nThe services are configured to allow anyone to login while the\npassword is the same as the user name.\n\nUsers are created on demand in dovecot. So in order to be able to send\nmail to a user, you need to login once so dovecot can create the user\ndirectory.\n\nRoundcube is configured inside nginx to access the mails of all users.\nIt connects to the internal dovecot and exim services. It has been\npatched to allow non-standard email addresses, so it can send to\n`myuser@localhost` for example and it is then possible to test bad\ninput more easily.\n\n#### redis\n\nSets up a redis instances with global access. Only the instance name\nand port must be defined. Example\n\n```nix\nservices.dev-redis = {\n  enable = true;\n  instances = {\n    myredis = {\n      port = 6379;\n    };\n    otherredis = {\n      port = 6380;\n    };\n  };\n};\n```\n\n#### minio\n\nSets up minio with the defaults, root user \"minioadmin\" and same\npassword.\n\n#### OpenAPI Docs\n\nGiven an URL to a open api spec, sets up nginx to serve the rendered\ndocumentation page.\n\n#### Jena Fuseki\n\nSets up a fuseki rdf server.\n\n## Dev\n\nBuild the test container for trying out stuff:\n```\nnix build .#nixosConfigurations.devshcnt.config.system.build.toplevel\n```\n\nRun the test, create a container and start it:\n```\nsudo nixos-container create devshcnt --flake .#devshcnt\nsudo nixos-container start devshcnt\n```\n\nor use the development shell and the provided scripts `cnt-recreate`\nand `cnt-login`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feikek%2Fdevshell-tools","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feikek%2Fdevshell-tools","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feikek%2Fdevshell-tools/lists"}