Secrets, scripts, clean..

This commit is contained in:
Hadi 2024-03-15 21:26:34 +01:00
parent 05fc3fbcd9
commit 5e98256a82
27 changed files with 141 additions and 66 deletions

View File

@ -79,6 +79,7 @@ git clone https://github.com/anotherhadi/nixy ~/.config/nixos
```
- Every things that you *must* change got a "CHANGEME" comment. You can search for it with ripgrep: `rg "CHANGEME"`
- Every things that you *must* remove got a "REMOVE" comment. You can search for it with ripgrep: `rg "REMOVE"` (Secrets, own stuff..)
- Change the `nixos/configuration.nix` file to match your system
- Copy your `hardware-configuration.nix` file to the `nixos` folder
@ -92,3 +93,5 @@ sudo nixos-rebuild switch --flake ~/.config/nixos#nixy
- [ ] Custom GTK based on the colorscheme
- [ ] Obsidian.nvim on every markdown file
- [ ] Nextcloud services (Only on my personnal network)
- [ ] Caffeine & Night-Shift replace notif
- [ ] Raycast like launcher

View File

@ -232,6 +232,26 @@
"type": "github"
}
},
"homeage": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1669234151,
"narHash": "sha256-TwT87E3m2TZLgwYJESlype14HxUOrRGojPM5C2akrMg=",
"owner": "jordanisaacs",
"repo": "homeage",
"rev": "02bfe4ca06962d222e522fff0240c93946b20278",
"type": "github"
},
"original": {
"owner": "jordanisaacs",
"repo": "homeage",
"type": "github"
}
},
"nix-darwin": {
"inputs": {
"nixpkgs": [
@ -371,6 +391,7 @@
"inputs": {
"apple-fonts": "apple-fonts",
"home-manager": "home-manager",
"homeage": "homeage",
"nixpkgs": "nixpkgs_2",
"nixvim": "nixvim",
"spicetify-nix": "spicetify-nix"

View File

@ -13,9 +13,15 @@
};
apple-fonts.url = "github:Lyndeno/apple-fonts.nix";
spicetify-nix.url = "github:the-argus/spicetify-nix";
homeage = {
url = "github:jordanisaacs/homeage";
# Optional
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = inputs@{ nixpkgs, home-manager, nixvim, spicetify-nix, ... }: {
outputs =
inputs@{ nixpkgs, home-manager, homeage, nixvim, spicetify-nix, ... }: {
nixosConfigurations = {
nixy = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
@ -32,6 +38,7 @@
extraSpecialArgs = {
inherit inputs;
inherit spicetify-nix;
inherit homeage;
};
};
}

View File

@ -17,8 +17,9 @@
./neofetch
./spicetify
./variables/theme
./wallpaper
./wallpapers
./lf
./secrets # REMOVE
];
home = {
@ -40,6 +41,7 @@
python3
# Utils
age # Secrets
fd
bc
gcc

View File

@ -169,7 +169,6 @@
animation = [
"windowsIn, 1, 3, easeOutCubic, popin 30% # window open"
"windowsOut, 1, 3, fluent_decel, popin 70% # window close."
"windowsMove, 1, 2, easeinoutsine, slide # everything in between, moving, dragging, resizing."
"fadeIn, 1, 3, easeOutCubic # fade in (open) -> layers and windows"
"fadeOut, 1, 2, easeOutCubic # fade out (close) -> layers and windows"
"fadeSwitch, 0, 1, easeOutCirc # fade on changing activewindow and its opacity"

View File

@ -5,7 +5,7 @@
xdg.configFile."hypr/hyprlock.conf".text = ''
background {
monitor =
path = $HOME/.config/wallpaper/${config.theme.wallpaper}
path = $HOME/.config/wallpapers/${config.theme.wallpaper}
color = rgb(${config.theme.colors.bg})
blur_size = 4

View File

@ -2,8 +2,8 @@
home.packages = with pkgs; [ hyprpaper ];
xdg.configFile."hypr/hyprpaper.conf".text = ''
preload = ~/.config/wallpaper/${config.theme.wallpaper}
wallpaper = ,~/.config/wallpaper/${config.theme.wallpaper}
preload = ~/.config/wallpapers/${config.theme.wallpaper}
wallpaper = ,~/.config/wallpapers/${config.theme.wallpaper}
ipc=true
splash=false
'';

View File

@ -1 +1,6 @@
{ imports = [ ./sshconfig.nix ./cava/default.nix ]; }
{
imports = [
./cava/default.nix
./nextcloud.nix # REMOVE
];
}

27
home/misc/nextcloud.nix Normal file
View File

@ -0,0 +1,27 @@
{ pkgs, ... }: {
systemd.user.services.watch-nextcloud = {
Unit = { Description = "Start Nextcloud if I'm on one of my network"; };
Install = { WantedBy = [ "default.target" ]; };
Service = {
ExecStart = "${pkgs.writeShellScript "watch-nextcloud" ''
while 1;do
ssid=$(nmcli -t -f name connection show --active | head -n1)
if [[ $ssid == "inthecloud" || $ssid == "Wired connection 2" ]]; then
status=$(systemctl --user status nextcloud-client)
service_status=$(echo "$status" | awk '/Active:/ {print $2}')
if [[ $service_status == "inactive" ]]; then
systemctl --user start nextcloud-client
fi
else
status=$(systemctl --user status nextcloud-client)
service_status=$(echo "$status" | awk '/Active:/ {print $2}')
if [[ $service_status == "active" ]]; then
systemctl --user stop nextcloud-client
fi
fi
sleep 120
done
''}";
};
};
}

View File

@ -1,14 +0,0 @@
{
home.file = {
".ssh/config" = {
text = ''
Host github.com
User git
Hostname github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/github
'';
executable = false;
};
};
}

12
home/scripts/age.nix Normal file
View File

@ -0,0 +1,12 @@
{ pkgs, config, ... }:
let
homedir = config.home.homeDirectory;
add-secrets = pkgs.writeShellScriptBin "add-secrets" ''
file=$1
pubkey=$(cat ~/nixy.key | grep "public key" | cut -d':' -f2 | sed 's/ //g')
${pkgs.age}/bin/age -r $pubkey -o ~/.config/nixos/home/secrets/$file.age -a $file
'';
in { home.packages = with pkgs; [ add-secrets ]; }

View File

@ -7,5 +7,6 @@
./brightness.nix
./caffeine.nix
./night-shift.nix
./age.nix
];
}

View File

@ -3,20 +3,20 @@
let
homedir = config.home.homeDirectory;
wallpaper = pkgs.writeShellScriptBin "wallpaper" ''
WALLPAPER_FOLDER="${homedir}/Nextcloud/wallpaper"
cd $WALLPAPER_FOLDER
choosed_wallpaper=$(fd . |
fzf \
--preview='kitty icat --clear --transfer-mode=memory --stdin=no --place=''${FZF_PREVIEW_COLUMNS}x''${FZF_PREVIEW_LINES}@0x0 {}' \
--preview-window=bottom,border-top \
--border-label "Wallpaper" ) || exit 1
swww img $choosed_wallpaper
cp $choosed_wallpaper $HOME/.config/wallpaper/default.png
'';
#wallpaper = pkgs.writeShellScriptBin "wallpaper" ''
# WALLPAPER_FOLDER="${homedir}/Nextcloud/wallpaper"
#
# cd $WALLPAPER_FOLDER
#
# choosed_wallpaper=$(fd . |
# fzf \
# --preview='kitty icat --clear --transfer-mode=memory --stdin=no --place=''${FZF_PREVIEW_COLUMNS}x''${FZF_PREVIEW_LINES}@0x0 {}' \
# --preview-window=bottom,border-top \
# --border-label "Wallpaper" ) || exit 1
#
# swww img $choosed_wallpaper
# cp $choosed_wallpaper $HOME/.config/wallpaper/default.png
#'';
menu = pkgs.writeShellScriptBin "menu" ''
if pgrep wofi; then
@ -34,4 +34,4 @@ let
nmcli connection import type wireguard file "$0"
'';
in { home.packages = with pkgs; [ wallpaper menu wireguard-import powermenu ]; }
in { home.packages = with pkgs; [ menu wireguard-import powermenu ]; }

12
home/secrets/default.nix Normal file
View File

@ -0,0 +1,12 @@
{ pkgs, config, homeage, ... }: {
imports = [ homeage.homeManagerModules.homeage ];
homeage = {
identityPaths = [ "~/nixy.key" ];
installationType = "activation";
file."hadisecretkey" = {
source = ./sshconfig.age;
symlinks = [ "${config.home.homeDirectory}/.ssh/sshconfig" ];
};
};
}

BIN
home/secrets/sshconfig.age Normal file

Binary file not shown.

View File

@ -12,7 +12,7 @@ with lib;
wallpaper = mkOption {
type = types.str;
description = "Name of the wallpaper (in the wallpaper directory)";
description = "Name of the wallpaper (from the wallpapers directory)";
};
font = mkOption {

View File

@ -1,6 +0,0 @@
{ config, ... }: {
xdg.configFile."wallpaper" = {
recursive = true;
source = ./wallpaper;
};
}

View File

@ -0,0 +1,6 @@
{ config, ... }: {
xdg.configFile."wallpapers" = {
recursive = true;
source = ./wallpapers;
};
}

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: 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