diff options
| author | Fuwn <[email protected]> | 2024-09-13 06:05:03 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2024-09-13 06:09:51 -0700 |
| commit | 11c3e7825e6785fb8f085b8c0d59c0bd8796a604 (patch) | |
| tree | 27ba36e738361778f5722d44f245cc3117b65e9a | |
| parent | f6f43b6911b903a47403db44dcc0a22e07840499 (diff) | |
| download | pywal.nix-11c3e7825e6785fb8f085b8c0d59c0bd8796a604.tar.xz pywal.nix-11c3e7825e6785fb8f085b8c0d59c0bd8796a604.zip | |
feat(nix): implement standalone mode
| -rw-r--r-- | README.md | 42 | ||||
| -rw-r--r-- | default.nix | 12 | ||||
| -rw-r--r-- | flake.lock | 15 | ||||
| -rw-r--r-- | flake.nix | 1 |
4 files changed, 59 insertions, 11 deletions
@@ -8,25 +8,43 @@ 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. -## Usage +## Installation -### Flake +### 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 + } + )).${builtins.currentSystem}.homeManagerModules.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 - }; + inputs.pywal-nix = { + url = "github:Fuwn/pywal-nix"; + inputs.nixpkgs.follows = "nixpkgs"; # Recommended }; } ``` -### Home Manager - After adding `pywal-nix` to your flake inputs, consume it as a Home Manager module. @@ -42,8 +60,10 @@ inputs.home-manager.lib.homeManagerConfiguration { # ... ``` -Finally, configure and access `pywal-nix` in your Home Manager configuration through -the `pywal-nix` attribute. +## Configuration & Usage + +Configure and access `pywal-nix` in your Home Manager configuration through the +`pywal-nix` attribute. ```nix { pkgs, config, ... }: diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..277b463 --- /dev/null +++ b/default.nix @@ -0,0 +1,12 @@ +(import ( + let + lock = builtins.fromJSON (builtins.readFile ./flake.lock); + in + fetchTarball { + url = + lock.nodes.flake-compat.locked.url + or "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz"; + + sha256 = lock.nodes.flake-compat.locked.narHash; + } +) { src = ./.; }).defaultNix @@ -1,5 +1,19 @@ { "nodes": { + "flake-compat": { + "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "revCount": 57, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/edolstra/flake-compat/1.0.1/018afb31-abd1-7bff-a5e4-cff7e18efb7a/source.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz" + } + }, "nixpkgs": { "locked": { "lastModified": 1726137256, @@ -17,6 +31,7 @@ }, "root": { "inputs": { + "flake-compat": "flake-compat", "nixpkgs": "nixpkgs", "systems": "systems" } @@ -2,6 +2,7 @@ inputs = { nixpkgs.url = "github:NixOS/nixpkgs"; systems.url = "github:nix-systems/default"; + flake-compat.url = "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz"; }; outputs = |