-
|
Having been away for a couple of weeks, it is amazing to see how far this project has come! I have a custom zsh-wrapper module (zsh.nix) that I would like to depend on another wrapper module (direnv.nix). {
description = ''
Uses flake-parts to set up the flake outputs:
`wrappers`, `wrapperModules` and `packages.*.*`
'';
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
wrappers = {
url = "github:BirdeeHub/nix-wrapper-modules";
inputs.nixpkgs.follows = "nixpkgs";
};
flake-parts = {
url = "github:hercules-ci/flake-parts";
inputs.nixpkgs-lib.follows = "nixpkgs";
};
};
outputs =
{
self,
nixpkgs,
wrappers,
flake-parts,
...
}@inputs:
flake-parts.lib.mkFlake { inherit inputs; } {
systems = nixpkgs.lib.platforms.all;
# Import the flake-parts module:
imports = [ wrappers.flakeModules.wrappers ];
flake = {
wrappers = {
direnv = { pkgs, wlib, ... }: {
imports = [ (import ./direnv.nix) ];
};
zsh = { pkgs, wlib, ... }: {
imports = [ (import ./zsh.nix) ];
starship = {
enable = true;
};
direnv = {
enable = true;
package = ??? # <-- I want to use something like `self'.packages.direnv` here
};
fzf = {
enable = true;
};
plugins = [
{
package = pkgs.zsh-fzf-tab;
name = "fzf-tab";
}
{
package = pkgs.zsh-vi-mode;
init = "zvm_after_init_commands+=('source <(fzf --zsh)')";
}
{
package = pkgs.oh-my-zsh;
file = "plugins/git/git.plugin.zsh";
disable = true;
}
];
};
};
};
};
} |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 8 replies
-
|
Nevermind, I should have simply read the documentation first :-) I could achieve what I wanted using {
description = ''
Uses flake-parts to set up the flake outputs:
`wrappers`, `wrapperModules` and `packages.*.*`
'';
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
wrappers = {
url = "github:BirdeeHub/nix-wrapper-modules";
inputs.nixpkgs.follows = "nixpkgs";
};
flake-parts = {
url = "github:hercules-ci/flake-parts";
inputs.nixpkgs-lib.follows = "nixpkgs";
};
};
outputs =
{
self,
nixpkgs,
wrappers,
flake-parts,
...
}@inputs:
# flake-parts.lib.mkFlake { inherit inputs; } {
flake-parts.lib.mkFlake { inherit inputs; } (top@{ config, withSystem, moduleWithSystem, ... }: {
systems = nixpkgs.lib.platforms.all;
# Import the flake-parts module:
imports = [ wrappers.flakeModules.wrappers ];
flake = {
wrappers = {
direnv = { pkgs, wlib, ... }: {
imports = [ (import ./direnv.nix) ];
nix-direnv.enable = true;
};
zsh = { pkgs, wlib, ... }: {
imports = [ (import ./zsh.nix) ];
starship = {
enable = true;
};
direnv = {
enable = true;
package = withSystem pkgs.stdenv.hostPlatform.system ( # <-- solution
{ config, ... }: # perSystem module arguments
config.packages.direnv
);
};
fzf = {
enable = true;
};
plugins = [
{
package = pkgs.zsh-fzf-tab;
name = "fzf-tab";
}
{
package = pkgs.zsh-vi-mode;
init = "zvm_after_init_commands+=('source <(fzf --zsh)')";
}
{
package = pkgs.oh-my-zsh;
file = "plugins/git/git.plugin.zsh";
disable = true;
}
];
};
};
};
});
}The flake-parts module is so cool, kudos @BirdeeHub ! |
Beta Was this translation helpful? Give feedback.
Nevermind, I should have simply read the documentation first :-)
I could achieve what I wanted using
withSystem: