aboutsummaryrefslogtreecommitdiff
path: root/README.md
blob: b666424e413fd203ce20083f4abf9270a6842d9a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
# ❄ Rui

Rui is my personal NixOS flake manager. It isn't very unique to my system at the
moment, so anyone can use it.

## Useful Commands

- `rui edit` - Open and edit your flake directory from anywhere
- `rui home/os switch` - Rebuild and switch your home or OS flake configuration
  from anywhere
- `rui home news` - Show the latest news from your Home Manager configuration
  packages

## Installation

### Add to Flake Inputs (for Flakes Users)

```nix
{
  inputs.rui = {
    url = "github:Fuwn/rui";
    inputs.nixpkgs.follows = "nixpkgs"; # Recommended
  };
}
```

### Add to Home Manager (Managed Configuration)

This method manages the configuration for you with Nix.

```nix
# ...

inputs.home-manager.lib.homeManagerConfiguration {
  modules = [
    inputs.rui.homeManagerModules.${builtins.currentSystem}.default
  ];
};

# ...
```

### Configure Rui Using Home Manager

```nix
{
  programs.rui = {
    enable = true;

    settings = {
      # Status notifications via `notify-send`
      notify = true;

      # The command to use for sending notifications, view a cool example below!
      notifier = "notify-send";

      # Rui falls back on the `FLAKE_EDITOR` and `EDITOR` environment variables
      editor = "code";

      # Rui falls back on the `FLAKE` environment variable
      flake = "/path/to/your-flake";

      # Allow unfree packages
      allow-unfree = false;
    };
  };
}
```

### Add to System or Home Manager Packages (Manual Configuration)

Using this method, configuration is done manually by the user in the
`$HOME/.config/rui/config.json` file.

```nix
# For flakes users
rui.packages.${pkgs.system}.default

# For non-flakes users
(import (
  pkgs.fetchFromGitHub {
    owner = "Fuwn";
    repo = "rui";
    rev = "...";  # Use the current commit revision hash
    hash = "..."; # Use the current commit sha256 hash
  }
)).packages.${builtins.currentSystem}.default
```

## Custom Notification Command Example

Rui uses `notify-send` by default for sending notifications, but you can set
the `notifier` configuration value to any file path. Here's an example of a
distributed notification script that sends notifications to your phone **and**
your PC. This can easily be adapted to send notifications to any service, e.g.,
Telegram, Discord, other webhook receivers, etc.

This example uses [Bark](https://bark.day.app/#/?id=%E6%BA%90%E7%A0%81), an
extremely simple and easy-to-use notification service for iOS devices.

```sh
#!/usr/bin/env dash

# Send a notification to your host PC
notify-send "$1" "$2"

# Send a notification to your iOS device
curl -X "POST" "https://api.day.app/your_bark_api_key" \
  -H 'Content-Type: application/json; charset=utf-8' \
  --silent \
  -d '{
    "body": "'"${2}"'",
    "title": "'"${1}"'",
    "icon": "https://nixos.wiki/images/thumb/2/20/Home-nixos-logo.png/207px-Home-nixos-logo.png"
  }'
```

## `--help`

```text
NAME:
   rui - Personal NixOS Flake Manager

USAGE:
   rui [global options] command [command options]

DESCRIPTION:
   Personal NixOS Flake Manager

AUTHOR:
   Fuwn <[email protected]>

COMMANDS:
   home
   os
   edit
   help, h  Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --allow-unfree  (default: false)
   --help, -h      show help

COPYRIGHT:
   Copyright (c) 2024-2024 Fuwn
```

## Licence

This project is licensed with the [GNU General Public License v3.0](./LICENSE.txt).