From 2f946add15ef3ab917a95f3c9a7dac09029b8ae6 Mon Sep 17 00:00:00 2001 From: Himadri Bhattacharjee <107522312+lavafroth@users.noreply.github.com> Date: Fri, 24 Oct 2025 17:48:32 +0530 Subject: [PATCH] feat: current nixos generation number --- .../post/nix-bytes-build-check-with-flakes.md | 19 ---------------- content/post/nixos-notes-to-self.md | 22 +++++++++++++++++++ 2 files changed, 22 insertions(+), 19 deletions(-) delete mode 100644 content/post/nix-bytes-build-check-with-flakes.md diff --git a/content/post/nix-bytes-build-check-with-flakes.md b/content/post/nix-bytes-build-check-with-flakes.md deleted file mode 100644 index 067bf366..00000000 --- a/content/post/nix-bytes-build-check-with-flakes.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -title: "Nix bytes: Check if a package builds with flakes" -date: 2025-10-15T18:11:15+05:30 -draft: false ---- - -- Ensure flakes are enabled -- Create the package derviation file in `./package.nix` -- Add the following to `builder.nix` - -```nix -(import {}).callPackage ./package.nix { } -``` - -- Run `nix build` on it - -```sh -nix build -f ./builder.nix -``` diff --git a/content/post/nixos-notes-to-self.md b/content/post/nixos-notes-to-self.md index 77743615..fe6b5d0d 100644 --- a/content/post/nixos-notes-to-self.md +++ b/content/post/nixos-notes-to-self.md @@ -41,3 +41,25 @@ nix-channel --update Further reading: [NixOS discourse](https://discourse.nixos.org/t/command-not-found-unable-to-open-database/3807). + +## Check if a package builds (flakes enabled) + +- Ensure flakes are enabled +- Create the package derviation file in `./package.nix` +- Add the following to `builder.nix` + +```nix +(import {}).callPackage ./package.nix { } +``` + +- Run `nix build` on it + +```sh +nix build -f ./builder.nix +``` + +## Get current NixOS generation number + +```sh +readlink /nix/var/nix/profiles/system | cut -d- -f2 +```