mirror of
https://github.com/lavafroth/lavafroth.github.io.git
synced 2026-05-31 20:31:20 -03:00
feat: current nixos generation number
This commit is contained in:
@@ -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 <nixpkgs> {}).callPackage ./package.nix { }
|
||||
```
|
||||
|
||||
- Run `nix build` on it
|
||||
|
||||
```sh
|
||||
nix build -f ./builder.nix
|
||||
```
|
||||
@@ -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 <nixpkgs> {}).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
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user