diff --git a/README.md b/README.md index e1fb52f..9923fc5 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/flake.lock b/flake.lock index 712bea6..8ed9445 100644 --- a/flake.lock +++ b/flake.lock @@ -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" diff --git a/flake.nix b/flake.nix index 81cd6d8..4c516ce 100644 --- a/flake.nix +++ b/flake.nix @@ -13,30 +13,37 @@ }; apple-fonts.url = "github:Lyndeno/apple-fonts.nix"; spicetify-nix.url = "github:the-argus/spicetify-nix"; - }; - - outputs = inputs@{ nixpkgs, home-manager, nixvim, spicetify-nix, ... }: { - nixosConfigurations = { - nixy = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - modules = [ - ./nixos/configuration.nix - ./hosts - { _module.args = { inherit inputs; }; } - home-manager.nixosModules.home-manager - { - home-manager = { - useGlobalPkgs = true; - useUserPackages = true; - users.hadi = import ./home/home.nix; # CHANGEME - replace "hadi" - extraSpecialArgs = { - inherit inputs; - inherit spicetify-nix; - }; - }; - } - ]; - }; + homeage = { + url = "github:jordanisaacs/homeage"; + # Optional + inputs.nixpkgs.follows = "nixpkgs"; }; }; + + outputs = + inputs@{ nixpkgs, home-manager, homeage, nixvim, spicetify-nix, ... }: { + nixosConfigurations = { + nixy = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + ./nixos/configuration.nix + ./hosts + { _module.args = { inherit inputs; }; } + home-manager.nixosModules.home-manager + { + home-manager = { + useGlobalPkgs = true; + useUserPackages = true; + users.hadi = import ./home/home.nix; # CHANGEME - replace "hadi" + extraSpecialArgs = { + inherit inputs; + inherit spicetify-nix; + inherit homeage; + }; + }; + } + ]; + }; + }; + }; } diff --git a/home/home.nix b/home/home.nix index 52cd8aa..c46ee87 100644 --- a/home/home.nix +++ b/home/home.nix @@ -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 diff --git a/home/hyprland/default.nix b/home/hyprland/default.nix index af7ba21..951257c 100644 --- a/home/hyprland/default.nix +++ b/home/hyprland/default.nix @@ -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" diff --git a/home/hyprland/hyprlock.nix b/home/hyprland/hyprlock.nix index 97cf1b3..7772ee8 100644 --- a/home/hyprland/hyprlock.nix +++ b/home/hyprland/hyprlock.nix @@ -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 diff --git a/home/hyprland/hyprpaper.nix b/home/hyprland/hyprpaper.nix index 2a68179..d25c538 100644 --- a/home/hyprland/hyprpaper.nix +++ b/home/hyprland/hyprpaper.nix @@ -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 ''; diff --git a/home/misc/default.nix b/home/misc/default.nix index 3e95b0e..bf4e44f 100644 --- a/home/misc/default.nix +++ b/home/misc/default.nix @@ -1 +1,6 @@ -{ imports = [ ./sshconfig.nix ./cava/default.nix ]; } +{ + imports = [ + ./cava/default.nix + ./nextcloud.nix # REMOVE + ]; +} diff --git a/home/misc/nextcloud.nix b/home/misc/nextcloud.nix new file mode 100644 index 0000000..4c47b18 --- /dev/null +++ b/home/misc/nextcloud.nix @@ -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 + ''}"; + }; + }; +} diff --git a/home/misc/sshconfig.nix b/home/misc/sshconfig.nix deleted file mode 100644 index 34e6eb3..0000000 --- a/home/misc/sshconfig.nix +++ /dev/null @@ -1,14 +0,0 @@ -{ - home.file = { - ".ssh/config" = { - text = '' - Host github.com - User git - Hostname github.com - PreferredAuthentications publickey - IdentityFile ~/.ssh/github - ''; - executable = false; - }; - }; -} diff --git a/home/scripts/age.nix b/home/scripts/age.nix new file mode 100644 index 0000000..8be00b0 --- /dev/null +++ b/home/scripts/age.nix @@ -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 ]; } diff --git a/home/scripts/default.nix b/home/scripts/default.nix index 92feec1..485b9d3 100644 --- a/home/scripts/default.nix +++ b/home/scripts/default.nix @@ -7,5 +7,6 @@ ./brightness.nix ./caffeine.nix ./night-shift.nix + ./age.nix ]; } diff --git a/home/scripts/scripts.nix b/home/scripts/scripts.nix index 36a3bf5..f0ab1ce 100644 --- a/home/scripts/scripts.nix +++ b/home/scripts/scripts.nix @@ -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 ]; } diff --git a/home/secrets/default.nix b/home/secrets/default.nix new file mode 100644 index 0000000..bf4e0ba --- /dev/null +++ b/home/secrets/default.nix @@ -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" ]; + }; + }; +} diff --git a/home/secrets/sshconfig.age b/home/secrets/sshconfig.age new file mode 100644 index 0000000..b868096 Binary files /dev/null and b/home/secrets/sshconfig.age differ diff --git a/home/variables/theme/config/template.nix b/home/variables/theme/config/template.nix index dfbcc32..f4344c5 100644 --- a/home/variables/theme/config/template.nix +++ b/home/variables/theme/config/template.nix @@ -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 { diff --git a/home/wallpaper/default.nix b/home/wallpaper/default.nix deleted file mode 100644 index 81db544..0000000 --- a/home/wallpaper/default.nix +++ /dev/null @@ -1,6 +0,0 @@ -{ config, ... }: { - xdg.configFile."wallpaper" = { - recursive = true; - source = ./wallpaper; - }; -} diff --git a/home/wallpapers/default.nix b/home/wallpapers/default.nix new file mode 100644 index 0000000..2174792 --- /dev/null +++ b/home/wallpapers/default.nix @@ -0,0 +1,6 @@ +{ config, ... }: { + xdg.configFile."wallpapers" = { + recursive = true; + source = ./wallpapers; + }; +} diff --git a/home/wallpaper/wallpaper/barcode.png b/home/wallpapers/wallpapers/barcode.png similarity index 100% rename from home/wallpaper/wallpaper/barcode.png rename to home/wallpapers/wallpapers/barcode.png diff --git a/home/wallpaper/wallpaper/cat_leaves.png b/home/wallpapers/wallpapers/cat_leaves.png similarity index 100% rename from home/wallpaper/wallpaper/cat_leaves.png rename to home/wallpapers/wallpapers/cat_leaves.png diff --git a/home/wallpaper/wallpaper/default.png b/home/wallpapers/wallpapers/default.png similarity index 100% rename from home/wallpaper/wallpaper/default.png rename to home/wallpapers/wallpapers/default.png diff --git a/home/wallpaper/wallpaper/galaxy.png b/home/wallpapers/wallpapers/galaxy.png similarity index 100% rename from home/wallpaper/wallpaper/galaxy.png rename to home/wallpapers/wallpapers/galaxy.png diff --git a/home/wallpaper/wallpaper/house_cloud.png b/home/wallpapers/wallpapers/house_cloud.png similarity index 100% rename from home/wallpaper/wallpaper/house_cloud.png rename to home/wallpapers/wallpapers/house_cloud.png diff --git a/home/wallpaper/wallpaper/mountains.png b/home/wallpapers/wallpapers/mountains.png similarity index 100% rename from home/wallpaper/wallpaper/mountains.png rename to home/wallpapers/wallpapers/mountains.png diff --git a/home/wallpaper/wallpaper/mountains_black.png b/home/wallpapers/wallpapers/mountains_black.png similarity index 100% rename from home/wallpaper/wallpaper/mountains_black.png rename to home/wallpapers/wallpapers/mountains_black.png diff --git a/home/wallpaper/wallpaper/tokyo.png b/home/wallpapers/wallpapers/tokyo.png similarity index 100% rename from home/wallpaper/wallpaper/tokyo.png rename to home/wallpapers/wallpapers/tokyo.png diff --git a/home/wallpaper/wallpaper/windows.png b/home/wallpapers/wallpapers/windows.png similarity index 100% rename from home/wallpaper/wallpaper/windows.png rename to home/wallpapers/wallpapers/windows.png