diff --git a/modules/build/initial-build.nix b/modules/build/initial-build.nix index f88b5e9..21093a2 100644 --- a/modules/build/initial-build.nix +++ b/modules/build/initial-build.nix @@ -39,6 +39,7 @@ with lib; environment.etc = { "group".enable = false; "passwd".enable = false; + "UNINTIALISED".text = ""; }; }; diff --git a/modules/environment/login/login-inner.nix b/modules/environment/login/login-inner.nix index e518486..1e09153 100644 --- a/modules/environment/login/login-inner.nix +++ b/modules/environment/login/login-inner.nix @@ -23,51 +23,51 @@ writeText "login-inner" '' export GC_NPROCS=1 # to prevent gc warnings of nix, see https://github.com/NixOS/nix/issues/3237 ${lib.optionalString config.build.initialBuild '' - echo "Set default user profile..." - ${nix}/bin/nix-env --switch-profile /nix/var/nix/profiles/per-user/$USER/profile + if [[ -e /etc/UNINTIALISED ]]; then + echo "Set default user profile..." + ${nix}/bin/nix-env --switch-profile /nix/var/nix/profiles/per-user/$USER/profile - [ "$#" -gt 0 ] || echo "Sourcing Nix environment..." - . ${nix}/etc/profile.d/nix.sh + [ "$#" -gt 0 ] || echo "Sourcing Nix environment..." + . ${nix}/etc/profile.d/nix.sh - export NIX_SSL_CERT_FILE=${cacert} + export NIX_SSL_CERT_FILE=${cacert} - echo "Installing and updating nix-channels..." - ${nix}/bin/nix-channel --add ${config.build.channel.nixpkgs} nixpkgs - ${nix}/bin/nix-channel --update nixpkgs - ${nix}/bin/nix-channel --add ${config.build.channel.nix-on-droid} nix-on-droid - ${nix}/bin/nix-channel --update nix-on-droid + echo "Installing and updating nix-channels..." + ${nix}/bin/nix-channel --add ${config.build.channel.nixpkgs} nixpkgs + ${nix}/bin/nix-channel --update nixpkgs + ${nix}/bin/nix-channel --add ${config.build.channel.nix-on-droid} nix-on-droid + ${nix}/bin/nix-channel --update nix-on-droid - echo "Copy default nix-on-droid config..." - ${coreutils}/bin/mkdir --parents $HOME/.config/nixpkgs - ${coreutils}/bin/cp $(${nix}/bin/nix-instantiate --eval --expr "") $HOME/.config/nixpkgs/nix-on-droid.nix - ${coreutils}/bin/chmod u+w $HOME/.config/nixpkgs/nix-on-droid.nix + echo "Copy default nix-on-droid config..." + ${coreutils}/bin/mkdir --parents $HOME/.config/nixpkgs + ${coreutils}/bin/cp $(${nix}/bin/nix-instantiate --eval --expr "") $HOME/.config/nixpkgs/nix-on-droid.nix + ${coreutils}/bin/chmod u+w $HOME/.config/nixpkgs/nix-on-droid.nix - echo "Installing first nix-on-droid generation..." - ${nix}/bin/nix build --no-link --file "" nix-on-droid - $(${nix}/bin/nix path-info --file "" nix-on-droid)/bin/nix-on-droid switch + echo "Installing first nix-on-droid generation..." + ${nix}/bin/nix build --no-link --file "" nix-on-droid + $(${nix}/bin/nix path-info --file "" nix-on-droid)/bin/nix-on-droid switch - echo - echo "Congratulations! Now you have Nix installed with some default packages like bashInteractive, \ - coreutils, cacert and most important nix-on-droid itself to manage local configuration, see" - echo " nix-on-droid help" - echo "or in the config file" - echo " ~/.config/nixpkgs/nix-on-droid.nix" - echo - echo "You can go for the bare nix-on-droid setup or you can configure your phone via home-manager. See \ - config file for further information." - echo + echo + echo "Congratulations! Now you have Nix installed with some default packages like bashInteractive, \ + coreutils, cacert and most important nix-on-droid itself to manage local configuration, see" + echo " nix-on-droid help" + echo "or in the config file" + echo " ~/.config/nixpkgs/nix-on-droid.nix" + echo + echo "You can go for the bare nix-on-droid setup or you can configure your phone via home-manager. See \ + config file for further information." + echo + fi ''} [ "$#" -gt 0 ] || echo "Sourcing Nix environment..." . $HOME/.nix-profile/etc/profile.d/nix.sh - ${lib.optionalString (config.home-manager.config != null) '' - if [ -e "$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh" ]; then - [ "$#" -gt 0 ] || echo "Sourcing home-manager environment..." - export NIX_PATH=$HOME/.nix-defexpr/channels''${NIX_PATH:+:}$NIX_PATH - . "$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh" - fi - ''} + if [ -e "$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh" ]; then + [ "$#" -gt 0 ] || echo "Sourcing home-manager environment..." + export NIX_PATH=$HOME/.nix-defexpr/channels''${NIX_PATH:+:}$NIX_PATH + . "$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh" + fi # Workaround for https://github.com/NixOS/nix/issues/1865 export NIX_PATH=nixpkgs=$HOME/.nix-defexpr/channels/nixpkgs/:$NIX_PATH