pedroregispoar / nixos-configuration.nix Goto Github PK
View Code? Open in Web Editor NEWHere I am versioning my NixOS stuff, the goal is to have a remote backup.
Here I am versioning my NixOS stuff, the goal is to have a remote backup.
Really useful:
https://releases.nixos.org/?prefix=nixos/22.05/
TODO: Part 0, could merge the injection of the flag --extra-experimental-features 'nix-command flakes'
nix --extra-experimental-features 'nix-command flakes' shell nixpkgs#wget nixpkgs#coreutils
wget https://releases.nixos.org/nixos/22.05/nixos-22.05.1460.9e96b1562d6/nixos-plasma5-22.05.1460.9e96b1562d6-x86_64-linux.iso
wget https://releases.nixos.org/nixos/22.05/nixos-22.05.1460.9e96b1562d6/nixos-plasma5-22.05.1460.9e96b1562d6-x86_64-linux.iso.sha256
cat nixos-plasma5-22.05.1460.9e96b1562d6-x86_64-linux.iso.sha256 | sha256sum -c
# nix --extra-experimental-features 'nix-command flakes' run nixpkgs#etcher
NIXPKGS_ALLOW_INSECURE=1 nix --extra-experimental-features 'nix-command flakes' run nixpkgs#etcher --impure
From:
nix \
--extra-experimental-features 'nix-command flakes' \
profile \
install \
nixpkgs#gitMinimal
test -f "$HOME"/.gitconfig || { cat << EOF > "$HOME"/.gitconfig
[user]
name = Pedro O. A. Regis
email = [email protected]
EOF
} && git config --list \
&& git config user.name \
&& git config user.email
sudo cp -r /etc/nixos/ /etc/nixos-backup \
&& sudo rm -f /etc/nixos/{configuration.nix,hardware-configuration.nix} \
&& sudo chown "$(id -u)":"$(id -g)" -R /etc/nixos \
&& nix \
flake \
--extra-experimental-features 'nix-command flakes' \
clone \
github:PedroRegisPOAR/NixOS-configuration.nix \
--dest /etc/nixos/
# TODO: explain this magic
cd /etc/nixos/ \
&& git remote set-url origin $(git remote show origin | grep "Fetch URL" | sed 's/ *Fetch URL: //' | sed 's/https:\/\/github.com\//[email protected]:/')
# nix \
# build \
# github:PedroRegisPOAR/NixOS-configuration.nix#nixosConfigurations.pedroregispoar.config.system.build.toplevel
#
# TODO: study
# sudo nixos-rebuild boot --install-bootloader --flake '/etc/nixos#pedroregispoar'
cd /etc/nixos/ \
&& git checkout nixos-22.05 \
&& cp -f /etc/nixos-backup/hardware-configuration.nix /etc/nixos/ \
&& git add hardware-configuration.nix \
&& git commit -m 'Adds newly created hardware-configuration.nix'
sudo \
-E \
su \
-p \
-c \
"
nixos-rebuild test --flake '/etc/nixos#pedroregispoar' \
&& nixos-rebuild switch --flake '/etc/nixos#pedroregispoar' \
&& reboot
"
Once I got this erros, and I was willing to save time, so pressed Ctrl + c
:
[sudo] password for pedro:
Cloning into '/etc/nixos'...
remote: Enumerating objects: 659, done.
remote: Counting objects: 100% (145/145), done.
remote: Compressing objects: 100% (99/99), done.
remote: Total 659 (delta 93), reused 98 (delta 46), pack-reused 514
Receiving objects: 100% (659/659), 102.59 KiB | 1.07 MiB/s, done.
Resolving deltas: 100% (405/405), done.
branch 'nixos-22.05' set up to track 'origin/nixos-22.05'.
Switched to a new branch 'nixos-22.05'
[nixos-22.05 d0584dd] Adds newly created hardware-configuration.nix
1 file changed, 2 insertions(+), 2 deletions(-)
building the system configuration...
warning: error: unable to download 'https://cache.nixos.org/nar/0b2vvkawcb1xx2kczi8yjj9bkm4rsgbqzw6673jn2a2xlyarai46.nar.xz': HTTP error 200 ('') (curl error: Timeout was reached); retrying from offset 35651584 in 346 ms
warning: error: unable to download 'https://cache.nixos.org/nar/10j3b9c6r4qxhrzwynm7x6xj9f6phm5w4gqdxb23y8q4140dccbf.nar.xz': HTTP error 200 ('') (curl error: Timeout was reached); retrying from offset 5214729 in 251 ms
warning: error: unable to download 'https://cache.nixos.org/nar/0szhzmbj0bhpnbm7nsgrxsbk7hyp7zpm75jvzys7ihkacahhsckw.nar.xz': HTTP error 200 ('') (curl error: Timeout was reached); retrying from offset 4620279 in 290 ms
warning: error: unable to download 'https://cache.nixos.org/nar/1rx22qyn2hq5lq3xy2zkvydqdh6wmcavqa6yj30hqc7ks1b0snck.nar.xz': HTTP error 200 ('') (curl error: Timeout was reached); retrying from offset 1245184 in 325 ms
warning: error: unable to download 'https://cache.nixos.org/nar/10j3b9c6r4qxhrzwynm7x6xj9f6phm5w4gqdxb23y8q4140dccbf.nar.xz': Timeout was reached (28); retrying from offset 5214729 in 695 ms
warning: error: unable to download 'https://cache.nixos.org/nar/0szhzmbj0bhpnbm7nsgrxsbk7hyp7zpm75jvzys7ihkacahhsckw.nar.xz': Timeout was reached (28); retrying from offset 4620279 in 527 ms
warning: error: unable to download 'https://cache.nixos.org/nar/1rx22qyn2hq5lq3xy2zkvydqdh6wmcavqa6yj30hqc7ks1b0snck.nar.xz': Timeout was reached (28); retrying from offset 1245184 in 595 ms
warning: error: unable to download 'https://cache.nixos.org/nar/0b2vvkawcb1xx2kczi8yjj9bkm4rsgbqzw6673jn2a2xlyarai46.nar.xz': Timeout was reached (28); retrying from offset 35651584 in 677 ms
warning: error: unable to download 'https://cache.nixos.org/nar/0szhzmbj0bhpnbm7nsgrxsbk7hyp7zpm75jvzys7ihkacahhsckw.nar.xz': Timeout was reached (28); retrying from offset 4620279 in 1057 ms
warning: error: unable to download 'https://cache.nixos.org/nar/10j3b9c6r4qxhrzwynm7x6xj9f6phm5w4gqdxb23y8q4140dccbf.nar.xz': Timeout was reached (28); retrying from offset 5214729 in 1362 ms
warning: error: unable to download 'https://cache.nixos.org/nar/1rx22qyn2hq5lq3xy2zkvydqdh6wmcavqa6yj30hqc7ks1b0snck.nar.xz': Timeout was reached (28); retrying from offset 1245184 in 1178 ms
warning: error: unable to download 'https://cache.nixos.org/nar/0b2vvkawcb1xx2kczi8yjj9bkm4rsgbqzw6673jn2a2xlyarai46.nar.xz': Timeout was reached (28); retrying from offset 35651584 in 1328 ms
[0/770 built, 4/97/1558 copied (255.6/11625.5 MiB), 44.6/3713.1 MiB DL] fetching font-adobe-75dpi-1.0.3 from https://cache.nixos.org^C
error: interrupted by the user
And re run the last command.
Note: considering having an flash drive bootable, backup and install from scratch
(github/some remote) is really magic.For some really unknown reason the system just did not show up the interface any more, broken system.
I did not want to spend lots of time trying to figure out an hack way to recover the system. I did a boot
from this previously built flash drive and backup the "frozen" (actually read only file system)
from the just died system and a full re install.
command -v ssh-keygen || nix profile install nixpkgs#openssh
command -v git || nix profile install nixpkgs#git
ssh-keygen \
-t ed25519 \
-C "$(git config user.email)" \
-f "${HOME}"/.ssh/id_ed25519 \
-N '' \
&& echo \
&& cat "${HOME}"/.ssh/id_ed25519.pub \
&& echo
Go to:
https://github.com/settings/ssh/new
Optional, but recommended:
ssh -T -o ConnectTimeout=3 [email protected] &>/dev/null
ssh -T -o ConnectTimeout=3 [email protected] &>/dev/null
test $? -eq 1 || echo 'Error in ssh -T -o ConnectTimeout=3 [email protected]'
hardware-configuration.nix
sudo rm -fr /etc/nixos-backup
cd /etc/nixos/ \
&& git push
[ -d /sys/firmware/efi/efivars ] && echo "UEFI" || echo "Legacy"
From: https://nixos.wiki/wiki/Bootloader
nix \
--extra-experimental-features 'nix-command flakes' \
flake \
update \
--override-input nixpkgs github:NixOS/nixpkgs/nixos-22.05
nix \
--extra-experimental-features 'nix-command flakes' \
flake \
update \
--override-input nixpkgs github:SuperSandro2000/nixpkgs/i18n-always-c
https://www.youtube.com/watch?v=aeDbYuJyXr8&t=43s
nix \
--extra-experimental-features 'nix-command flakes' \
build \
github:PedroRegisPOAR/NixOS-configuration.nix/nixos-22.05#nixosConfigurations.pedroregispoar.config.system.build.toplevel
I was being hitted by a really annoying permission denied error.
Solution:
sudo chown --recursive pedro /etc/nixos
Generalise?
sudo chown --recursive "$USER" /etc/nixos
nix \
build \
github:PedroRegisPOAR/NixOS-configuration.nix#nixosConfigurations.pedroregispoar.config.system.build.toplevel
https://github.com/tfc/nixos-offline-installer#how-to-test-in-qemu
https://discourse.nixos.org/t/declarative-kde-configuration/15901/5
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.