-
-
Save lvnilesh/92bdc77dfc703bd9e96baf342187c6f5 to your computer and use it in GitHub Desktop.
Revisions
-
0atman revised this gist
Mar 20, 2024 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -19,7 +19,7 @@ $EDITOR configuration.nix pushd ~/dotfiles/nixos/ # Early return if no changes were detected (thanks @singiamtel!) if git diff --quiet '*.nix'; then echo "No changes detected, exiting." popd exit 0 @@ -30,7 +30,7 @@ alejandra . &>/dev/null \ || ( alejandra . ; echo "formatting failed!" && exit 1) # Shows your changes git diff -U0 '*.nix' echo "NixOS Rebuilding..." -
0atman revised this gist
Mar 19, 2024 . 1 changed file with 3 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -26,15 +26,16 @@ if git diff --quiet *.nix; then fi # Autoformat your nix files alejandra . &>/dev/null \ || ( alejandra . ; echo "formatting failed!" && exit 1) # Shows your changes git diff -U0 *.nix echo "NixOS Rebuilding..." # Rebuild, output simplified errors, log trackebacks sudo nixos-rebuild switch &>nixos-switch.log || (cat nixos-switch.log | grep --color error && exit 1) # Get current generation metadata current=$(nixos-rebuild list-generations | grep current) -
0atman revised this gist
Mar 19, 2024 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -12,6 +12,9 @@ # A rebuild script that commits on a successful build set -e # Edit your config $EDITOR configuration.nix # cd to your config dir pushd ~/dotfiles/nixos/ @@ -22,9 +25,6 @@ if git diff --quiet *.nix; then exit 0 fi # Autoformat your nix files alejandra . >/dev/null -
0atman revised this gist
Mar 15, 2024 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -15,7 +15,7 @@ set -e # cd to your config dir pushd ~/dotfiles/nixos/ # Early return if no changes were detected (thanks @singiamtel!) if git diff --quiet *.nix; then echo "No changes detected, exiting." popd -
0atman revised this gist
Mar 15, 2024 . 1 changed file with 7 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -15,6 +15,13 @@ set -e # cd to your config dir pushd ~/dotfiles/nixos/ # Exit early if no files changed (thanks @singiamtel!) if git diff --quiet *.nix; then echo "No changes detected, exiting." popd exit 0 fi # Edit your config $EDITOR configuration.nix -
0atman revised this gist
Mar 3, 2024 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -6,6 +6,7 @@ # 2. Symlinking to your own configuration.nix in your home directory (I think I tried and abandoned this and links made relative paths weird) # 3. My new favourite way: as @clot27 says, you can provide nixos-rebuild with a path to the config, allowing it to be entirely inside your dotfies, with zero bootstrapping of files required. # `nixos-rebuild switch -I nixos-config=path/to/configuration.nix` # 4. If you uses a flake as your primary config, you can specify a path to `configuration.nix` in it and then `nixos-rebuild switch —flake` path/to/directory # As I hope was clear from the video, I am new to nixos, and there may be other, better, options, in which case I'd love to know them! (I'll update the gist if so) # A rebuild script that commits on a successful build -
0atman revised this gist
Mar 3, 2024 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -18,7 +18,7 @@ pushd ~/dotfiles/nixos/ $EDITOR configuration.nix # Autoformat your nix files alejandra . >/dev/null # Shows your changes git diff -U0 *.nix -
0atman revised this gist
Mar 3, 2024 . No changes.There are no files selected for viewing
-
0atman revised this gist
Mar 2, 2024 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,7 +5,7 @@ # 1. My current way, using a minimal /etc/nixos/configuration.nix that just imports my config from my home directory (see it in the gist) # 2. Symlinking to your own configuration.nix in your home directory (I think I tried and abandoned this and links made relative paths weird) # 3. My new favourite way: as @clot27 says, you can provide nixos-rebuild with a path to the config, allowing it to be entirely inside your dotfies, with zero bootstrapping of files required. # `nixos-rebuild switch -I nixos-config=path/to/configuration.nix` # As I hope was clear from the video, I am new to nixos, and there may be other, better, options, in which case I'd love to know them! (I'll update the gist if so) # A rebuild script that commits on a successful build -
0atman revised this gist
Mar 2, 2024 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,7 +4,7 @@ options, ... }: let hostname = "oatman-pc"; # to alllow per-machine config in { networking.hostName = hostname; -
0atman revised this gist
Mar 2, 2024 . 1 changed file with 15 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,15 @@ { config, pkgs, options, ... }: let hostname = "oatman-pc"; in { networking.hostName = hostname; imports = [ /etc/nixos/hardware-configuration.nix (/home/oatman/dotfiles/nixos + "/${hostname}.nix") ]; } -
0atman revised this gist
Mar 2, 2024 . 1 changed file with 9 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,13 @@ #!/usr/bin/env bash # # I believe there are a few ways to do this: # # 1. My current way, using a minimal /etc/nixos/configuration.nix that just imports my config from my home directory (see it in the gist) # 2. Symlinking to your own configuration.nix in your home directory (I think I tried and abandoned this and links made relative paths weird) # 3. My new favourite way: as @clot27 says, you can provide nixos-rebuild with a path to the config, allowing it to be entirely inside your dotfies, with zero bootstrapping of files required. # # As I hope was clear from the video, I am new to nixos, and there may be other, better, options, in which case I'd love to know them! (I'll update the gist if so) # A rebuild script that commits on a successful build set -e -
0atman revised this gist
Feb 27, 2024 . 1 changed file with 20 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,13 +2,31 @@ # A rebuild script that commits on a successful build set -e # cd to your config dir pushd ~/dotfiles/nixos/ # Edit your config $EDITOR configuration.nix # Autoformat your nix files alejandra . &>/dev/null # Shows your changes git diff -U0 *.nix echo "NixOS Rebuilding..." # Rebuild, output simplified errors, log trackebacks sudo nixos-rebuild switch &>nixos-switch.log || (cat nixos-switch.log | grep --color error && false) # Get current generation metadata current=$(nixos-rebuild list-generations | grep current) # Commit all changes witih the generation metadata git commit -am "$current" # Back to where you were popd # Notify all OK! notify-send -e "NixOS Rebuilt OK!" --icon=software-update-available -
0atman revised this gist
Feb 27, 2024 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -7,7 +7,7 @@ nvim configuration.nix alejandra . &>/dev/null git diff -U0 *.nix echo "NixOS Rebuilding..." sudo nixos-rebuild switch &>nixos-switch.log || (cat nixos-switch.log | grep --color error && false) current=$(nixos-rebuild list-generations | grep current) git commit -am "$current" popd -
0atman revised this gist
Feb 27, 2024 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,7 +3,7 @@ set -e pushd ~/dotfiles/nixos/ nvim configuration.nix alejandra . &>/dev/null git diff -U0 *.nix echo "NixOS Rebuilding..." -
0atman revised this gist
Feb 25, 2024 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ #!/usr/bin/env bash # A rebuild script that commits on a successful build set -e -
0atman revised this gist
Feb 25, 2024 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,11 +4,11 @@ set -e pushd ~/dotfiles/nixos/ nvim oatman-pc.nix alejandra . &>/dev/null git diff -U0 *.nix echo "NixOS Rebuilding..." sudo nixos-rebuild switch --impure --flake /etc/nixos/#default &>nixos-switch.log || (cat nixos-switch.log | grep --color error && false) current=$(nixos-rebuild list-generations | grep current) git commit -am "$current" popd notify-send -e "NixOS Rebuilt OK!" --icon=software-update-available -
0atman renamed this gist
Feb 24, 2024 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
0atman created this gist
Feb 24, 2024 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,14 @@ #!/bin/bash # A rebuild script that commits on a successful build set -e pushd ~/dotfiles/nixos/ nvim oatman-pc.nix git diff -U0 *.nix echo "NixOS Rebuilding..." sudo nixos-rebuild switch --impure --flake /etc/nixos/#default &>nixos-switch.log || (cat nixos-switch.log | grep --color error && false) current=$(nixos-rebuild list-generations | grep current) alejandra . &>/dev/null git commit -am "$current" popd notify-send -e "NixOS Rebuilt OK!" --icon=software-update-available