From 41ea5804e5b7883bae9d81a0b234f803ab625d30 Mon Sep 17 00:00:00 2001 From: geekiot Date: Mon, 29 Sep 2025 01:27:12 +0500 Subject: [PATCH 1/2] fix (user data): change some user data --- users/geekiot/data/default.nix | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/users/geekiot/data/default.nix b/users/geekiot/data/default.nix index 9d92402..3548373 100644 --- a/users/geekiot/data/default.nix +++ b/users/geekiot/data/default.nix @@ -6,6 +6,14 @@ }: let homeDir = "/home/${userName}"; + + projectsDir = "${homeDir}/NewProjects"; + configDir = "${projectsDir}/nixos-config"; + sopsSubmoduleDir = "${configDir}/secrets-nixos"; + + securityDir = "${homeDir}/.security"; + gpgDir = "${securityDir}/gpg"; + sopsKeyFile = "${securityDir}/sops/age/keys.txt"; in { info = { @@ -15,13 +23,18 @@ in }; paths = { - inherit homeDir; - configDir = "${homeDir}/NewProjects/nixos-config"; - downloadsDir = "${homeDir}/Downloads"; + inherit + homeDir + + gpgDir + + configDir + sopsSubmoduleDir + sopsKeyFile + ; sshDir = "${homeDir}/.ssh"; - gpgDir = "${homeDir}/.security/gpg"; - sopsKeyFile = "${homeDir}/.security/sops/age/keys.txt"; + downloadsDir = "${homeDir}/Downloads"; }; device = { From a52c868ecfef01b77bf691700641f9c63ae65125 Mon Sep 17 00:00:00 2001 From: geekiot Date: Mon, 29 Sep 2025 01:29:22 +0500 Subject: [PATCH 2/2] fix (user scripts): refactor update nixos script & remove comments --- users/geekiot/host/proxy.nix | 2 -- users/geekiot/scripts/default.nix | 32 ++++++++++++++++--------------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/users/geekiot/host/proxy.nix b/users/geekiot/host/proxy.nix index 54be79c..6359425 100644 --- a/users/geekiot/host/proxy.nix +++ b/users/geekiot/host/proxy.nix @@ -15,7 +15,6 @@ let type = config.sops.secrets."sing_box/type".path; in { - # Sops sops.secrets = { "sing_box/flow" = { }; "sing_box/packet_encoding" = { }; @@ -33,7 +32,6 @@ in httpProxy = "http://127.0.0.1:12634"; }; - # Sing-box services.sing-box = { enable = true; package = pkgs.old.sing-box; diff --git a/users/geekiot/scripts/default.nix b/users/geekiot/scripts/default.nix index 57e0017..02376c4 100644 --- a/users/geekiot/scripts/default.nix +++ b/users/geekiot/scripts/default.nix @@ -1,40 +1,42 @@ pkgs: { - updateSystem = + rebuidWithSopsSubmodule = configPath: secretsPath: - pkgs.writeShellScriptBin "updateSystem" '' + pkgs.writeShellScriptBin "rebuidWithSopsSubmodule" '' #!/bin/bash export my_wd=$PWD cd ${configPath} - if [ ! -d "${secretsPath}" ]; then - echo "!!! Error !!! NixConfigSecrets directory not found in ${configPath}" + if [ ! -d ./${secretsPath} ]; then + echo "Error: ${secretsPath} directory not found in ${configPath}" + echo "System not updated!" cd $my_wd unset my_wd exit 1 fi - if [ -z "$(find NixConfigSecrets -maxdepth 1 -name '*.yaml' -print -quit)" ]; then - echo "!!! Error !!! No .yaml files found in NixConfigSecrets directory" + if [ -z "$(find ./${secretsPath} -maxdepth 1 -name '*.yaml' -print -quit)" ]; then + echo "Error: No .yaml files found in ${secretsPath} directory" + echo "System not updated!" cd $my_wd unset my_wd exit 1 fi - mkdir secrets - cp -r NixConfigSecrets/*.yaml secrets/ - git add secrets/*.yaml + mkdir ./secrets + cp ./${secretsPath}/*.yaml ./secrets/ + git add ./secrets/*.yaml if sudo nixos-rebuild switch --flake . "$@"; then - echo "Success: System successfully updated with new configuration" + echo "Success: System successfully updated with new configuration!" else - echo "!!! Failure !!! Failed to apply NixOS configuration" - echo "System version remains unchanged" + echo "Error: Failed to rebuild NixOS configuration" + echo "System not updated!" fi - git reset secrets/*.yaml - rm secrets/*.yaml - rm -d secrets + git reset ./secrets/*.yaml + rm ./secrets/*.yaml + rm -d ./secrets cd $my_wd unset my_wd '';