1
0
mirror of https://github.com/kmein/niveum synced 2026-03-16 10:11:08 +01:00

chore: move toml helpers into overlay

This commit is contained in:
Kierán Meinhardt
2020-09-10 08:39:50 +02:00
parent c8bbbb6055
commit f97e7bd85e
5 changed files with 9 additions and 12 deletions

View File

@@ -95,6 +95,7 @@ in {
}
{
nixpkgs = {
overlays = [ (import <niveum/overlays/toml.nix>) ];
config = {
allowUnfree = true;
packageOverrides = pkgs: {

View File

@@ -29,9 +29,6 @@ let
};
};
myLib = import <niveum/lib> { 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 <niveum/dot/i3status-rust.nix> {
pkgs.writeTOML (import <niveum/dot/i3status-rust.nix> {
wifi-interface = networkInterfaces.wireless;
batteryBlock = batteryBlocks.default;
inherit (config.niveum) colours;

View File

@@ -1,6 +1,5 @@
{ pkgs, lib, ... }:
let
inherit (import <niveum/lib> { inherit pkgs; }) toTOML;
inherit (lib.strings) fileContents;
in {
environment.systemPackages = with pkgs; [ spotify spotify-tui playerctl ];

View File

@@ -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);
}

7
overlays/toml.nix Normal file
View File

@@ -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);
})