stuff
This commit is contained in:

committed by
Shelvacu on prophecy

parent
e3df51ce0d
commit
4a0ebb34e5
@@ -49,6 +49,7 @@ else
|
||||
./units-config.nix
|
||||
./units-impl.nix
|
||||
./verify-system
|
||||
./qcd.nix
|
||||
];
|
||||
options = {
|
||||
vacu.rootCAs = mkOption { type = types.listOf types.str; };
|
||||
|
42
common/qcd.nix
Normal file
42
common/qcd.nix
Normal file
@@ -0,0 +1,42 @@
|
||||
{
|
||||
lib,
|
||||
config,
|
||||
vacuModuleType,
|
||||
vaculib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (lib) mkOption types;
|
||||
home = if vacuModuleType == "nix-on-droid" then "/data/data/com.termux.nix/files/home" else "/home/shelvacu";
|
||||
in
|
||||
{
|
||||
options.vacu.qcd = mkOption {
|
||||
default = {};
|
||||
type = types.attrsOf types.path;
|
||||
};
|
||||
config.vacu.shell.functions.qcd = ''
|
||||
svl_exact_args $# 1
|
||||
declare the_arg="$1"
|
||||
|
||||
declare base="''${the_arg%%/*}"
|
||||
declare rest="''${the_arg:''${#base}}"
|
||||
declare path
|
||||
|
||||
if false; then :
|
||||
${lib.pipe config.vacu.qcd [
|
||||
(lib.mapAttrsToList (alias: path: ''elif [[ $base == ${lib.escapeShellArg alias} ]]; then path=${lib.escapeShellArg path}''))
|
||||
(lib.concatStringsSep "\n")
|
||||
]}
|
||||
fi
|
||||
if ! [[ -v path ]]; then
|
||||
svl_die "unrecognized alias $base"
|
||||
fi
|
||||
|
||||
cd -- "$path$rest"
|
||||
'';
|
||||
config.vacu.qcd = {
|
||||
ns = "${home}/dev/nix-stuff";
|
||||
np = "${home}/dev/nixpkgs";
|
||||
dev = "${home}/dev";
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user