Compare commits

...

9 commits

12 changed files with 178 additions and 54 deletions

View file

@ -1,4 +1,4 @@
{ enabled, ... }:
{ enabled, config, ... }:
{
oizys = {
vpn = enabled;
@ -11,6 +11,7 @@
};
vbox = enabled;
backups = enabled;
hp-scanner = enabled;
languages = [
"misc"
"nim"
@ -21,6 +22,7 @@
"tex"
"zig"
];
llm = enabled;
};
services.restic.backups.gdrive = {
@ -33,5 +35,5 @@
];
};
users.users.daylin.extraGroups = [ "audio" ];
users.users.${config.oizys.user}.extraGroups = [ "audio" ];
}

View file

@ -7,13 +7,6 @@
};
services.printing = enabled;
hardware.sane = enabled // {
extraBackends = [ pkgs.hplipWithPlugin ];
};
users.users.daylin.extraGroups = [
"scanner"
"lp"
];
# https://github.com/NixOS/nixos-hardware/blob/c478b3d56969006e015e55aaece4931f3600c1b2/lenovo/thinkpad/x1/9th-gen/default.nix
# https://github.com/NixOS/nixos-hardware/blob/c478b3d56969006e015e55aaece4931f3600c1b2/common/pc/ssd/default.nix

View file

@ -10,12 +10,22 @@ let
flake = flakeFromSystem system;
pkgs = import inputs.nixpkgs {
inherit system;
overlays = map [
"lix-module"
"hyprland-contrib"
"nixpkgs-wayland"
] flake.overlay;
overlays = [
(flake.overlay "lix-module")
(flake.overlay "hyprland-contrib")
(flake.overlay "nixpkgs-wayland")
];
};
myPackages = map [
"tsm"
"hyprman"
"zls"
] flake.pkg;
hyprPackages = with (flake.pkgs "hyprland"); [
default
xdg-desktop-portal-hyprland
];
in
{
makePackages =
@ -23,24 +33,18 @@ in
{
src = ./.;
nativeBuildInputs =
[
pkgs.pixi
pkgs.swww
pkgs.nixVersions.stable
]
++ (map [
"tsm"
"hyprman"
"zls"
] flake.pkg)
++ (with flake.pkgs "hyprland"; [
default
xdg-desktop-portal-hyprland
(with pkgs; [
pixi
swww
nixVersions.stable
])
++ [
(flake.pkgs "roc").full
(flake.pkgs "zig2nix").zig.master.bin
];
]
++ myPackages
++ hyprPackages;
}
''
mkdir "$out"

View file

@ -6,13 +6,6 @@
flake,
...
}:
let
activate-snippet = ''
if [ -z "$WAYLAND_DISPLAY" ] && [ "$XDG_VTNR" = 1 ]; then
exec Hyprland
fi
'';
in
mkOizysModule config "hyprland" {
programs.hyprland = enabled;
@ -47,6 +40,9 @@ mkOizysModule config "hyprland" {
swww
catppuccin-cursors.mochaDark
# not even clear why I need to add this but ¯\_(ツ)_/¯
kdePackages.qtwayland
])
++ [ (flake.pkg "hyprman") ]
@ -59,20 +55,30 @@ mkOizysModule config "hyprland" {
#
# dunst
]);
services.getty = {
extraArgs = [ "--skip-login" ];
loginOptions = "-p -- ${config.oizys.user}";
};
environment.etc = {
"bashrc.local".text = activate-snippet;
"zshenv.local".text = activate-snippet;
};
nixpkgs.overlays = [
(flake.overlay "hyprland-contrib")
# (overlayFrom "nixpkgs-wayland")
# (overlayFrom "hyprland")
];
# using the below to autostart Hyprland
# broke my keybindings that were working before
# services.getty = {
# extraArgs = [ "--skip-login" ];
# loginOptions = "-p -- ${config.oizys.user}";
# };
#
# environment.etc =
# let
# activate-snippet = ''
# if [ -z "$WAYLAND_DISPLAY" ] && [ "$XDG_VTNR" = 1 ]; then
# exec Hyprland
# fi
# '';
# in
# {
# "bashrc.local".text = activate-snippet;
# "zshenv.local".text = activate-snippet;
# };
#
}

24
modules/llm/default.nix Normal file
View file

