tack and everything and wow
This commit is contained in:
parent
480c556d32
commit
7a6f387652
24 changed files with 801 additions and 358 deletions
|
|
@ -2,7 +2,7 @@
|
|||
lib,
|
||||
pkgs,
|
||||
inputs,
|
||||
# getFlakePkg',
|
||||
getFlakePkg,
|
||||
config,
|
||||
mainUser,
|
||||
...
|
||||
|
|
@ -16,6 +16,7 @@ let
|
|||
nativeBuildInputs = [ pkgs.makeWrapper ];
|
||||
postBuild = ''
|
||||
wrapProgram $out/bin/nu \
|
||||
--add-flags "--env-config ${nuEnv}" \
|
||||
--add-flags "--config ${nuConfig}"
|
||||
'';
|
||||
passthru = nushell.passthru or { } // {
|
||||
|
|
@ -215,20 +216,25 @@ let
|
|||
|
||||
nuScriptsPath = "${pkgs.nu_scripts}/share/nu_scripts";
|
||||
|
||||
nuEnv = pkgs.writeText "env.nu" ''
|
||||
use ${nuScriptsPath}/modules/capture-foreign-env
|
||||
source ${nuScriptsPath}/modules/formats/from-env.nu
|
||||
|
||||
let nixos_env = ('source /etc/set-environment' | capture-foreign-env --shell bash)
|
||||
if ($nixos_env | describe | str starts-with "record") { $nixos_env | load-env }
|
||||
'';
|
||||
|
||||
nuConfig = pkgs.writeText "config.nu" ''
|
||||
use std/config *
|
||||
|
||||
${lib.mapAttrsToList (n: v: "alias ${n} = ${v}") aliases |> lib.concatStringsSep "\n"}
|
||||
$env.NU_LIB_DIRS = ( $env.NU_LIB_DIRS | append "${nuScriptsPath}")
|
||||
|
||||
use ${nuScriptsPath}/modules/capture-foreign-env
|
||||
source ${nuScriptsPath}/modules/formats/from-env.nu
|
||||
|
||||
let nixos_env = ('source /etc/set-environment' | capture-foreign-env --shell bash)
|
||||
if ($nixos_env | describe | str starts-with "record") { $nixos_env | load-env }
|
||||
|
||||
source ${(pkgs.runCommand "zoxide.nu" { } ''${pkgs.zoxide}/bin/zoxide init nushell >> "$out"'')}
|
||||
|
||||
source ${
|
||||
(pkgs.runCommand "cade.nu" { } ''${lib.getExe (getFlakePkg inputs.cade)} hook nushell >> "$out"'')
|
||||
}
|
||||
|
||||
$env.config.buffer_editor = "${lib.getExe config.apps.editor}"
|
||||
|
||||
|
|
@ -250,35 +256,6 @@ let
|
|||
sudo $"$(p)/bin/switch-to-configuration" switch
|
||||
}
|
||||
|
||||
# direnv
|
||||
$env.config = ($env.config? | default {})
|
||||
$env.config.hooks = ($env.config.hooks? | default {})
|
||||
$env.config.hooks.pre_prompt = (
|
||||
$env.config.hooks.pre_prompt?
|
||||
| default []
|
||||
| append {||
|
||||
${pkgs.direnv}/bin/direnv export json
|
||||
| from json --strict
|
||||
| default {}
|
||||
| items {|key, value|
|
||||
let value = do (
|
||||
{
|
||||
"PATH": {
|
||||
from_string: {|s| $s | split row (char esep) | path expand --no-symlink }
|
||||
to_string: {|v| $v | path expand --no-symlink | str join (char esep) }
|
||||
}
|
||||
}
|
||||
| merge ($env.ENV_CONVERSIONS? | default {})
|
||||
| get ([[value, optional, insensitive]; [$key, true, true] [from_string, true, false]] | into cell-path)
|
||||
| if ($in | is-empty) { {|x| $x} } else { $in }
|
||||
) $value
|
||||
return [ $key $value ]
|
||||
}
|
||||
| into record
|
||||
| load-env
|
||||
}
|
||||
)
|
||||
|
||||
# $cmd doesn't carry its args ?
|
||||
# $env.config.hooks.command_not_found = { |cmd| , $cmd; echo }
|
||||
|
||||
|
|
@ -300,11 +277,17 @@ let
|
|||
in
|
||||
{
|
||||
|
||||
imports = [ inputs.inshellah.nixosModules.default ];
|
||||
programs.inshellah = {
|
||||
imports = [
|
||||
inputs.inshellah.nixosModules.default
|
||||
inputs.autonym.nixosModules.default
|
||||
];
|
||||
|
||||
programs.autonym = {
|
||||
enable = true;
|
||||
helpOnlyCommands = [ "nh" ];
|
||||
historyLimit = 2000;
|
||||
|
||||
};
|
||||
programs.inshellah.enable = true;
|
||||
|
||||
programs.command-not-found.enable = false;
|
||||
programs.zoxide.enable = true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue