parent
14081936af
commit
fe7b03dd4a
19 changed files with 39 additions and 37 deletions
common
default.nix
home
pkgs
|
@ -13,7 +13,6 @@
|
|||
./vars
|
||||
|
||||
./modules
|
||||
./pkgs
|
||||
|
||||
nur.nixosModules.nur
|
||||
home-manager.nixosModules.home-manager
|
||||
|
@ -100,7 +99,6 @@
|
|||
|
||||
./home
|
||||
./home/trash-d
|
||||
./pkgs
|
||||
];
|
||||
|
||||
home.packages =
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
self,
|
||||
...
|
||||
}: {
|
||||
home.packages =
|
||||
(with config.customPkgs; [
|
||||
(with self.packages.${pkgs.system}; [
|
||||
pokemon-colorscripts
|
||||
repl
|
||||
])
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,45 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
"""
|
||||
The original script:
|
||||
https://github.com/dharmx/vile/blob/7d486c128c7e553912673755f97b118aaab0193d/src/shell/playerctl.py#L2
|
||||
"""
|
||||
|
||||
import argparse
|
||||
import json
|
||||
from material_color_utilities_python import themeFromImage, hexFromArgb, Image
|
||||
|
||||
def range_type(value_string):
|
||||
value = int(value_string)
|
||||
if value not in range(0, 101):
|
||||
raise argparse.ArgumentTypeError("%s is out of range, choose in [0-100]" % value)
|
||||
return value
|
||||
|
||||
parser = argparse.ArgumentParser(
|
||||
prog='coloryou',
|
||||
description='This program extract Material You colors from an image. It returns them as a JSON object for scripting.')
|
||||
|
||||
parser.add_argument("image_path", help="A full path to your image", type=str)
|
||||
parser.add_argument('-i', '--image', dest='image', default=40, type=range_type, metavar='i', choices=range(0,101), help="Value should be within [0, 100] (default: %(default)s). Set the tone for the main image accent.")
|
||||
|
||||
parser.add_argument('-b', '--button', dest='button', default=90, type=range_type, metavar='i', choices=range(0,101), help="Value should be within [0, 100] (default: %(default)s). Set the tone for the button accent.")
|
||||
|
||||
parser.add_argument('-t', '--text', dest='text', default=10, type=range_type, metavar='i', choices=range(0,101), help="Value should be within [0, 100] (default: %(default)s). Set the tone for the button text accent.")
|
||||
|
||||
parser.add_argument('-o', '--hover', dest='hover', default=80, type=range_type, metavar='i', choices=range(0,101), help="Value should be within [0, 100] (default: %(default)s). Set the tone for the hovering effect accent.")
|
||||
args = parser.parse_args()
|
||||
|
||||
|
||||
img = Image.open(args.image_path)
|
||||
basewidth = 64
|
||||
wpercent = (basewidth/float(img.size[0]))
|
||||
hsize = int((float(img.size[1])*float(wpercent)))
|
||||
img = img.resize((basewidth,hsize),Image.Resampling.LANCZOS)
|
||||
|
||||
theme = themeFromImage(img).get("palettes").get("primary")
|
||||
parsed_colors = {"imageAccent": hexFromArgb(theme.tone(args.image)),
|
||||
"buttonAccent": hexFromArgb(theme.tone(args.button)),
|
||||
"buttonText": hexFromArgb(theme.tone(args.text)),
|
||||
"hoverAccent": hexFromArgb(theme.tone(args.hover))}
|
||||
|
||||
print(json.dumps(parsed_colors))
|
|
@ -1,19 +0,0 @@
|
|||
{python3Packages, ...}:
|
||||
python3Packages.buildPythonPackage {
|
||||
pname = "coloryou";
|
||||
version = "0.0.1";
|
||||
|
||||
src = ./.;
|
||||
|
||||
propagatedBuildInputs = with python3Packages; [utils material-color-utilities];
|
||||
|
||||
postInstall = ''
|
||||
mv -v $out/bin/coloryou.py $out/bin/coloryou
|
||||
'';
|
||||
|
||||
meta = {
|
||||
description = ''
|
||||
Get Material You colors from an image.
|
||||
'';
|
||||
};
|
||||
}
|
|
@ -1,2 +0,0 @@
|
|||
material-color-utilities
|
||||
utils
|
|
@ -1,7 +0,0 @@
|
|||
from distutils.core import setup
|
||||
|
||||
setup(
|
||||
name='coloryou',
|
||||
version='0.0.1',
|
||||
scripts=['coloryou.py',],
|
||||
)
|
|
@ -1,7 +0,0 @@
|
|||
with import <nixpkgs> {};
|
||||
with pkgs.python311Packages;
|
||||
buildPythonPackage {
|
||||
name = "coloryou";
|
||||
src = ./.;
|
||||
propagatedBuildInputs = [material-color-utilities utils];
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
{
|
||||
buildGoModule,
|
||||
curseforge-server-downloader-src,
|
||||
...
|
||||
}:
|
||||
buildGoModule {
|
||||
pname = "curseforge-server-downloader";
|
||||
version = "unstable";
|
||||
|
||||
src = curseforge-server-downloader-src;
|
||||
doCheck = false;
|
||||
vendorHash = null;
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
{
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
} @ inputs: let
|
||||
inherit (lib) concatMapAttrs filterAttrs mkOption pathExists types;
|
||||
|
||||
mkPackage = name: v: {
|
||||
${name} = pkgs.callPackage ./${name} inputs;
|
||||
};
|
||||
|
||||
rmNotPackage = name: value:
|
||||
value
|
||||
== "directory"
|
||||
&& pathExists ./${name}/default.nix;
|
||||
|
||||
packages = filterAttrs rmNotPackage (builtins.readDir ./.);
|
||||
|
||||
pkgSet = concatMapAttrs mkPackage packages;
|
||||
in {
|
||||
options.customPkgs = mkOption {
|
||||
type = types.attrs;
|
||||
};
|
||||
|
||||
config.customPkgs = pkgSet;
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
{
|
||||
stdenv,
|
||||
meson,
|
||||
ninja,
|
||||
pkg-config,
|
||||
glib,
|
||||
libfprint,
|
||||
polkit,
|
||||
dbus,
|
||||
systemd,
|
||||
pam,
|
||||
libpam-wrapper,
|
||||
pam-fprint-grosshack-src,
|
||||
...
|
||||
}:
|
||||
stdenv.mkDerivation {
|
||||
name = "pam-fprint-grosshack";
|
||||
version = pam-fprint-grosshack-src.shortRev;
|
||||
|
||||
src = pam-fprint-grosshack-src;
|
||||
|
||||
nativeBuildInputs = [
|
||||
meson
|
||||
ninja
|
||||
pkg-config
|
||||
glib
|
||||
libfprint
|
||||
polkit
|
||||
dbus
|
||||
systemd
|
||||
pam
|
||||
libpam-wrapper
|
||||
];
|
||||
|
||||
mesonFlags = [
|
||||
"-Dpam_modules_dir=${placeholder "out"}/lib/security"
|
||||
"-Dsysconfdir=${placeholder "out"}/etc"
|
||||
"-Ddbus_service_dir=${placeholder "out"}/share/dbus-1/system-services"
|
||||
"-Dsystemd_system_unit_dir=${placeholder "out"}/lib/systemd/system"
|
||||
];
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
{
|
||||
stdenv,
|
||||
python3Packages,
|
||||
pokemon-colorscripts-src,
|
||||
...
|
||||
}:
|
||||
stdenv.mkDerivation {
|
||||
name = "pokemon-colorscripts";
|
||||
version = pokemon-colorscripts-src.shortRev;
|
||||
|
||||
src = pokemon-colorscripts-src;
|
||||
|
||||
propagatedBuildInputs = with python3Packages; [
|
||||
python
|
||||
];
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/pokemon-colorscripts $out/bin
|
||||
|
||||
cp -rf colorscripts $out/pokemon-colorscripts
|
||||
cp pokemon.json $out/pokemon-colorscripts
|
||||
|
||||
cp pokemon-colorscripts.py $out/pokemon-colorscripts
|
||||
|
||||
ln -s $out/pokemon-colorscripts/pokemon-colorscripts.py $out/bin/pokemon-colorscripts
|
||||
'';
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
# modified from https://github.com/gytis-ivaskevicius/flake-utils/plus
|
||||
{
|
||||
coreutils,
|
||||
gnused,
|
||||
writeShellScriptBin,
|
||||
...
|
||||
}: let
|
||||
repl = ./repl.nix;
|
||||
example = command: desc: ''\n\u001b[33m ${command}\u001b[0m - ${desc}'';
|
||||
in
|
||||
writeShellScriptBin "repl" ''
|
||||
case "$1" in
|
||||
"-h"|"--help"|"help")
|
||||
printf "%b\n\e[4mUsage\e[0m: \
|
||||
${example "repl" "Loads system flake if available."} \
|
||||
${example "repl /path/to/flake.nix" "Loads specified flake."}\n"
|
||||
;;
|
||||
*)
|
||||
if [ -z "$1" ]; then
|
||||
nix repl --arg flakePath $(${coreutils}/bin/readlink -f "/etc/nixos") --file ${repl}
|
||||
else
|
||||
nix repl --arg flakePath $(${coreutils}/bin/readlink -f $1 | ${gnused}/bin/sed 's|/flake.nix||') --file ${repl}
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
''
|
|
@ -1,49 +0,0 @@
|
|||
{
|
||||
flakePath ? null,
|
||||
hostnamePath ? "/etc/hostname",
|
||||
registryPath ? /etc/nix/registry.json,
|
||||
}: let
|
||||
inherit (builtins) getFlake head match currentSystem readFile pathExists filter fromJSON;
|
||||
|
||||
selfFlake =
|
||||
if pathExists registryPath
|
||||
then filter (it: it.from.id == "self") (fromJSON (readFile registryPath)).flakes
|
||||
else [];
|
||||
|
||||
flakePath' =
|
||||
toString
|
||||
(
|
||||
if flakePath != null
|
||||
then flakePath
|
||||
else if selfFlake != []
|
||||
then (head selfFlake).to.path
|
||||
else "/etc/nixos"
|
||||
);
|
||||
|
||||
flake =
|
||||
if pathExists flakePath'
|
||||
then getFlake flakePath'
|
||||
else {};
|
||||
hostname =
|
||||
if pathExists hostnamePath
|
||||
then head (match "([a-zA-Z0-9\\-]+)\n" (readFile hostnamePath))
|
||||
else "";
|
||||
|
||||
nixpkgsFromInputsPath = flake.inputs.nixpkgs.outPath or "";
|
||||
nixpkgs =
|
||||
flake.pkgs.${currentSystem}.nixpkgs
|
||||
or (
|
||||
if nixpkgsFromInputsPath != ""
|
||||
then import nixpkgsFromInputsPath {}
|
||||
else {}
|
||||
);
|
||||
|
||||
nixpkgsOutput = removeAttrs (nixpkgs // nixpkgs.lib or {}) ["options" "config"];
|
||||
in
|
||||
{inherit flake;}
|
||||
// flake
|
||||
// builtins
|
||||
// (flake.nixosConfigurations or {})
|
||||
// flake.nixosConfigurations.${hostname} or {}
|
||||
// nixpkgsOutput
|
||||
// {getFlake = path: getFlake (toString path);}
|
Loading…
Add table
Add a link
Reference in a new issue