Open bobvanderlinden opened 1 year ago
Example:
{
description = "virtual environments";
inputs.devshell.url = "github:numtide/devshell";
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.dsf.url = "github:cruel-intentions/devshell-files";
inputs.gha.url = "github:cruel-intentions/gh-actions";
outputs = { self, flake-utils, devshell, nixpkgs, dsf, gha }:
flake-utils.lib.eachDefaultSystem (system: {
devShell = let pkgs = import nixpkgs { inherit system; overlays = [ devshell.overlay ]; }; in
pkgs.devshell.mkShell {
imports = [
"${dsf}/modules/files.nix" # create text files for you
"${dsf}/modules/yaml.nix" # use files to write yaml files from nix
"${gha}/gha/gh-actions.nix" # use yaml to create .github/workflows/gh-pages.yaml
# ... :-)
(pkgs.devshell.importTOML ./devshell.toml)
];
};
});
}
There is an external lib that help
{
description = "Dev Environment";
inputs.nixpkgs.url = "github:nixos/nixpkgs/22.05";
inputs.dsf.url = "github:cruel-intentions/devshell-files";
inputs.dsf.inputs.nixpkgs.follows = "nixpkgs";
inputs.gha.url = "github:cruel-intentions/gh-actions";
outputs = inputs: inputs.dsf.lib.shell inputs [
"hello" # import nix package
"${inputs.gha}/gh-actions.nix"
./project.nix # import nix module
(inputs.dsf.lib.importTOML ./devshell.toml)
];
}
See also #153
Looking at old issues, there is also #136
Is your feature request related to a problem? Please describe.
Currently it is possible to add modules from the extra/ directory using:
which corresponds to extra/locale.nix.
However, if I'd like to extend devshell with external flakes it seems not possible or not documented. Other than forking devshell and basing everything on that.
Also using Nix (in flakes) it is unclear how to refer to these module files.
Describe the solution you'd like
Would it be eventually possible to do something like:
It would be cool if it worked the same way as homeManagerModules and nixosModules in flakes:
That way they are easily referred to from Nix in other flakes.
Describe alternatives you've considered
extra/
in there :shrug:imports = [ ./mymodule.nix ]
in Nix.