purge flake demons

This commit is contained in:
atagen 2025-07-01 00:26:18 +10:00
parent 40feebba44
commit 9d46a07857
5 changed files with 142 additions and 181 deletions

View file

@ -1,51 +0,0 @@
{
pkgs,
lib,
config,
...
}: let
inherit (lib) mkIf mkEnableOption mkOption types concatStringsSep typeOf;
cfg = config.programs.culr;
in {
options.programs.culr = {
enable = mkEnableOption "culr";
pattern = mkOption {
type = with types; either str (listOf int);
default = [];
description = "colourising pattern";
};
palette = mkOption {
type = with types; listOf str;
default = [];
description = "palette to use in comma separated RGB hex eg. #0f0f0f";
};
separators = mkOption {
type = with types; str;
default = "";
description = "char list of separators to use";
};
delimiters = mkOption {
type = with types; str;
default = "";
description = "char list of delimiters to use";
};
};
config = mkIf cfg.enable {
environment.systemPackages = let inherit (pkgs) culr; in [culr];
environment.sessionVariables = {
CULR_ORDER = let
serialise = {
list = list: concatStringsSep ";" (map (i: builtins.toString i) list);
string = s: s;
};
in
mkIf (cfg.pattern != "" && cfg.pattern != [])
(serialise.${typeOf cfg.pattern}
cfg.pattern);
CULR_PALETTE = mkIf (cfg.palette != []) (concatStringsSep ";" cfg.palette);
CULR_SEP = mkIf (cfg.separators != "") (cfg.separators);
CULR_DELIM = mkIf (cfg.delimiters != "") (cfg.delimiters);
};
};
}

View file

@ -2,34 +2,35 @@
pkgs,
lib,
ocaml-deps,
ocamlPackages,
buildDunePackage,
version,
debug ? false,
doCheck ? false,
...
}:
ocamlPackages.buildDunePackage {
buildDunePackage {
pname = "culr";
version = "0.1-vivid-${version}";
minimalOCamlVersion = "5.2";
src = ./..;
nativeBuildInputs = [pkgs.git];
nativeBuildInputs = [ pkgs.git ];
buildInputs = ocaml-deps;
buildPhase =
if debug
then ''
runHook preBuild
dune build -p culr --profile debug ''${enableParallelBuilding:+-j $NIX_BUILD_CORES}
runHook postBuild
''
else ''
runHook preBuild
dune build -p culr --profile release ''${enableParallelBuilding:+-j $NIX_BUILD_CORES}
runHook postBuild
'';
if debug then
''
runHook preBuild
dune build -p culr --profile debug ''${enableParallelBuilding:+-j $NIX_BUILD_CORES}
runHook postBuild
''
else
''
runHook preBuild
dune build -p culr --profile release ''${enableParallelBuilding:+-j $NIX_BUILD_CORES}
runHook postBuild
'';
checkPhase = ''
dune runtest

View file

@ -1,4 +1,60 @@
{overlays}: {
nixpkgs.overlays = overlays;
imports = [./culr-module.nix];
{
lib,
config,
...
}:
let
inherit (lib)
mkIf
mkEnableOption
mkPackageOption
mkOption
types
concatStringsSep
typeOf
;
cfg = config.programs.culr;
in
{
options.programs.culr = {
enable = mkEnableOption "culr";
package = mkPackageOption { } "" { };
pattern = mkOption {
type = with types; either str (listOf int);
default = [ ];
description = "colourising pattern";
};
palette = mkOption {
type = with types; listOf str;
default = [ ];
description = "palette to use in comma separated RGB hex eg. #0f0f0f";
};
separators = mkOption {
type = with types; str;
default = "";
description = "char list of separators to use";
};
delimiters = mkOption {
type = with types; str;
default = "";
description = "char list of delimiters to use";
};
};
config = mkIf cfg.enable {
environment.systemPackages = [ cfg.package ];
environment.sessionVariables = {
CULR_ORDER =
let
serialise = {
list = list: concatStringsSep ";" (map (i: builtins.toString i) list);
string = s: s;
};
in
mkIf (cfg.pattern != "" && cfg.pattern != [ ]) (serialise.${typeOf cfg.pattern} cfg.pattern);
CULR_PALETTE = mkIf (cfg.palette != [ ]) (concatStringsSep ";" cfg.palette);
CULR_SEP = mkIf (cfg.separators != "") (cfg.separators);
CULR_DELIM = mkIf (cfg.delimiters != "") (cfg.delimiters);
};
};
}