feat: restructure user common files, allow selecting "minimal" set of options for vms

This commit is contained in:
oddlama 2023-05-08 18:03:29 +02:00
parent d842d25eb9
commit e2ba02234a
No known key found for this signature in database
GPG key ID: 14EFE510775FE39A
16 changed files with 87 additions and 74 deletions

2
flake.lock generated
View file

@ -258,7 +258,7 @@
}, },
"locked": { "locked": {
"lastModified": 1682972682, "lastModified": 1682972682,
"narHash": "sha256-+XyTwr4jZuDlT5l/0LynDVtvdWj8WmAwDEP/2rZ+1hk=", "narHash": "sha256-QuwwK2R4dAXTnM/MLwufUZOip8//H8G7i4ivS7YsP08=",
"type": "git", "type": "git",
"url": "file:///root/projects/microvm.nix" "url": "file:///root/projects/microvm.nix"
}, },

View file

@ -13,6 +13,8 @@
../../../../users/root ../../../../users/root
]; ];
home-manager.users.root.home.minimal = true;
systemd.network.networks = { systemd.network.networks = {
"10-wan" = { "10-wan" = {
# TODO # TODO

View file

@ -1,70 +1,14 @@
{pkgs, ...}: { {pkgs, ...}: {
imports = [ imports = [
./modules/uid.nix ./modules/uid.nix
./modules/minimal.nix
#./btop.nix
#./fish.nix
./git.nix ./git.nix
./htop.nix ./htop.nix
./neovim ./neovim
./nushell.nix ./shell
#./ssh.nix ./utils.nix
./starship.nix
#./tmux.nix
#./xdg.nix
./zsh
]; ];
home = {
packages = with pkgs; [
bandwhich
btop
fd
file
neofetch
rclone
ripgrep
rnr
rsync
sd
tree
rage
];
shellAliases = {
l = "ls -lahF --group-directories-first --show-control-chars --quoting-style=escape --color=auto";
t = "tree -F --dirsfirst -L 2";
tt = "tree -F --dirsfirst -L 3 --filelimit 16";
cpr = "rsync -axHAWXS --numeric-ids --info=progress2";
md = "mkdir";
rmd = "rm --one-file-system -d";
cp = "cp -vi";
mv = "mv -vi";
rm = "rm --one-file-system -I";
chmod = "chmod -c --preserve-root";
chown = "chown -c --preserve-root";
ip = "ip --color";
tmux = "tmux -2";
rg = "rg -S";
zf = "zathura --fork";
};
};
programs = {
atuin = {
enable = true;
settings.auto_sync = false;
};
bat = {
enable = true;
config.theme = "base16";
};
fzf.enable = true;
gpg.enable = true;
};
xdg.configFile."nixpkgs/config.nix".text = "{ allowUnfree = true; }"; xdg.configFile."nixpkgs/config.nix".text = "{ allowUnfree = true; }";
} }

View file

@ -1,4 +1,6 @@
{lib, ...}: { {lib, ...}: {
# TODO use git-fuzzy.
# TODO integrate git-fuzzy and difft
programs.gitui.enable = true; programs.gitui.enable = true;
programs.git = { programs.git = {
enable = true; enable = true;

View file

@ -0,0 +1,5 @@
{lib, ...}: {
options = {
home.minimal = lib.mkEnableOption "minimal setup only (e.g. for virtual machines)";
};
}

View file

@ -1,21 +1,22 @@
{ {
config,
lib, lib,
pkgs, pkgs,
... ...
}: { }: {
programs = { programs.neovim = {
neovim = { enable = true;
enable = true; viAlias = true;
viAlias = true; vimAlias = true;
vimAlias = true; vimdiffAlias = true;
vimdiffAlias = true; withPython3 = true;
withPython3 = true; extraPython3Packages = pyPkgs: with pyPkgs; [openai];
extraPython3Packages = pyPkgs: with pyPkgs; [openai]; withNodeJs = true;
withNodeJs = true; defaultEditor = true;
defaultEditor = true; };
}; xdg.configFile = lib.mkIf (!config.home.minimal) {
"nvim/lua".source = ./lua;
"nvim/init.lua".source = ./init.lua;
}; };
xdg.configFile."nvim/lua".source = ./lua;
xdg.configFile."nvim/init.lua".source = ./init.lua;
home.packages = with pkgs; [gcc shellcheck stylua]; home.packages = with pkgs; [gcc shellcheck stylua];
} }

View file

@ -0,0 +1,31 @@
{pkgs, ...}: {
imports = [
./nushell.nix
./starship.nix
./zsh
];
home.shellAliases = {
l = "ls -lahF --group-directories-first --show-control-chars --quoting-style=escape --color=auto";
t = "tree -F --dirsfirst -L 2";
tt = "tree -F --dirsfirst -L 3 --filelimit 16";
cpr = "rsync -axHAWXS --numeric-ids --info=progress2";
md = "mkdir";
rmd = "rm --one-file-system -d";
cp = "cp -vi";
mv = "mv -vi";
rm = "rm --one-file-system -I";
chmod = "chmod -c --preserve-root";
chown = "chown -c --preserve-root";
ip = "ip --color";
tmux = "tmux -2";
rg = "rg -S";
};
programs.atuin = {
enable = true;
settings.auto_sync = false;
};
}

27
users/common/utils.nix Normal file
View file

@ -0,0 +1,27 @@
{pkgs, ...}: {
home = {
packages = with pkgs; [
bandwhich
btop
fd
file
neofetch
rclone
ripgrep
rnr
rsync
sd
tree
rage
];
};
programs = {
bat = {
enable = true;
config.theme = "base16";
};
fzf.enable = true;
gpg.enable = true;
};
}

View file

@ -24,7 +24,7 @@ in {
home-manager.users.${myuser} = { home-manager.users.${myuser} = {
imports = [ imports = [
#impermanence.home-manager.impermanence #impermanence.home-manager.impermanence
../common ../common/core
./dev.nix ./dev.nix
./gpg.nix ./gpg.nix
./ssh.nix ./ssh.nix
@ -36,6 +36,7 @@ in {
username = config.users.users.${myuser}.name; username = config.users.users.${myuser}.name;
shellAliases = { shellAliases = {
p = "cd ~/projects"; p = "cd ~/projects";
zf = "zathura --fork";
}; };
}; };
}; };