❄ Personal NixOS Flake Manager
nixos
home-manager
go
nix
1# ❄ Rui
2
3Rui is my personal NixOS flake manager. It isn't very unique to my system at the
4moment, so anyone can use it.
5
6## Useful Commands
7
8- `rui edit` - Open and edit your flake directory from anywhere
9- `rui home/os switch` - Rebuild and switch your home or OS flake configuration
10 from anywhere
11- `rui home news` - Show the latest news from your Home Manager configuration
12 packages
13
14## Installation
15
16### Add to Flake Inputs (for Flakes Users)
17
18```nix
19{
20 inputs.rui = {
21 url = "github:Fuwn/rui";
22 inputs.nixpkgs.follows = "nixpkgs"; # Recommended
23 };
24}
25```
26
27### Add to Home Manager (Managed Configuration)
28
29This method manages the configuration for you with Nix.
30
31```nix
32# ...
33
34inputs.home-manager.lib.homeManagerConfiguration {
35 modules = [
36 inputs.rui.homeManagerModules.${builtins.currentSystem}.default
37 ];
38};
39
40# ...
41```
42
43### Configure Rui Using Home Manager
44
45```nix
46{
47 programs.rui = {
48 enable = true; # Defaults to false
49
50 settings = {
51 # Status notifications via `notify-send`; defaults to false
52 notify = true;
53
54 # The command to use for sending notifications, view a cool example below;
55 # defaults to `notify-send`
56 notifier = "notify-send";
57
58 # Rui falls back on the `FLAKE_EDITOR` and `EDITOR` environment variables
59 # if `editor` is unset
60 editor = "code";
61
62 # Rui falls back on the `FLAKE` environment variable if `flake` is unset
63 flake = "/path/to/your-flake";
64
65 # Allow unfree packages on the global level; defaults to false
66 allow-unfree = false;
67
68 # Allow insecure packages on the global level; defaults to false
69 allow-insecure = false;
70
71 # Extra arguments to pass to `nixos-rebuild` and `home-manager`; defaults
72 # to [ ]
73 extra-args = [ "--impure" ];
74 };
75 };
76}
77```
78
79### Add to System or Home Manager Packages (Manual Configuration)
80
81Using this method, configuration is done manually by the user in the
82`$HOME/.config/rui/config.json` file.
83
84```nix
85# For flakes users
86rui.packages.${pkgs.system}.default
87
88# For non-flakes users
89(import (
90 pkgs.fetchFromGitHub {
91 owner = "Fuwn";
92 repo = "rui";
93 rev = "..."; # Use the current commit revision hash
94 hash = "..."; # Use the current commit sha256 hash
95 }
96)).packages.${builtins.currentSystem}.default
97```
98
99## Custom Notification Command Example
100
101Rui uses `notify-send` by default for sending notifications, but you can set
102the `notifier` configuration value to any file path. Here's an example of a
103distributed notification script that sends notifications to your phone **and**
104your PC. This can easily be adapted to send notifications to any service, e.g.,
105Telegram, Discord, other webhook receivers, etc.
106
107This example uses [Bark](https://bark.day.app/#/?id=%E6%BA%90%E7%A0%81), an
108extremely simple and easy-to-use notification service for iOS devices.
109
110```sh
111#!/usr/bin/env dash
112
113# Send a notification to your host PC
114notify-send "$1" "$2"
115
116# Send a notification to your iOS device
117curl -X "POST" "https://api.day.app/your_bark_api_key" \
118 -H 'Content-Type: application/json; charset=utf-8' \
119 --silent \
120 -d '{
121 "body": "'"${2}"'",
122 "title": "'"${1}"'",
123 "icon": "https://nixos.wiki/images/thumb/2/20/Home-nixos-logo.png/207px-Home-nixos-logo.png"
124 }'
125```
126
127## `--help`
128
129```text
130NAME:
131 rui - Personal NixOS Flake Manager
132
133USAGE:
134 rui [global options] command [command options]
135
136DESCRIPTION:
137 Personal NixOS Flake Manager
138
139AUTHOR:
140 Fuwn <contact@fuwn.me>
141
142COMMANDS:
143 home
144 os
145 edit
146 help, h Shows a list of commands or help for one command
147
148GLOBAL OPTIONS:
149 --allow-unfree (default: false)
150 --help, -h show help
151
152COPYRIGHT:
153 Copyright (c) 2024-2024 Fuwn
154```
155
156## Licence
157
158This project is licensed with the [GNU General Public License v3.0](./LICENSE.txt).