feat: impure symlink
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
impure,
|
||||
...
|
||||
}:
|
||||
let
|
||||
@@ -14,11 +15,8 @@ in
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
my.hm = {
|
||||
xdg.configFile."nvim/init.lua".source = ./nvim/init.lua;
|
||||
xdg.configFile."nvim/lua" = {
|
||||
source = ./nvim/lua;
|
||||
recursive = true;
|
||||
};
|
||||
xdg.configFile."nvim/init.lua".source = impure.mkImpureLink ./nvim/init.lua;
|
||||
xdg.configFile."nvim/lua".source = impure.mkImpureLink ./nvim/lua;
|
||||
programs.neovim = {
|
||||
enable = true;
|
||||
defaultEditor = true;
|
||||
|
||||
@@ -15,6 +15,7 @@ in
|
||||
config = lib.mkIf cfg.enable {
|
||||
my.hm = {
|
||||
home.packages = with pkgs; [
|
||||
just
|
||||
gnumake
|
||||
github-cli # gh
|
||||
];
|
||||
|
||||
26
modules/impure.nix
Normal file
26
modules/impure.nix
Normal file
@@ -0,0 +1,26 @@
|
||||
{
|
||||
lib,
|
||||
pkgs,
|
||||
self,
|
||||
...
|
||||
}:
|
||||
let
|
||||
relativePath =
|
||||
path:
|
||||
assert lib.types.path.check path;
|
||||
lib.strings.removePrefix (toString self) (toString path);
|
||||
mkImpureLink =
|
||||
path:
|
||||
let
|
||||
relative = relativePath path;
|
||||
in
|
||||
pkgs.runCommandLocal relative { } "ln -s ${lib.escapeShellArg (impureRoot + relative)} $out";
|
||||
impureRoot =
|
||||
let
|
||||
impureRoot = builtins.getEnv "IMPURE_ROOT";
|
||||
in
|
||||
if impureRoot == "" then throw "IMPURE_ROOT is not set" else impureRoot;
|
||||
in
|
||||
{
|
||||
_module.args.impure = { inherit mkImpureLink; };
|
||||
}
|
||||
Reference in New Issue
Block a user