@ -0,0 +1,24 @@
{
pkgs,
config,
enabled,
mkOizysModule,
...
}:
let
inherit (pkgs) python3Packages;
llm-ollama = python3Packages.callPackage ./llm-plugins/llm-ollama { };
llm-claude3 = python3Packages.callPackage ./llm-plugins/llm-claude-3 { };
llm = (
pkgs.llm.withPlugins [
llm-ollama
llm-claude3
]
);
in
mkOizysModule config "llm" {
services.ollama = enabled;
environment.systemPackages = [ llm ];
}

View file

@ -0,0 +1,34 @@
{
buildPythonPackage,
fetchFromGitHub,
# build-system
setuptools,
wheel,
# deps
anthropic,
...
}:
buildPythonPackage rec {
pname = "llm-claude-3";
version = "0.4";
pyproject = true;
src = fetchFromGitHub {
owner = "simonw";
repo = "llm-claude-3";
rev = version;
hash = "sha256-5qF5BK319PNzB4XsLdYvtyq/SxBDdHJ9IoKWEnvNRp4=";
};
nativeBuildInputs = [
setuptools
wheel
];
dependencies = [ anthropic ];
dontCheckRuntimeDeps = true;
}

View file

@ -0,0 +1,33 @@
{
buildPythonPackage,
fetchPypi,
# build-system
setuptools,
# deps
ollama,
pydantic,
...
}:
buildPythonPackage rec {
pname = "llm-ollama";
version = "0.5.0";
pyproject = true;
src = fetchPypi {
inherit version;
pname = "llm_ollama";
hash = "sha256-M3FF9fAZ2rr+toKoz/rLRPZxB7LIHqmZQXJBdKR4fVk=";
};
dependencies = [
ollama
pydantic
];
build-system = [ setuptools ];
# will only be used in environment with llm installed
dontCheckRuntimeDeps = true;
}

View file

@ -12,6 +12,7 @@ let
mkOption
literalExpression
types
optionals
;
cfg = config.oizys.nix-ld;
@ -103,8 +104,7 @@ in
config =
let
libs =
defaultLibraries ++ cfg.extra-libraries ++ (if cfg.overkill.enable then overkillLibraries else [ ]);
libs = defaultLibraries ++ cfg.extra-libraries ++ (optionals cfg.overkill.enable overkillLibraries);
in
mkIf cfg.enable {
programs.nix-ld = enabled // {

View file

@ -28,6 +28,7 @@ in
gui
fonts
hp-scanner
languages
@ -37,6 +38,8 @@ in
nix-ld
restic
llm
];
options.oizys = {

View file

@ -25,6 +25,7 @@ let
kind ? "braille",
}:
"[1;3${number}m\n" + runes.${name}.${kind} + "\n";
cfg = config.oizys.rune;
in
{

View file

@ -20,7 +20,7 @@ def convert [] {
}
}
def nix [] {
def nix-file [] {
let rune = $in | convert
$"{
braille = ''
@ -34,8 +34,7 @@ ascii = ''
}
def col [] {
$in
| reduce --fold "" {|it, acc|
$in | reduce --fold "" {|it, acc|
$acc + $'<td><img src="($it.url)"></td>'
}
}
@ -45,7 +44,7 @@ def row [] { $"<tr>($in)</tr>" }
def readme [] {
let runes = $in
let dims = { rows: 2 cols: 2 }
let cells = ($runes | chunks $dims.rows | each { $in | col | row})
let cells = ($runes | chunks $dims.rows | each { col | row})
let table = [ "<table>" ...$cells "</table>" ] | str join
$"# Runes\n\n($table)\n"
@ -56,7 +55,7 @@ $runes
| save -f "README.md"
$runes
| each {|rune| $rune | nix }
| each { nix-file }
print "don't forget to run `nix fmt`!"
nix fmt

View file

@ -0,0 +1,25 @@
{
enabled,
config,
pkgs,
mkOizysModule,
...
}:
mkOizysModule config "hp-scanner" {
environment.systemPackages = [ pkgs.kdePackages.skanpage ];
hardware.sane = enabled // {
extraBackends = [ pkgs.hplipWithPlugin ];
};
services.avahi = enabled // {
nssmdns4 = true;
};
users.users.${config.oizys.user}.extraGroups = [
"scanner"
"lp"
];
}