aboutsummaryrefslogtreecommitdiff
path: root/README.md
blob: 114a52b556ab2809c74b04ee45d4fe5f406710c3 (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
# 🌈 `pywal.nix`

> Extremely straightforward evaluation-time Pywal integration for Home Manager

`pywal.nix` is focused on providing the simplest way of integrating custom
Pywal colour schemes into any Home Manager configuration at evaluation-time.

I needed a pure (not `--impure`) Nix solution. I made a pure Nix solution. It
works well.

## Installation

### Standalone Home-Manager

```nix
{ pkgs, ... }:
{
  imports = [
    (import (
      pkgs.fetchFromGitHub {
        owner = "Fuwn";
        repo = "pywal.nix";
        rev = "...";  # Use the current commit revision hash
        hash = "..."; # Use the current commit sha256 hash
      }
    )).homeManagerModules.${builtins.currentSystem}.default
  ];
}
```

> You can use projects like [nurl](https://github.com/nix-community/nurl) and
> [`nix-prefetch`](https://github.com/msteen/nix-prefetch) to simplify the
> usage of `fetchFromGitHub`.

### Flakes & Home-Manager

Add `pywal.nix` to your flake inputs.

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

After adding `pywal.nix` to your flake inputs, consume it as a Home Manager
module.

```nix
# ...

inputs.home-manager.lib.homeManagerConfiguration {
  modules = [
    inputs.pywal-nix.homeManagerModules.${pkgs.system}.default
  ];
};

# ...
```

## Configuration & Usage

Configure and access `pywal.nix` in your Home Manager configuration through the
`pywal-nix` attribute.

```nix
{ pkgs, config, ... }:
{
  # Configuration
  pywal-nix = {
    wallpaper = /path/to/wallpaper.png; # Required
    light = false;                      # Defaults to false
    backend = "wal";                    # One of "colorthief", "colorz",
                                        # "fast_colorthief", "haishoku",
                                        # "schemer2", "wal"; Default to "wal"
    enableKittyIntegration = true;      # Defaults to true
  };

  # Example usage to print out few colours
  home.packages = [
    (pkgs.writeShellScriptBin "colour-scheme-sample" ''
      echo '${config.pywal-nix.colourScheme.wallpaper}'
      echo '${config.pywal-nix.colourScheme.special.background}'
      echo '${config.pywal-nix.colourScheme.colours.colour9}'
    '')
  ];
}
```

### Colour Scheme

`pywal.nix`'s generated colour scheme is accessible through either the
`colourScheme` or `colorScheme` set. Likewise, colours are accessible through
either the `colours` or `colors` sets.

The colour scheme interface generated by `pywal.nix` comes in the following shape:

```typescript
{
  wallpaper: string

  special: {
    background: string
    foreground: string
    cursor: string
  }

  colours: { // or colors
    colour0: string // or color0
    // colour1 ... colour14 or color1 ... color15
    colour15: string // or color15
  }
}
```

## Pywal

This project includes multiple files from
[dylanaraps/pywal](https://github.com/dylanaraps/pywal), a project which is
licensed under the [MIT License](./pywal/LICENSE.md).

- [`pywal/backends/colorthief.py`](https://github.com/dylanaraps/pywal/blob/master/pywal/backends/colorthief.py)
- [`pywal/backends/colorz.py`](https://github.com/dylanaraps/pywal/blob/master/pywal/backends/colorz.py)
- [`pywal/backends/fast_colorthief.py`](https://github.com/dylanaraps/pywal/blob/master/pywal/backends/fast_colorthief.py)
- [`pywal/backends/haishoku.py`](https://github.com/dylanaraps/pywal/blob/master/pywal/backends/haishoku.py)
- [`pywal/backends/schemer2.py`](https://github.com/dylanaraps/pywal/blob/master/pywal/backends/schemer2.py)
- [`pywal/backends/wal.py`](https://github.com/dylanaraps/pywal/blob/master/pywal/backends/wal.py)
- [`pywal/colors.py`](https://github.com/dylanaraps/pywal/blob/master/pywal/colors.py)
- [`pywal/theme.py`](https://github.com/dylanaraps/pywal/blob/master/pywal/theme.py)
- [`pywal/util.py`](https://github.com/dylanaraps/pywal/blob/master/pywal/util.py)

## Licence

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