mirror of
https://github.com/kmein/niveum
synced 2026-03-16 10:11:08 +01:00
modularize colorscheming and more
This commit is contained in:
@@ -1,39 +1,95 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
with lib;
|
||||
with import <dot/theme.nix>;
|
||||
let
|
||||
stringOption = mkOption { type = types.string; };
|
||||
themeOption = mkOption {
|
||||
type = types.submodule {
|
||||
options = {
|
||||
name = mkOption { type = types.string; };
|
||||
package = mkOption { type = types.package; };
|
||||
};
|
||||
colourScheme = config.niveum.colours;
|
||||
|
||||
my-types.hexColour = types.strMatching "#[0-9A-Fa-f]{6}";
|
||||
my-types.colourPair = types.submodule {
|
||||
options = {
|
||||
dark = mkOption { type = my-types.hexColour; };
|
||||
bright = mkOption { type = my-types.hexColour; };
|
||||
};
|
||||
};
|
||||
my-types.theme = types.submodule {
|
||||
options = {
|
||||
name = mkOption { type = types.str; };
|
||||
package = mkOption { type = types.package; };
|
||||
};
|
||||
};
|
||||
my-types.font = types.submodule {
|
||||
options = {
|
||||
name = mkOption { type = types.str; };
|
||||
size = mkOption { type = types.ints.positive; };
|
||||
};
|
||||
};
|
||||
|
||||
my-types.colourTheme = types.submodule {
|
||||
options = {
|
||||
black = mkOption { type = my-types.colourPair; };
|
||||
red = mkOption { type = my-types.colourPair; };
|
||||
green = mkOption { type = my-types.colourPair; };
|
||||
yellow = mkOption { type = my-types.colourPair; };
|
||||
blue = mkOption { type = my-types.colourPair; };
|
||||
magenta = mkOption { type = my-types.colourPair; };
|
||||
cyan = mkOption { type = my-types.colourPair; };
|
||||
white = mkOption { type = my-types.colourPair; };
|
||||
background = mkOption { type = my-types.hexColour; };
|
||||
foreground = mkOption { type = my-types.hexColour; };
|
||||
cursor = mkOption { type = my-types.hexColour; };
|
||||
};
|
||||
};
|
||||
in {
|
||||
options.niveum = {
|
||||
applications = {
|
||||
terminal = stringOption;
|
||||
browser = stringOption;
|
||||
fileManager = stringOption;
|
||||
terminal = mkOption { type = types.str; };
|
||||
browser = mkOption { type = types.str; };
|
||||
fileManager = mkOption { type = types.str; };
|
||||
};
|
||||
|
||||
colours = mkOption { type = my-types.colourTheme; };
|
||||
|
||||
colourPalette = mkOption {
|
||||
type = types.listOf my-types.hexColour;
|
||||
default = with config.niveum.colours; [
|
||||
black.dark
|
||||
red.dark
|
||||
green.dark
|
||||
yellow.dark
|
||||
blue.dark
|
||||
magenta.dark
|
||||
cyan.dark
|
||||
white.dark
|
||||
black.bright
|
||||
red.bright
|
||||
green.bright
|
||||
yellow.bright
|
||||
blue.bright
|
||||
magenta.bright
|
||||
cyan.bright
|
||||
white.bright
|
||||
];
|
||||
};
|
||||
|
||||
fonts = {
|
||||
terminal = mkOption { type = my-types.font; };
|
||||
ui = mkOption { type = my-types.font; };
|
||||
};
|
||||
|
||||
user = {
|
||||
github = stringOption;
|
||||
name = stringOption;
|
||||
email = stringOption;
|
||||
github = mkOption { type = types.str; };
|
||||
name = mkOption { type = types.str; };
|
||||
email = mkOption { type = types.strMatching ".+@.+\\..+"; };
|
||||
};
|
||||
|
||||
ignore = mkOption {
|
||||
type = types.listOf types.string;
|
||||
type = types.listOf types.str;
|
||||
default = [ "*~" ".stack-work/" "__pycache__/" ".mypy_cache/" "*.py[co]" "*.o" "*.hi" "*.aux" "*.bbl" "*.bcf" "*.blg" "*.fdb_latexmk" "*.fls" "*.out" "*.run.xml" "*.toc" "*.bbl" "*.class" "*.dyn_hi" "*.dyn_o" "dist/" ];
|
||||
};
|
||||
|
||||
theme = {
|
||||
gtk = themeOption;
|
||||
icon = themeOption;
|
||||
cursor = themeOption;
|
||||
gtk = mkOption { type = my-types.theme; };
|
||||
icon = mkOption { type = my-types.theme; };
|
||||
cursor = mkOption { type = my-types.theme; };
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
44
modules/hledger.nix
Normal file
44
modules/hledger.nix
Normal file
@@ -0,0 +1,44 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.niveum.hledger;
|
||||
in {
|
||||
options.niveum.hledger = {
|
||||
enable = mkEnableOption "hledger";
|
||||
server = {
|
||||
enable = mkEnableOption "hledger server";
|
||||
port = mkOption { type = pkgs.unstable.lib.types.port; default = 5000; };
|
||||
host = mkOption { type = types.str; default = "127.0.0.1"; };
|
||||
capabilities = mkOption {
|
||||
type = types.listOf (types.enum ["view" "add" "manage"]);
|
||||
default = [ "view" "add" ];
|
||||
};
|
||||
flags = mkOption { type = types.listOf types.str; default = []; };
|
||||
user = mkOption { type = types.attrs; };
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
environment.systemPackages = [ pkgs.unstable.hledger ];
|
||||
|
||||
systemd.services.hledger-web = mkIf cfg.server.enable {
|
||||
description = "hledger server";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
|
||||
serviceConfig = {
|
||||
Restart = "always";
|
||||
ExecStart = ''
|
||||
${pkgs.unstable.hledger-web}/bin/hledger-web \
|
||||
--port=${toString cfg.server.port} \
|
||||
--host=${cfg.server.host} \
|
||||
--capabilities=${concatStringsSep "," cfg.server.capabilities} \
|
||||
${concatStringsSep " " cfg.server.flags}
|
||||
'';
|
||||
User = cfg.server.user.name;
|
||||
PrivateTemp = true;
|
||||
RuntimeDirectory = "hledger-web";
|
||||
WorkingDirectory = "%t/hledger-web";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user