mirror of
https://github.com/daylinmorgan/oizys.git
synced 2024-12-22 18:30:43 -06:00
Compare commits
1 commit
1c08f70d8e
...
198cc73788
Author | SHA1 | Date | |
---|---|---|---|
|
198cc73788 |
12 changed files with 64 additions and 183 deletions
20
.github/workflows/build.yml
vendored
20
.github/workflows/build.yml
vendored
|
@ -30,13 +30,6 @@ jobs:
|
|||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
# needed to access ghostty repo for now
|
||||
- name: Setup SSH
|
||||
uses: MrSquaare/ssh-setup-action@v3
|
||||
with:
|
||||
host: github.com
|
||||
private-key: ${{ secrets.SSH_PRIVATE_KEY }}
|
||||
|
||||
- uses: ./.github/actions/clean-disk
|
||||
with:
|
||||
purge-packages: 'true'
|
||||
|
@ -50,15 +43,10 @@ jobs:
|
|||
|
||||
- uses: DeterminateSystems/magic-nix-cache-action@v8
|
||||
|
||||
# - name: Install and login to attic cache
|
||||
# run: |
|
||||
# nix profile install "nixpkgs#attic-client"
|
||||
# attic login oizys https://attic.dayl.in "${{ secrets.ATTIC_TOKEN }}"
|
||||
|
||||
# - uses: cachix/cachix-action@v15
|
||||
# with:
|
||||
# name: daylin
|
||||
# authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
|
||||
- uses: cachix/cachix-action@v15
|
||||
with:
|
||||
name: daylin
|
||||
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
|
||||
|
||||
- name: write lock file
|
||||
if: "${{ inputs.lockFile != '' }}"
|
||||
|
|
8
.github/workflows/update.yml
vendored
8
.github/workflows/update.yml
vendored
|
@ -20,7 +20,6 @@ jobs:
|
|||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
# needed to access ghostty repo for now
|
||||
- name: Setup SSH
|
||||
uses: MrSquaare/ssh-setup-action@v3
|
||||
with:
|
||||
|
@ -39,6 +38,7 @@ jobs:
|
|||
experimental-features = pipe-operator
|
||||
accept-flake-config = true
|
||||
|
||||
|
||||
- name: Install and login to attic cache
|
||||
run: |
|
||||
nix profile install "nixpkgs#attic-client"
|
||||
|
@ -92,12 +92,6 @@ jobs:
|
|||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup SSH
|
||||
uses: MrSquaare/ssh-setup-action@v3
|
||||
with:
|
||||
host: github.com
|
||||
private-key: ${{ secrets.SSH_PRIVATE_KEY }}
|
||||
|
||||
- uses: DeterminateSystems/nix-installer-action@v14
|
||||
with:
|
||||
source-url: https://install.lix.systems/lix/lix-installer-x86_64-linux
|
||||
|
|
31
flake.lock
31
flake.lock
|
@ -585,36 +585,38 @@
|
|||
"lix": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1729298361,
|
||||
"narHash": "sha256-hiGtfzxFkDc9TSYsb96Whg0vnqBVV7CUxyscZNhed0U=",
|
||||
"rev": "ad9d06f7838a25beec425ff406fe68721fef73be",
|
||||
"lastModified": 1730328739,
|
||||
"narHash": "sha256-qs7u2nCwfEV93SKV1QSikOwRbHDEA1CWYZiVKI9Hhxk=",
|
||||
"rev": "beb193d1e2121cdbd51e8309572522ee9a841395",
|
||||
"type": "tarball",
|
||||
"url": "https://git.lix.systems/api/v1/repos/lix-project/lix/archive/ad9d06f7838a25beec425ff406fe68721fef73be.tar.gz?rev=ad9d06f7838a25beec425ff406fe68721fef73be"
|
||||
"url": "https://git.lix.systems/api/v1/repos/lix-project/lix/archive/beb193d1e2121cdbd51e8309572522ee9a841395.tar.gz?rev=beb193d1e2121cdbd51e8309572522ee9a841395"
|
||||
},
|
||||
"original": {
|
||||
"type": "tarball",
|
||||
"url": "https://git.lix.systems/lix-project/lix/archive/2.91.1.tar.gz"
|
||||
"url": "https://git.lix.systems/lix-project/lix/archive/main.tar.gz"
|
||||
}
|
||||
},
|
||||
"lix-module": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils_2",
|
||||
"flakey-profile": "flakey-profile",
|
||||
"lix": "lix",
|
||||
"lix": [
|
||||
"lix"
|
||||
],
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1729360442,
|
||||
"narHash": "sha256-6U0CyPycIBc04hbYy2hBINnVso58n/ZyywY2BD3hu+s=",
|
||||
"rev": "9098ac95768f7006d7e070b88bae76939f6034e6",
|
||||
"lastModified": 1727752861,
|
||||
"narHash": "sha256-jowmo2aEzrEpPSM96IWtajuogdJm7DjAWxFTEb7Ct0s=",
|
||||
"rev": "fd186f535a4ac7ae35d98c1dd5d79f0a81b7976d",
|
||||
"type": "tarball",
|
||||
"url": "https://git.lix.systems/api/v1/repos/lix-project/nixos-module/archive/9098ac95768f7006d7e070b88bae76939f6034e6.tar.gz?rev=9098ac95768f7006d7e070b88bae76939f6034e6"
|
||||
"url": "https://git.lix.systems/api/v1/repos/lix-project/nixos-module/archive/fd186f535a4ac7ae35d98c1dd5d79f0a81b7976d.tar.gz?rev=fd186f535a4ac7ae35d98c1dd5d79f0a81b7976d"
|
||||
},
|
||||
"original": {
|
||||
"type": "tarball",
|
||||
"url": "https://git.lix.systems/lix-project/nixos-module/archive/2.91.1-1.tar.gz"
|
||||
"url": "https://git.lix.systems/lix-project/nixos-module/archive/main.tar.gz"
|
||||
}
|
||||
},
|
||||
"my-nixpkgs": {
|
||||
|
@ -923,11 +925,11 @@
|
|||
},
|
||||
"nixpkgs_4": {
|
||||
"locked": {
|
||||
"lastModified": 1730531603,
|
||||
"narHash": "sha256-Dqg6si5CqIzm87sp57j5nTaeBbWhHFaVyG7V6L8k3lY=",
|
||||
"lastModified": 1729880355,
|
||||
"narHash": "sha256-RP+OQ6koQQLX5nw0NmcDrzvGL8HDLnyXt/jHhL1jwjM=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "7ffd9ae656aec493492b44d0ddfb28e79a1ea25d",
|
||||
"rev": "18536bf04cd71abd345f9579158841376fdd0c5a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -1076,6 +1078,7 @@
|
|||
"hyprland": "hyprland",
|
||||
"hyprland-contrib": "hyprland-contrib",
|
||||
"hyprman": "hyprman",
|
||||
"lix": "lix",
|
||||
"lix-module": "lix-module",
|
||||
"my-nixpkgs": "my-nixpkgs",
|
||||
"nim2nix": "nim2nix_2",
|
||||
|
|
17
flake.nix
17
flake.nix
|
@ -12,19 +12,14 @@
|
|||
nixos-wsl.url = "github:nix-community/NixOS-WSL";
|
||||
nix-index-database.url = "github:nix-community/nix-index-database";
|
||||
|
||||
# lix = {
|
||||
# url = "https://git.lix.systems/lix-project/lix/archive/main.tar.gz";
|
||||
# flake = false;
|
||||
# };
|
||||
# lix-module = {
|
||||
# url = "https://git.lix.systems/lix-project/nixos-module/archive/main.tar.gz";
|
||||
# inputs.nixpkgs.follows = "nixpkgs";
|
||||
# inputs.lix.follows = "lix";
|
||||
# };
|
||||
|
||||
lix = {
|
||||
url = "https://git.lix.systems/lix-project/lix/archive/main.tar.gz";
|
||||
flake = false;
|
||||
};
|
||||
lix-module = {
|
||||
url = "https://git.lix.systems/lix-project/nixos-module/archive/2.91.1-1.tar.gz";
|
||||
url = "https://git.lix.systems/lix-project/nixos-module/archive/main.tar.gz";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
inputs.lix.follows = "lix";
|
||||
};
|
||||
|
||||
# https://github.com/ghostty-org/ghostty/issues/2025
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
|> listify;
|
||||
}
|
||||
// (
|
||||
# llm
|
||||
''
|
||||
vpn|desktop|hyprland|chrome
|
||||
backups|hp-scanner|llm
|
||||
|
|
|
@ -2,18 +2,22 @@
|
|||
pkgs,
|
||||
config,
|
||||
mkOizysModule,
|
||||
flake,
|
||||
# enabled,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
inherit (pkgs) python3Packages;
|
||||
# llm-ollama = python3Packages.callPackage ./llm-plugins/llm-ollama { };
|
||||
llm-claude3 = python3Packages.callPackage ./llm-plugins/llm-claude-3 { };
|
||||
in
|
||||
|
||||
mkOizysModule config "llm" {
|
||||
# services.ollama = enabled;
|
||||
environment.systemPackages = with pkgs; [
|
||||
(python3.withPackages (ps:
|
||||
with (flake.pkgs "self");
|
||||
[
|
||||
llm
|
||||
llm-claude-3
|
||||
]
|
||||
))
|
||||
(python3.withPackages (ps: [
|
||||
ps.llm
|
||||
llm-claude3
|
||||
]))
|
||||
];
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
buildPythonPackage rec {
|
||||
pname = "llm-claude-3";
|
||||
version = "0.7";
|
||||
version = "0.4";
|
||||
pyproject = true;
|
||||
|
||||
src = fetchFromGitHub {
|
|
@ -1,11 +1,7 @@
|
|||
{ pkgs, ... }:
|
||||
let inherit (pkgs) python3Packages;
|
||||
in
|
||||
{
|
||||
nph = pkgs.callPackage ./nim/nph { }; # doesn't compile with 2.2.0 :/
|
||||
nimlangserver = pkgs.callPackage ./nim/nimlangserver { };
|
||||
nimble = pkgs.callPackage ./nim/nimble { };
|
||||
distrobox = pkgs.callPackage ./distrobox {};
|
||||
llm = python3Packages.callPackage ./llm {};
|
||||
llm-claude-3 = python3Packages.callPackage ./llm-plugins/llm-claude-3 {};
|
||||
}
|
||||
|
|
|
@ -1,96 +0,0 @@
|
|||
{
|
||||
lib,
|
||||
buildPythonPackage,
|
||||
fetchFromGitHub,
|
||||
pytestCheckHook,
|
||||
pythonOlder,
|
||||
setuptools,
|
||||
click-default-group,
|
||||
numpy,
|
||||
openai,
|
||||
pip,
|
||||
pluggy,
|
||||
pydantic,
|
||||
python-ulid,
|
||||
pyyaml,
|
||||
sqlite-migrate,
|
||||
cogapp,
|
||||
pytest-httpx,
|
||||
puremagic,
|
||||
sqlite-utils,
|
||||
}:
|
||||
let
|
||||
llm = buildPythonPackage rec {
|
||||
pname = "llm";
|
||||
version = "0.17.1";
|
||||
pyproject = true;
|
||||
|
||||
build-system = [ setuptools ];
|
||||
|
||||
disabled = pythonOlder "3.8";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "simonw";
|
||||
repo = "llm";
|
||||
rev = "refs/tags/${version}";
|
||||
hash = "sha256-6OO0SIIxChM5HRJoUM4CYGbsINmc3i+iyL/oahLHhrY=";
|
||||
};
|
||||
|
||||
# patches = [ ./001-disable-install-uninstall-commands.patch ];
|
||||
|
||||
dependencies = [
|
||||
click-default-group
|
||||
numpy
|
||||
openai
|
||||
pip
|
||||
pluggy
|
||||
pydantic
|
||||
python-ulid
|
||||
pyyaml
|
||||
setuptools # for pkg_resources
|
||||
sqlite-migrate
|
||||
sqlite-utils
|
||||
puremagic
|
||||
];
|
||||
|
||||
nativeCheckInputs = [
|
||||
cogapp
|
||||
numpy
|
||||
pytest-httpx
|
||||
pytestCheckHook
|
||||
];
|
||||
|
||||
doCheck = true;
|
||||
|
||||
pytestFlagsArray = [
|
||||
"-svv"
|
||||
"tests/"
|
||||
];
|
||||
|
||||
pythonImportsCheck = [ "llm" ];
|
||||
|
||||
passthru = {
|
||||
inherit withPlugins;
|
||||
};
|
||||
|
||||
meta = with lib; {
|
||||
homepage = "https://github.com/simonw/llm";
|
||||
description = "Access large language models from the command-line";
|
||||
changelog = "https://github.com/simonw/llm/releases/tag/${version}";
|
||||
license = licenses.asl20;
|
||||
mainProgram = "llm";
|
||||
maintainers = with maintainers; [
|
||||
aldoborrero
|
||||
mccartykim
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
withPlugins = throw ''
|
||||
llm.withPlugins was confusing to use and has been removed.
|
||||
Please migrate to using python3.withPackages(ps: [ ps.llm ]) instead.
|
||||
|
||||
See https://nixos.org/manual/nixpkgs/stable/#python.withpackages-function for more usage examples.
|
||||
'';
|
||||
in
|
||||
llm
|
|
@ -136,12 +136,6 @@ proc evaluateDerivations(drvs: seq[string]): Table[string, NixDerivation] =
|
|||
runCmdCaptWithSpinner(cmd, "evaluating derivations")
|
||||
fromJson(output, Table[string,NixDerivation])
|
||||
|
||||
proc nixDerivationShow(drvs: seq[string]): Table[string, NixDerivation] =
|
||||
var cmd = "nix derivation show"
|
||||
cmd.addArgs drvs
|
||||
let (output, _ ) =
|
||||
runCmdCaptWithSpinner(cmd, "evaluating " & drvs.join(" "))
|
||||
fromJson(output, Table[string, NixDerivation])
|
||||
|
||||
# TODO: replace asserts in this proc, would be easier with results type
|
||||
proc findSystemPaths(drvs: Table[string, NixDerivation]): seq[string] =
|
||||
|
@ -178,37 +172,33 @@ func isIgnored(drv: string): bool =
|
|||
if name.startswith(pkg):
|
||||
return true
|
||||
|
||||
# proc systemPathDrvsToBuild(): seq[string] =
|
||||
|
||||
type
|
||||
OizysDerivation = object
|
||||
drv: NixDerivation # do i need this ?
|
||||
output: string
|
||||
name: string
|
||||
|
||||
proc getSystemPathDrvs(): seq[string] =
|
||||
let systemDrvs = nixDerivationShow(nixosConfigAttrs())
|
||||
let systemPathDrvs = findSystemPaths(systemDrvs)
|
||||
result =
|
||||
collect:
|
||||
for k, drv in nixDerivationShow(systemPathDrvs):
|
||||
for inputDrv, _ in drv.inputDrvs:
|
||||
inputDrv
|
||||
|
||||
iterator getSystemPathDrvs(drvs: Table[string, NixDerivation]): string =
|
||||
let systemPaths = findSystemPaths(drvs)
|
||||
for p in systemPaths:
|
||||
for d in drvs[p].inputDrvs.keys():
|
||||
yield d
|
||||
|
||||
proc getOizysDerivations(): seq[OizysDerivation] =
|
||||
let
|
||||
toBuildDrvs = toBuildNixosConfiguration()
|
||||
systemPathDrvs = getSystemPathDrvs()
|
||||
toActullyBuildDrvs = systemPathDrvs.filterIt(it in toBuildDrvs)
|
||||
let toBuild = toBuildNixosConfiguration()
|
||||
let drvs = evaluateDerivations(nixosConfigAttrs())
|
||||
|
||||
for name, drv in nixDerivationShow(toActullyBuildDrvs):
|
||||
if not isIgnored(name):
|
||||
for name in getSystemPathDrvs(drvs):
|
||||
if name in toBuild and not isIgnored(name):
|
||||
let nixDrv = drvs[name]
|
||||
result.add OizysDerivation(
|
||||
name: name,
|
||||
output: drv.outputs.`out`.path,
|
||||
drv: drv,
|
||||
output: nixDrv.outputs.`out`.path,
|
||||
drv: nixDrv,
|
||||
)
|
||||
|
||||
# TODO: remove this proc
|
||||
proc systemPathDrvsToBuild(): seq[string] =
|
||||
var inputDrvs, dropped: seq[string]
|
||||
let toBuild = toBuildNixosConfiguration()
|
||||
|
@ -220,6 +210,12 @@ proc systemPathDrvsToBuild(): seq[string] =
|
|||
|
||||
(result, _) = filterSeq(inputDrvs, (s) => s in toBuild)
|
||||
(dropped, result) = filterSeq(result, isIgnored)
|
||||
echo "SOMETHING SHOULD HAPPEN HERE!"
|
||||
for drv in result:
|
||||
echo drv
|
||||
echo drvs[drv]
|
||||
|
||||
|
||||
debug fmt"ignored {dropped.len} derivations"
|
||||
result = result.mapIt(it & "^*")
|
||||
|
||||
|
@ -298,6 +294,8 @@ proc nixBuildWithCache*(name: string, rest:seq[string], service: string, jobs: i
|
|||
var cmd = "nix build"
|
||||
cmd.addArg drv.name & "^*"
|
||||
cmd.addArg "--no-link"
|
||||
# cmd.addArg "--print-out-paths"
|
||||
# cmd.addArg "-L"
|
||||
cmd.addArgs rest
|
||||
let buildCode = runCmd(cmd)
|
||||
if buildCode != 0:
|
||||
|
|
0
pkgs/oizys/src/oizys/pkgs/oizys/src/oizys/nix.nim
Normal file
0
pkgs/oizys/src/oizys/pkgs/oizys/src/oizys/nix.nim
Normal file
Loading…
Reference in a new issue