From f97e7bd85e665cc8297bc388b47659bc68f021a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kier=C3=A1n=20Meinhardt?= Date: Thu, 10 Sep 2020 08:39:50 +0200 Subject: [PATCH] chore: move toml helpers into overlay --- configs/default.nix | 1 + configs/i3.nix | 5 +---- configs/spotify.nix | 1 - lib/default.nix | 7 ------- overlays/toml.nix | 7 +++++++ 5 files changed, 9 insertions(+), 12 deletions(-) delete mode 100644 lib/default.nix create mode 100644 overlays/toml.nix diff --git a/configs/default.nix b/configs/default.nix index 486f1a9..702951c 100644 --- a/configs/default.nix +++ b/configs/default.nix @@ -95,6 +95,7 @@ in { } { nixpkgs = { + overlays = [ (import ) ]; config = { allowUnfree = true; packageOverrides = pkgs: { diff --git a/configs/i3.nix b/configs/i3.nix index 37e8f7d..7f2e313 100644 --- a/configs/i3.nix +++ b/configs/i3.nix @@ -29,9 +29,6 @@ let }; }; - myLib = import { inherit pkgs; }; - inherit (myLib) writeTOML; - new-workspace = pkgs.unstable.writers.writeDash "new-workspace" '' i3-msg workspace $(($(i3-msg -t get_workspaces | tr , '\n' | grep '"num":' | cut -d : -f 2 | sort -rn | head -1) + 1)) ''; @@ -150,7 +147,7 @@ in with config.niveum; { }; }; statusCommand = "${pkgs.unstable.i3status-rust}/bin/i3status-rs ${ - writeTOML (import { + pkgs.writeTOML (import { wifi-interface = networkInterfaces.wireless; batteryBlock = batteryBlocks.default; inherit (config.niveum) colours; diff --git a/configs/spotify.nix b/configs/spotify.nix index e570329..1f55fb5 100644 --- a/configs/spotify.nix +++ b/configs/spotify.nix @@ -1,6 +1,5 @@ { pkgs, lib, ... }: let - inherit (import { inherit pkgs; }) toTOML; inherit (lib.strings) fileContents; in { environment.systemPackages = with pkgs; [ spotify spotify-tui playerctl ]; diff --git a/lib/default.nix b/lib/default.nix deleted file mode 100644 index fb3435b..0000000 --- a/lib/default.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ pkgs, ... }: rec { - writeTOML = object: - pkgs.runCommand "generated.toml" { } '' - echo '${builtins.toJSON object}' | ${pkgs.remarshal}/bin/json2toml > $out - ''; - toTOML = object: builtins.readFile (writeTOML object); -} diff --git a/overlays/toml.nix b/overlays/toml.nix new file mode 100644 index 0000000..6f98b3c --- /dev/null +++ b/overlays/toml.nix @@ -0,0 +1,7 @@ +(self: super: { + writeTOML = object: super.runCommand "writeTOML" {} '' + echo '${builtins.toJSON object}' | ${super.remarshal}/bin/json2toml > $out + ''; + toTOML = object: builtins.readFile (self.writeTOML object); + writeJSON = path: object: super.writeText path (builtins.toJSON object); +})