This commit is contained in:
Hadi 2024-06-08 01:56:21 +02:00
parent 1ccb720f3b
commit 88fb9d078b
31 changed files with 200 additions and 48 deletions

View File

@ -3,10 +3,10 @@ let variable = import ../variables.nix;
in { in {
imports = [ imports = [
./themes/laptop.nix
./system/laptop.nix ./system/laptop.nix
./scripts/laptop.nix ./scripts/laptop.nix
./apps/laptop.nix ./apps/laptop.nix
./themes/nixy.nix
]; ];
home = { home = {
@ -44,6 +44,7 @@ in {
curl curl
neovide neovide
wf-recorder wf-recorder
glow
# Just cool # Just cool
peaclock peaclock

View File

@ -0,0 +1,39 @@
{ pkgs, config, ... }:
let
homedir = config.home.homeDirectory;
heaven-rebuild = pkgs.writeShellScriptBin "heaven-rebuild" ''
sudo nixos-rebuild switch --flake ${homedir}/.config/nixos#heaven
'';
heaven-upgrade = pkgs.writeShellScriptBin "heaven-upgrade" ''
sudo nixos-rebuild switch --upgrade --flake ${homedir}/.config/nixos#heaven
'';
heaven-update = pkgs.writeShellScriptBin "heaven-update" ''
cd ${homedir}/.config/nixos && sudo nix flake update
'';
heaven-gc = pkgs.writeShellScriptBin "heaven-gc" ''
cd ${homedir}/.config/nixos && sudo nix-collect-garbage -d
'';
heaven-cb = pkgs.writeShellScriptBin "heaven-cb" ''
sudo /run/current-system/bin/switch-to-configuration boot
'';
remote-rebuild = pkgs.writeShellScriptBin "remote-rebuild" ''
ssh -t heaven "cd ~/.config/nixos && git pull && heaven-rebuild"
'';
in {
home.packages = with pkgs; [
heaven-rebuild
heaven-upgrade
heaven-update
heaven-gc
heaven-cb
remote-rebuild
];
}

View File

@ -11,7 +11,6 @@
./nerdfont_fzf ./nerdfont_fzf
./system ./system
./compress ./compress
./misc
./misc.nix
]; ];
} }

View File

@ -26,31 +26,6 @@ let
nixy-push = pkgs.writeShellScriptBin "nixy-push" '' nixy-push = pkgs.writeShellScriptBin "nixy-push" ''
cd ~/.config/nixos && git add . && git commit -m ''${1:-Update} && git push cd ~/.config/nixos && git add . && git commit -m ''${1:-Update} && git push
''; '';
heaven-rebuild = pkgs.writeShellScriptBin "heaven-rebuild" ''
sudo nixos-rebuild switch --flake ${homedir}/.config/nixos#heaven
'';
heaven-upgrade = pkgs.writeShellScriptBin "heaven-upgrade" ''
sudo nixos-rebuild switch --upgrade --flake ${homedir}/.config/nixos#heaven
'';
heaven-update = pkgs.writeShellScriptBin "heaven-update" ''
cd ${homedir}/.config/nixos && sudo nix flake update
'';
heaven-gc = pkgs.writeShellScriptBin "heaven-gc" ''
cd ${homedir}/.config/nixos && sudo nix-collect-garbage -d
'';
heaven-cb = pkgs.writeShellScriptBin "heaven-cb" ''
sudo /run/current-system/bin/switch-to-configuration boot
'';
remote-rebuild = pkgs.writeShellScriptBin "remote-rebuild" ''
ssh -t heaven "cd ~/.config/nixos && git pull && heaven-rebuild"
'';
in { in {
home.packages = with pkgs; [ home.packages = with pkgs; [
nixy-rebuild nixy-rebuild
@ -59,11 +34,5 @@ in {
nixy-gc nixy-gc
nixy-cb nixy-cb
nixy-push nixy-push
heaven-rebuild
heaven-upgrade
heaven-update
heaven-gc
heaven-cb
remote-rebuild
]; ];
} }

View File

@ -3,10 +3,10 @@ let variable = import ../variables.nix;
in { in {
imports = [ imports = [
./themes/server.nix
./system/server.nix ./system/server.nix
./scripts/server.nix ./scripts/server.nix
./apps/server.nix ./apps/server.nix
./themes/wip.nix
]; ];
home = { home = {

View File

@ -4,9 +4,48 @@ in {
enable = true; enable = true;
userName = variable.git.username; userName = variable.git.username;
userEmail = variable.git.email; userEmail = variable.git.email;
ignores = [
".cache/"
".DS_Store"
".idea/"
"*.swp"
"*.elc"
"auto-save-list"
".direnv/"
"node_modules"
"result"
"result-*"
];
extraConfig = { extraConfig = {
init.defaultBranch = "main"; init.defaultBranch = "main";
push.autoSetupRemote = true; push.autoSetupRemote = true;
}; };
aliases = {
essa = "push --force";
co = "checkout";
fuck = "commit --amend -m";
c = "commit -m";
ca = "commit -am";
forgor = "commit --amend --no-edit";
graph = "log --all --decorate --graph --oneline";
oops = "checkout --";
l = "log";
r = "rebase";
s = "status --short";
ss = "status";
d = "diff";
ps = "!git push origin $(git rev-parse --abbrev-ref HEAD)";
pl = "!git pull origin $(git rev-parse --abbrev-ref HEAD)";
af = "!git add $(git ls-files -m -o --exclude-standard | sk -m)";
st = "status";
br = "branch";
df = "!git hist | peco | awk '{print $2}' | xargs -I {} git diff {}^ {}";
hist = ''
log --pretty=format:"%Cgreen%h %Creset%cd %Cblue[%cn] %Creset%s%C(yellow)%d%C(reset)" --graph --date=relative --decorate --all'';
llog = ''
log --graph --name-status --pretty=format:"%C(red)%h %C(reset)(%cd) %C(green)%an %Creset%s %C(yellow)%d%Creset" --date=relative'';
edit-unmerged =
"!f() { git ls-files --unmerged | cut -f2 | sort -u ; }; hx `f`";
};
}; };
} }

64
home/themes/heaven.nix Normal file
View File

@ -0,0 +1,64 @@
{
imports = [ ./config/template.nix ./config/load_colors.nix ];
theme = {
wallpaper = "default.png";
font-mono = "FiraCode Nerd Font Mono";
font = "SFProDisplay Nerd Font";
rounding = 12;
gaps-in = 10;
gaps-out = 20;
border-size = 3;
neofetch = "nerdfetch";
waybar = {
transparent = true;
float = true;
};
colors = {
bg = "040409";
fg = "FCFCFC";
alt-bg = "101012";
alt-fg = "ECECEC";
primary-ansi-16 = "red";
primary-bg = "a158ff";
primary-fg = "000000";
secondary-bg = "4928B8";
secondary-fg = "000000";
# Black
color0 = "000000";
# Red
color1 = "f7768e";
# Green
color2 = "73daca";
# Yellow
color3 = "e0af68";
# Blue
color4 = "7aa2f7";
# Magenta
color5 = "a158ff";
# Cyan
color6 = "7dcfff";
# White
color7 = "E4E5E7";
# Bright
color8 = "515878";
color9 = "f7869e";
color10 = "83eada";
color11 = "f0bf78";
color12 = "8ab2f7";
color13 = "A988F8";
color14 = "8ddfff";
color15 = "f4f5f7";
};
};
}

View File

@ -1 +0,0 @@
{ ... }: { imports = [ ./nixy.nix ./wallpapers ./config/load_colors.nix ]; }

View File

@ -1,5 +1,5 @@
{ {
imports = [ ./config/template.nix ]; imports = [ ./config/template.nix ./config/load_colors.nix ];
theme = { theme = {
wallpaper = "default.png"; wallpaper = "default.png";

View File

@ -1 +0,0 @@
{ ... }: { imports = [ ./wip.nix ./config/load_colors.nix ]; }

View File

Before

Width:  |  Height:  |  Size: 3.7 MiB

After

Width:  |  Height:  |  Size: 3.7 MiB

View File

Before

Width:  |  Height:  |  Size: 7.1 MiB

After

Width:  |  Height:  |  Size: 7.1 MiB

View File

Before

Width:  |  Height:  |  Size: 3.6 MiB

After

Width:  |  Height:  |  Size: 3.6 MiB

View File

Before

Width:  |  Height:  |  Size: 13 MiB

After

Width:  |  Height:  |  Size: 13 MiB

View File

Before

Width:  |  Height:  |  Size: 826 KiB

After

Width:  |  Height:  |  Size: 826 KiB

View File

Before

Width:  |  Height:  |  Size: 1.3 MiB

After

Width:  |  Height:  |  Size: 1.3 MiB

View File

Before

Width:  |  Height:  |  Size: 1.7 MiB

After

Width:  |  Height:  |  Size: 1.7 MiB

View File

Before

Width:  |  Height:  |  Size: 12 MiB

After

Width:  |  Height:  |  Size: 12 MiB

View File

Before

Width:  |  Height:  |  Size: 95 KiB

After

Width:  |  Height:  |  Size: 95 KiB

View File

Before

Width:  |  Height:  |  Size: 378 KiB

After

Width:  |  Height:  |  Size: 378 KiB

View File

Before

Width:  |  Height:  |  Size: 288 KiB

After

Width:  |  Height:  |  Size: 288 KiB

View File

Before

Width:  |  Height:  |  Size: 641 KiB

After

Width:  |  Height:  |  Size: 641 KiB

View File

Before

Width:  |  Height:  |  Size: 1.0 MiB

After

Width:  |  Height:  |  Size: 1.0 MiB

View File

Before

Width:  |  Height:  |  Size: 8.6 MiB

After

Width:  |  Height:  |  Size: 8.6 MiB

View File

@ -1,5 +1,5 @@
{ {
imports = [ ./config/template.nix ]; imports = [ ./config/template.nix ./config/load_colors.nix ];
theme = { theme = {
wallpaper = "Fuji-Light.png"; wallpaper = "Fuji-Light.png";

View File

@ -1,16 +1,17 @@
{ pkgs, config, ... }: { pkgs, config, ... }:
let let
variable = import ../../variables.nix; variable = import ../../variables.nix;
imports = [ ./hardware-configuration.nix ]; baseImports = [ ./hardware-configuration.nix ];
# Weird variable name to avoid conflict with the `imports` variable...
secondImports = extraImports = [
if variable.enableNvidia then imports ++ [ ./nvidia.nix ] else imports; (if variable.enableNvidia then ./nvidia.nix else null)
thirdImports = if variable.enablePrime then (if variable.enablePrime then ./prime.nix else null)
secondImports ++ [ ./prime.nix ] ];
else
secondImports; filteredImports = builtins.filter (x: x != null) extraImports;
in { in {
imports = thirdImports; imports = baseImports ++ filteredImports;
# Bootloader. # Bootloader.
boot = { boot = {
@ -59,6 +60,20 @@ in {
programs.zsh.enable = true; programs.zsh.enable = true;
users.defaultUserShell = pkgs.zsh; users.defaultUserShell = pkgs.zsh;
loginShellInit = ''
dbus-update-activation-environment --systemd DISPLAY
eval $(gnome-keyring-daemon --start --components=ssh,secrets)
eval $(ssh-agent)
'';
# faster rebuilding
documentation = {
enable = true;
doc.enable = false;
man.enable = true;
dev.enable = false;
};
# Allow unfree packages # Allow unfree packages
nixpkgs.config.allowUnfree = true; nixpkgs.config.allowUnfree = true;

View File

@ -1,5 +1,11 @@
{ {
services.fail2ban = {
enable = true;
maxretry = 3;
ignoreIP = [ "127.0.0.0/8" "10.0.0.0/8" "192.168.0.0/16" ];
};
networking.firewall = { networking.firewall = {
enable = true; enable = true;
allowedTCPPorts = [ 22 ]; allowedTCPPorts = [ 22 ];

1
hosts/server/ntfy.nix Normal file
View File

@ -0,0 +1 @@
{ services.ntfy = { enable = true; }; }

View File

@ -0,0 +1,21 @@
let
port = 8222;
signup = false;
in {
services.vaultwarden = {
enable = true;
config = {
DOMAIN = "https://bw.anotherhadi.com";
SIGNUPS_ALLOWED = signup;
ROCKET_ADDRESS = "127.0.0.1";
ROCKET_PORT = port;
ROCKET_LOG = "critical";
};
};
services.nginx.virtualHosts."bw.anotherhadi.com" = {
locations."/" = { proxyPass = "http://127.0.0.1:${toString port}"; };
};
networking.firewall.allowedTCPPorts = [ port ];
}