Create development shells

Only with the basics for now. I've yet to explore more complex use cases
such as the following repos:

- https://github.com/GTrunSec/Coding-Dev-Env-With-NixFlake
- https://github.com/LavaDesu/flakes

This seems nifty feature especially when doing some project spelunking
or something.
This commit is contained in:
Gabriel Arazas 2021-12-13 15:32:58 +08:00
parent 550f890b4f
commit be63b23770
4 changed files with 29 additions and 1 deletions

View File

@ -37,6 +37,7 @@ nixos-config
├── modules/
├── pkgs/
├── secrets/
├── shells/
├── users/
├── flake.lock
├── flake.nix
@ -55,6 +56,10 @@ It is exported in the flakes at `outputs.packages` compiled through various syst
* link:./secrets/[`./secrets/`] contains my secrets managed with link:https://github.com/ryantm/agenix[agenix].
* link:./shells/[`./shells/`] contains my development shells for interacting with the usual type of projects.
Setting this up can bring benefits outside of NixOS (unless you're interacting with projects with any OpenGL-related stuff).
footnote:[Since packages brought from Nix shells can only work with the store, a container might be better at some situations.]
* link:./users/[`./users/`] contains my link:https://github.com/nix-community/home-manager[home-manager] configurations and modules.
It is exported in the flakes at `outputs.homeConfigurations`.
For more information, see the link:./users/README.adoc[related documentation].
@ -68,7 +73,7 @@ In order of priority:
* [x] Create custom modules.
* [x] Create a themes system similar to link:https://github.com/hlissner/dotfiles[this NixOS config].
* [ ] Create development shells.
* [x] Create development shells.
* [x] Manage secrets with agenix.
* [x] Automate backups with NixOS config.
* [x] Create custom packages and export it to flakes. (Maybe consider making it to upstream)

View File

@ -121,5 +121,11 @@
# I just want to try out supporting other systems.
packages = forAllSystems
(system: import ./pkgs { pkgs = import nixpkgs { inherit system; }; });
# My several development shells for usual type of projects. This is much
# more preferable than installing all of the packages at the system
# configuration (or even home environment).
devShells = forAllSystems
(system: import ./shells { pkgs = import nixpkgs { inherit system; }; });
};
}

5
shells/default.nix Normal file
View File

@ -0,0 +1,5 @@
{ pkgs ? import <nixpkgs> { } }:
with pkgs; {
flatpak = callPackage ./flatpak.nix { };
}

12
shells/flatpak.nix Normal file
View File

@ -0,0 +1,12 @@
# My custom shell for developing Flatpak manifests.
{ mkShell, lib, flatpak-builder, editorconfig-checker, editorconfig-core-c, git, dasel }:
mkShell {
packages = [
dasel # For converting various data into something.
flatpak-builder # A required tool.
editorconfig-checker # We're most likely writing manifests in YAML so I need them consistent spaces.
editorconfig-core-c # editorconfig will not work without the engine, of course.
git # This is the common choice as the VCS — otherwise, bring your own.
];
}