Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jwillikers/nix-update-scripts
Scripts to automatically update a few Nix-related things, like the version of nix-direnv in .envrc files and the NixOS release in of the nixpkgs flake input
https://github.com/jwillikers/nix-update-scripts
nix nix-direnv nixos nushell update updater
Last synced: 10 days ago
JSON representation
Scripts to automatically update a few Nix-related things, like the version of nix-direnv in .envrc files and the NixOS release in of the nixpkgs flake input
- Host: GitHub
- URL: https://github.com/jwillikers/nix-update-scripts
- Owner: jwillikers
- License: mit
- Created: 2024-10-17T17:04:26.000Z (19 days ago)
- Default Branch: main
- Last Pushed: 2024-10-24T19:29:44.000Z (12 days ago)
- Last Synced: 2024-10-26T04:59:21.163Z (11 days ago)
- Topics: nix, nix-direnv, nixos, nushell, update, updater
- Language: Nushell
- Homepage:
- Size: 46.9 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.adoc
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.adoc
Awesome Lists containing this project
README
= Nix Update Scripts
Jordan Williams
:experimental:
:icons: font
ifdef::env-github[]
:tip-caption: :bulb:
:note-caption: :information_source:
:important-caption: :heavy_exclamation_mark:
:caution-caption: :fire:
:warning-caption: :warning:
endif::[]
:Asciidoctor_: https://asciidoctor.org/[Asciidoctor]
:just: https://github.com/casey/just[just]
:Linux: https://www.linuxfoundation.org/[Linux]
:Nix: https://nixos.org/[Nix]
:nix-direnv: https://github.com/nix-community/nix-direnv[nix-direnv]Scripts to automatically update a few Nix-related things, like the version of `nix-direnv` in `.envrc` files and the NixOS release in of the `nixpkgs` flake input.
== Usage
Use Nix to incorporate these scripts in your project.
Here's an example of how to incorporate this repository's flake as part of your project so that `nix run` can be used to run the provided scripts.. Add `nix-update-scripts` to `flake.nix` and include the desired apps in the flake's apps output.
The following example demonstrates how to do this for the `update-nix-direnv` and `update-nixos-release` apps.
+
.flake.nix
[,nix]
----
{
inputs = {
flake-utils.url = "github:numtide/flake-utils";
nix-update-scripts.url = "github:NixOS/nixpkgs/nixos-unstable";
};
outputs =
{
self,
flake-utils,
nix-update-scripts,
}:
flake-utils.lib.eachDefaultSystem (
system:
{
apps = {
inherit (nix-update-scripts.apps.${system}) update-nix-direnv;
inherit (nix-update-scripts.apps.${system}) update-nixos-release;
};
}
);
}
----. Now it is possible to run the apps using `nix run` like so.
+
[,sh]
----
nix run '.#update-nix-direnv'
----Examples of how to use these scripts in GitHub Actions can be found in the link:.github/workflows/update-nix-direnv.yaml[update-nix-direnv workflow] and the link:.github/workflows/update-nixos-release.yaml[update-nixos-release workflow].
== Develop
The `nix develop` command can be used to enter or run commands in an environment with all of the necessary dependencies.
For convenience, direnv can be used to automatically load this environment when entering the project's directory.
The https://marketplace.visualstudio.com/items?itemName=mkhl.direnv[mkhl.direnv VSCode extension] integrates this environment in VSCode for development.
Nix also generates the configuration for https://pre-commit.com/[pre-commit], which automates formatting and various checks when committing changes.
Follow the instructions here to set up your development environment using Nix.. Install an implementation of {Nix}, such as https://lix.systems[Lix] used here.
+
[,sh]
----
curl -sSf -L https://install.lix.systems/lix | sh -s -- install
----. Clone this project's repository.
+
[,sh]
----
git clone https://github.com/jwillikers/nix-update-scripts.git
----. Change into the project directory.
+
[,sh]
----
cd nix-update-scripts
----. Install direnv for your system according to the https://direnv.net/docs/installation.html[direnv installation instructions].
+
[,sh]
----
sudo rpm-ostree install direnv
sudo systemctl reboot
----. Integrate direnv with your shell by following the instructions on the https://direnv.net/docs/hook.html[direnv Setup page].
. Permit the direnv configuration for the repository.
+
[,sh]
----
direnv allow
----. Use `nix run` to run the appropriate target.
+
[,sh]
----
nix run '.#update-nix-direnv'
----== See Also
* https://github.com/Mic92/nix-update[nix-update]
* https://github.com/nix-community/nixpkgs-update[nixpkgs-update]== Contributing
Contributions in the form of issues, feedback, and even pull requests are welcome.
Make sure to adhere to the project's link:CODE_OF_CONDUCT.adoc[Code of Conduct].== Code of Conduct
Refer to the project's link:CODE_OF_CONDUCT.adoc[Code of Conduct] for details.
== License
This repository is licensed under the link:LICENSE[MIT license].
© 2024 Jordan Williams
== Authors
mailto:{email}[{author}]