mirror of
https://github.com/RGBCube/ncc
synced 2026-01-13 08:41:00 +00:00
dfgsdfgggg
This commit is contained in:
parent
30ab9c5f85
commit
4e666af080
4 changed files with 158 additions and 9 deletions
|
|
@ -68,6 +68,8 @@
|
|||
{
|
||||
networking.useNetworkd = true;
|
||||
|
||||
networking.nftables.enable = true;
|
||||
|
||||
networking.networkmanager.enable = true;
|
||||
|
||||
users.extraGroups.networkmanager.members =
|
||||
|
|
|
|||
133
modules/nushell.mod.nix
Normal file
133
modules/nushell.mod.nix
Normal file
|
|
@ -0,0 +1,133 @@
|
|||
let
|
||||
commonModule =
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (lib.attrsets)
|
||||
attrNames
|
||||
attrValues
|
||||
filterAttrs
|
||||
mapAttrs
|
||||
mapAttrsToList
|
||||
;
|
||||
inherit (lib.lists)
|
||||
filter
|
||||
flatten
|
||||
last
|
||||
listToAttrs
|
||||
singleton
|
||||
;
|
||||
inherit (lib.meta) getExe;
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.trivial) const;
|
||||
inherit (lib.strings)
|
||||
concatStrings
|
||||
readFile
|
||||
replaceStrings
|
||||
splitString
|
||||
;
|
||||
in
|
||||
{
|
||||
home.extraModules = singleton (
|
||||
homeArgs:
|
||||
let
|
||||
config' = homeArgs.config;
|
||||
|
||||
variablesMap =
|
||||
{
|
||||
HOME = config'.home.directory;
|
||||
USER = config'.home.directory |> splitString "/" |> filter (s: s != "") |> last;
|
||||
|
||||
XDG_CACHE_HOME = config'.xdg.cache.directory;
|
||||
XDG_CONFIG_HOME = config'.xdg.config.directory;
|
||||
XDG_DATA_HOME = config'.xdg.data.directory;
|
||||
XDG_STATE_HOME = config'.xdg.state.directory;
|
||||
}
|
||||
|> mapAttrsToList (
|
||||
name: value: [
|
||||
{
|
||||
name = "\$${name}";
|
||||
inherit value;
|
||||
}
|
||||
{
|
||||
name = "\${${name}}";
|
||||
inherit value;
|
||||
}
|
||||
]
|
||||
)
|
||||
|> flatten
|
||||
|> listToAttrs;
|
||||
|
||||
nuVariables =
|
||||
config.environment.variables
|
||||
|> mapAttrs (const <| replaceStrings (attrNames variablesMap) (attrValues variablesMap))
|
||||
|> filterAttrs (name: const <| name != "TERM");
|
||||
|
||||
nuVariables' =
|
||||
nuVariables
|
||||
|> mapAttrsToList (
|
||||
name: value:
|
||||
# nu
|
||||
''
|
||||
$env.${name} = "${value}"
|
||||
''
|
||||
)
|
||||
|> concatStrings;
|
||||
|
||||
nuConfig = nuVariables' + readFile ./nushell.config.nu;
|
||||
|
||||
in
|
||||
{
|
||||
home.file.".zshrc".text =
|
||||
mkIf config.nixpkgs.system.hostPlatform.isDarwin # zsh
|
||||
''
|
||||
SHELL=${getExe config'.programs.nushell.package} exec ${getExe config'.programs.nushell.package}
|
||||
'';
|
||||
|
||||
programs.nushell = {
|
||||
enable = true;
|
||||
|
||||
extraConfig = nuConfig;
|
||||
|
||||
aliases = {
|
||||
la = "ls --all";
|
||||
ll = "ls --long";
|
||||
lla = "ls --long --all";
|
||||
sl = "ls";
|
||||
|
||||
cp = "cp --recursive --verbose --progress";
|
||||
mk = "mkdir";
|
||||
mv = "mv --verbose";
|
||||
rm = "rm --recursive --verbose";
|
||||
|
||||
pstree = "${getExe pkgs.pstree} -g 3";
|
||||
tree = "${getExe pkgs.eza} --tree --git-ignore --group-directories-first";
|
||||
};
|
||||
};
|
||||
}
|
||||
);
|
||||
};
|
||||
in
|
||||
{
|
||||
nixosModules.nushell =
|
||||
{ lib, pkgs, ... }:
|
||||
let
|
||||
inherit (lib.modules) mkForce;
|
||||
in
|
||||
{
|
||||
imports = [ commonModule ];
|
||||
|
||||
users.defaultUserShell = pkgs.nushell;
|
||||
|
||||
environment.shellAliases = {
|
||||
ls = mkForce null;
|
||||
l = mkForce null;
|
||||
};
|
||||
};
|
||||
|
||||
darwinModules.nushell = commonModule;
|
||||
}
|
||||
|
|
@ -7,18 +7,18 @@
|
|||
...
|
||||
}:
|
||||
let
|
||||
inherit (lib.modules) optionals;
|
||||
inherit (lib.lists) singleton;
|
||||
in
|
||||
{
|
||||
# TODO: xdg-mime
|
||||
|
||||
packages = [
|
||||
]
|
||||
++ optionals config.nixpkgs.hostPlatform.isLinux [
|
||||
pkgs.haruna
|
||||
]
|
||||
++ optionals config.nixpkgs.hostPlatform.isDarwin [
|
||||
pkgs.iina
|
||||
];
|
||||
packages = singleton (
|
||||
if config.nixpkgs.hostPlatform.isLinux then
|
||||
pkgs.haruna
|
||||
else if config.nixpkgs.hostPlatform.isDarwin then
|
||||
pkgs.iina
|
||||
else
|
||||
throw "Unsupported OS"
|
||||
);
|
||||
};
|
||||
}
|
||||
|
|
|
|||
14
modules/zoxide.mod.nix
Normal file
14
modules/zoxide.mod.nix
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
homeModules.zoxide = {
|
||||
programs.zoxide = {
|
||||
enable = true;
|
||||
|
||||
flags = [
|
||||
"--cmd"
|
||||
"cd"
|
||||
];
|
||||
|
||||
integrations.nushell.enable = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue