aboutsummaryrefslogtreecommitdiff
path: root/flake.nix
diff options
context:
space:
mode:
authorFuwn <[email protected]>2024-09-12 03:43:29 -0700
committerFuwn <[email protected]>2024-09-12 03:43:29 -0700
commit836627860d532e986a82e4fc62744850a19cde62 (patch)
treead702edfeda4de7ba2ae00c13e3d58965fc28fb1 /flake.nix
downloadpywal.nix-836627860d532e986a82e4fc62744850a19cde62.tar.xz
pywal.nix-836627860d532e986a82e4fc62744850a19cde62.zip
feat: initial release
Diffstat (limited to 'flake.nix')
-rw-r--r--flake.nix62
1 files changed, 62 insertions, 0 deletions
diff --git a/flake.nix b/flake.nix
new file mode 100644
index 0000000..7503151
--- /dev/null
+++ b/flake.nix
@@ -0,0 +1,62 @@
+{
+ inputs = {
+ nixpkgs.url = "github:NixOS/nixpkgs";
+ systems.url = "github:nix-systems/default";
+ };
+
+ outputs =
+ {
+ nixpkgs,
+ systems,
+ ...
+ }:
+ (nixpkgs.lib.genAttrs (import systems)) (system: {
+ homeManagerModules.default =
+ { config, ... }:
+ let
+ inherit (pkgs) lib;
+
+ pkgs = import nixpkgs { inherit system; };
+
+ colourscheme = builtins.fromJSON (
+ builtins.readFile "${
+ pkgs.runCommand "colourscheme"
+ {
+ buildInputs = with pkgs; [
+ imagemagick
+ jq
+ ];
+ }
+ ''
+ mkdir -p $out
+
+ ${pkgs.python3}/bin/python3 ${./wal.py} ${config.pywal-nix.wallpaper} ${
+ if config.pywal-nix.light then "1" else "0"
+ } | \
+ sed "s/'/\"/g" | \
+ jq 'to_entries | map({"colour\(.key)": .value}) | add' > $out/colourscheme
+ ''
+ }/colourscheme"
+ );
+ in
+ {
+ options.pywal-nix = {
+ wallpaper = lib.mkOption {
+ type = lib.types.path;
+ default = /path/to/wallpaper.png;
+ };
+
+ light = lib.mkOption {
+ type = lib.types.bool;
+ default = false;
+ };
+
+ colourscheme = lib.mkOption {
+ type = lib.types.attrsOf lib.types.str;
+ };
+ };
+
+ config.pywal-nix.colourscheme = colourscheme;
+ };
+ });
+}