diff options
author | Patryk Niedźwiedziński <pniedzwiedzinski19@gmail.com> | 2024-09-29 18:46:40 +0200 |
---|---|---|
committer | Patryk Niedźwiedziński <pniedzwiedzinski19@gmail.com> | 2024-09-29 18:46:40 +0200 |
commit | e08d3044e4eb1f484abaf609779707dd9bbdc684 (patch) | |
tree | 28ac7678e735d865d1ff9a6b417d9c9546748021 | |
parent | c4d8fa4a27d15f612043317a2a17837a841b0f41 (diff) | |
download | dots-e08d3044e4eb1f484abaf609779707dd9bbdc684.tar.gz dots-e08d3044e4eb1f484abaf609779707dd9bbdc684.zip |
t14: 23 current 2024-09-29 18:35:34 24.05.20240928.fbca5e7 6.6.52 *
-rw-r--r-- | config.nix | 10 | ||||
-rw-r--r-- | machines/t14/configuration.nix | 2 | ||||
-rwxr-xr-x | rebuild/rebuild.sh | 49 |
3 files changed, 1 insertions, 60 deletions
diff --git a/config.nix b/config.nix deleted file mode 100644 index 6018d65..0000000 --- a/config.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ - allowUnfree = true; - packageOverrides = pkgs: { - nur = import (builtins.fetchTarball { - url = "https://github.com/nix-community/NUR/archive/master.tar.gz"; - }) { - inherit pkgs; - }; - }; -} diff --git a/machines/t14/configuration.nix b/machines/t14/configuration.nix index 3b0cf44..506b05f 100644 --- a/machines/t14/configuration.nix +++ b/machines/t14/configuration.nix @@ -1,6 +1,6 @@ { config, pkgs, ... }: let - rebuild = pkgs.writeShellScriptBin "rebuild" (builtins.readFile ../../rebuild/rebuild.sh); + rebuild = pkgs.writeShellScriptBin "rebuild" (builtins.readFile ../../rebuild.sh); in { imports = [ # Include the results of the hardware scan. diff --git a/rebuild/rebuild.sh b/rebuild/rebuild.sh deleted file mode 100755 index daa190e..0000000 --- a/rebuild/rebuild.sh +++ /dev/null @@ -1,49 +0,0 @@ -#!/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. -# `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) - -DIR=$HOME/nixos - -# A rebuild script that commits on a successful build -set -e - -# cd to your config dir -pushd $DIR - -# Early return if no changes were detected (thanks @singiamtel!) -if git diff --quiet '*'; then - echo "No changes detected, exiting." - popd - exit 0 -fi - -# Autoformat your nix files -# alejandra . &>/dev/null \ -# || ( alejandra . ; echo "formatting failed!" && exit 1) - -# Shows your changes -git diff -U0 '*' - -echo "NixOS Rebuilding..." - -# Rebuild, output simplified errors, log trackebacks -(sudo nixos-rebuild switch --flake $DIR 2>&1 | tee nixos-switch.log) || exit 2 - -# Get current generation metadata -current=$(nixos-rebuild list-generations | grep current) - -# Commit all changes witih the generation metadata -git commit -am "$(hostname): $current" - -# Back to where you were -popd - -# Notify all OK! -notify-send -e "NixOS Rebuilt OK!" --icon=software-update-available |