Compare commits
6 Commits
596081838e
...
6a804dded9
Author | SHA1 | Date | |
---|---|---|---|
|
6a804dded9 | ||
|
639a43c7d4 | ||
|
4058d5aa2f | ||
|
b3368553a2 | ||
|
c930ef6328 | ||
|
fd2de0ec29 |
2
.gitignore
vendored
2
.gitignore
vendored
@ -3,3 +3,5 @@ result/
|
|||||||
|
|
||||||
.aider*
|
.aider*
|
||||||
.env
|
.env
|
||||||
|
|
||||||
|
**/.claude/settings.local.json
|
||||||
|
100
flake.nix
100
flake.nix
@ -35,88 +35,22 @@
|
|||||||
sysLinuxAarch = "aarch64-linux";
|
sysLinuxAarch = "aarch64-linux";
|
||||||
forAllSystems = nixpkgs.lib.genAttrs [ sysLinuxX64 sysLinuxAarch sysDarwin ];
|
forAllSystems = nixpkgs.lib.genAttrs [ sysLinuxX64 sysLinuxAarch sysDarwin ];
|
||||||
|
|
||||||
wrapPkgsSystem = { system, cudaSupport ? false }:
|
mkSystem = (import ./lib/systems.nix {
|
||||||
let
|
inherit nixpkgs;
|
||||||
config = {
|
inputs = {
|
||||||
inherit cudaSupport;
|
inherit nixos-unstable nixpkgs-master local-unstable
|
||||||
|
agenix-flake pepeflake langtool-ngrams
|
||||||
allowUnfree = true;
|
nvidia-patch home-manager;
|
||||||
};
|
|
||||||
|
|
||||||
cachixOverlay = final: prev: {
|
|
||||||
nixosModules = (prev.nixosModules or { }) // {
|
|
||||||
cachixConfig = import ./cachix.nix;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
extOverlays = [
|
|
||||||
(nvidia-patch.overlays.default)
|
|
||||||
cachixOverlay
|
|
||||||
];
|
|
||||||
|
|
||||||
importNixpkgs = { flake }:
|
|
||||||
import flake {
|
|
||||||
inherit system config;
|
|
||||||
|
|
||||||
overlays = extOverlays;
|
|
||||||
};
|
|
||||||
|
|
||||||
unstablePkgs = importNixpkgs { flake = nixos-unstable; };
|
|
||||||
masterPkgs = importNixpkgs { flake = nixpkgs-master; };
|
|
||||||
localPkgs = importNixpkgs { flake = local-unstable; };
|
|
||||||
agenixPkgs = importNixpkgs { flake = agenix-flake; };
|
|
||||||
pepePkgs = pepeflake.packages.${system} // pepeflake.legacyPackages.${system} or { };
|
|
||||||
langtoolPkgs = langtool-ngrams.packages.${system} // langtool-ngrams.legacyPackages.${system} or { };
|
|
||||||
|
|
||||||
additionalOverlays = [
|
|
||||||
(final: prev: { inherit unstablePkgs; })
|
|
||||||
(final: prev: { inherit localPkgs; })
|
|
||||||
(final: prev: { inherit agenixPkgs; })
|
|
||||||
(final: prev: { inherit masterPkgs; })
|
|
||||||
(final: prev: { inherit pepePkgs; })
|
|
||||||
(final: prev: { inherit langtoolPkgs; })
|
|
||||||
];
|
|
||||||
in
|
|
||||||
import nixpkgs {
|
|
||||||
inherit system config;
|
|
||||||
overlays = additionalOverlays ++ extOverlays ++ [
|
|
||||||
(final: prev: {
|
|
||||||
ctranslate2 = prev.ctranslate2.override {
|
|
||||||
withCUDA = true;
|
|
||||||
withCuDNN = true;
|
|
||||||
};
|
|
||||||
})
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
|
}).mkSystem;
|
||||||
|
|
||||||
wrapUtils = { pkgs }:
|
linuxX64Cuda = mkSystem { system = sysLinuxX64; cudaSupport = true; };
|
||||||
let
|
linuxAarch = mkSystem { system = sysLinuxAarch; };
|
||||||
inherit (pkgs.lib) makeScope;
|
darwin = mkSystem { system = sysDarwin; };
|
||||||
inherit (pkgs) newScope;
|
|
||||||
in
|
|
||||||
makeScope newScope (self: rec {
|
|
||||||
inherit nixpkgs home-manager nixos-unstable;
|
|
||||||
inherit (self.callPackage ./lib/utils.nix { }) mkSysRole mkHomeRole;
|
|
||||||
inherit (user) mkUser;
|
|
||||||
|
|
||||||
user = self.callPackage ./lib/user.nix { };
|
|
||||||
host = self.callPackage ./lib/host.nix { };
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
pkgsLinuxX64Cuda = wrapPkgsSystem { system = sysLinuxX64; cudaSupport = true; };
|
|
||||||
utilsLinuxX64Cuda = wrapUtils { pkgs = pkgsLinuxX64Cuda; };
|
|
||||||
|
|
||||||
pkgsLinuxAarch = wrapPkgsSystem { system = sysLinuxAarch; };
|
|
||||||
utilsLinuxAarch = wrapUtils { pkgs = pkgsLinuxAarch; };
|
|
||||||
|
|
||||||
pkgsDarwin = wrapPkgsSystem { system = sysDarwin; };
|
|
||||||
utilsDarwin = wrapUtils { pkgs = pkgsDarwin; };
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
nixosConfigurations = {
|
nixosConfigurations = {
|
||||||
architect = utilsLinuxX64Cuda.host.mkHost {
|
architect = linuxX64Cuda.utils.host.mkHost {
|
||||||
name = "architect";
|
name = "architect";
|
||||||
users = [{
|
users = [{
|
||||||
user = "giulio";
|
user = "giulio";
|
||||||
@ -129,27 +63,27 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
homeConfigurations = {
|
homeConfigurations = {
|
||||||
giulioMac = utilsDarwin.user.mkHMUser {
|
giulioMac = darwin.utils.user.mkHMUser {
|
||||||
name = "giulio";
|
name = "giulio";
|
||||||
roles = [ "ssh" ];
|
roles = [ "ssh" ];
|
||||||
};
|
};
|
||||||
gdepasqualeMac = utilsDarwin.user.mkHMUser {
|
gdepasqualeMac = darwin.utils.user.mkHMUser {
|
||||||
name = "gdepasquale";
|
name = "gdepasquale";
|
||||||
roles = [ "ssh" ];
|
roles = [ "ssh" ];
|
||||||
};
|
};
|
||||||
giulioAarch = utilsLinuxAarch.user.mkHMUser {
|
giulioAarch = linuxAarch.utils.user.mkHMUser {
|
||||||
name = "giulio";
|
name = "giulio";
|
||||||
roles = [ "ssh" ];
|
roles = [ "ssh" ];
|
||||||
};
|
};
|
||||||
giulioX64 = utilsLinuxX64Cuda.user.mkHMUser {
|
giulioX64 = linuxX64Cuda.utils.user.mkHMUser {
|
||||||
name = "giulio";
|
name = "giulio";
|
||||||
roles = [ "ssh" "go" ];
|
roles = [ "ssh" "go" ];
|
||||||
};
|
};
|
||||||
giulioX64NoSSH = utilsLinuxX64Cuda.user.mkHMUser {
|
giulioX64NoSSH = linuxX64Cuda.utils.user.mkHMUser {
|
||||||
name = "giulio";
|
name = "giulio";
|
||||||
roles = [ "go" ];
|
roles = [ "go" ];
|
||||||
};
|
};
|
||||||
gdepasqualeX64 = utilsLinuxX64Cuda.user.mkHMUser {
|
gdepasqualeX64 = linuxX64Cuda.utils.user.mkHMUser {
|
||||||
name = "gdepasquale";
|
name = "gdepasquale";
|
||||||
roles = [ "ssh" "go" ];
|
roles = [ "ssh" "go" ];
|
||||||
};
|
};
|
||||||
|
72
lib/systems.nix
Normal file
72
lib/systems.nix
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
{ nixpkgs, inputs }:
|
||||||
|
|
||||||
|
let
|
||||||
|
mkSystem = { system, cudaSupport ? false }:
|
||||||
|
let
|
||||||
|
config = {
|
||||||
|
inherit cudaSupport;
|
||||||
|
allowUnfree = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
cachixOverlay = final: prev: {
|
||||||
|
nixosModules = (prev.nixosModules or { }) // {
|
||||||
|
cachixConfig = import ../cachix.nix;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
extOverlays = [
|
||||||
|
(inputs.nvidia-patch.overlays.default)
|
||||||
|
cachixOverlay
|
||||||
|
];
|
||||||
|
|
||||||
|
importNixpkgs = { flake }:
|
||||||
|
import flake {
|
||||||
|
inherit system config;
|
||||||
|
overlays = extOverlays;
|
||||||
|
};
|
||||||
|
|
||||||
|
unstablePkgs = importNixpkgs { flake = inputs.nixos-unstable; };
|
||||||
|
masterPkgs = importNixpkgs { flake = inputs.nixpkgs-master; };
|
||||||
|
localPkgs = importNixpkgs { flake = inputs.local-unstable; };
|
||||||
|
agenixPkgs = importNixpkgs { flake = inputs.agenix-flake; };
|
||||||
|
pepePkgs = inputs.pepeflake.packages.${system} // inputs.pepeflake.legacyPackages.${system} or { };
|
||||||
|
langtoolPkgs = inputs.langtool-ngrams.packages.${system} // inputs.langtool-ngrams.legacyPackages.${system} or { };
|
||||||
|
|
||||||
|
additionalOverlays = [
|
||||||
|
(final: prev: { inherit unstablePkgs; })
|
||||||
|
(final: prev: { inherit localPkgs; })
|
||||||
|
(final: prev: { inherit agenixPkgs; })
|
||||||
|
(final: prev: { inherit masterPkgs; })
|
||||||
|
(final: prev: { inherit pepePkgs; })
|
||||||
|
(final: prev: { inherit langtoolPkgs; })
|
||||||
|
];
|
||||||
|
|
||||||
|
pkgs = import nixpkgs {
|
||||||
|
inherit system config;
|
||||||
|
overlays = additionalOverlays ++ extOverlays ++ [
|
||||||
|
(final: prev: {
|
||||||
|
ctranslate2 = prev.ctranslate2.override {
|
||||||
|
withCUDA = cudaSupport;
|
||||||
|
withCuDNN = cudaSupport;
|
||||||
|
};
|
||||||
|
})
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
utils =
|
||||||
|
let
|
||||||
|
inherit (pkgs.lib) makeScope;
|
||||||
|
inherit (pkgs) newScope;
|
||||||
|
in
|
||||||
|
makeScope newScope (self: rec {
|
||||||
|
inherit nixpkgs inputs;
|
||||||
|
inherit (self.callPackage ../lib/utils.nix { }) mkSysRole mkHomeRole;
|
||||||
|
inherit (user) mkUser;
|
||||||
|
|
||||||
|
user = self.callPackage ../lib/user.nix { home-manager = inputs.home-manager; };
|
||||||
|
host = self.callPackage ../lib/host.nix { home-manager = inputs.home-manager; };
|
||||||
|
});
|
||||||
|
in
|
||||||
|
{ inherit pkgs utils; };
|
||||||
|
in
|
||||||
|
{ inherit mkSystem; }
|
23
lib/user.nix
23
lib/user.nix
@ -5,10 +5,18 @@
|
|||||||
, ...
|
, ...
|
||||||
}:
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
# Default roles that all NixOS users get
|
||||||
|
defaultSystemUserRoles = [ "common" "zsh" "aichat" ];
|
||||||
|
|
||||||
|
# Default roles for standalone home-manager configs
|
||||||
|
defaultHMUserRoles = [ "common" "aichat" ];
|
||||||
|
in
|
||||||
{
|
{
|
||||||
mkUser = { name, roles ? [ ] }:
|
mkUser = { name, roles ? [ ], defaultRoles ? defaultSystemUserRoles }:
|
||||||
let
|
let
|
||||||
roles_mod = (map (r: mkHomeRole r) roles);
|
roles_mod = (map (r: mkHomeRole r) roles);
|
||||||
|
defaults_mod = (map (r: mkHomeRole r) defaultRoles);
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
fileSystems."/home/${name}/Downloads" = pkgs.lib.mkIf stdenv.isLinux {
|
fileSystems."/home/${name}/Downloads" = pkgs.lib.mkIf stdenv.isLinux {
|
||||||
@ -27,16 +35,13 @@
|
|||||||
|
|
||||||
programs.zsh.enable = true;
|
programs.zsh.enable = true;
|
||||||
|
|
||||||
home-manager.users.${name}.imports = [
|
home-manager.users.${name}.imports = defaults_mod ++ roles_mod;
|
||||||
(mkHomeRole "common")
|
|
||||||
(mkHomeRole "zsh")
|
|
||||||
(mkHomeRole "aichat")
|
|
||||||
] ++ roles_mod;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
mkHMUser = { name, roles ? [ ] }:
|
mkHMUser = { name, roles ? [ ], defaultRoles ? defaultHMUserRoles }:
|
||||||
let
|
let
|
||||||
roles_mod = (map (r: mkHomeRole r) roles);
|
roles_mod = (map (r: mkHomeRole r) roles);
|
||||||
|
defaults_mod = (map (r: mkHomeRole r) defaultRoles);
|
||||||
in
|
in
|
||||||
home-manager.lib.homeManagerConfiguration {
|
home-manager.lib.homeManagerConfiguration {
|
||||||
inherit pkgs;
|
inherit pkgs;
|
||||||
@ -48,8 +53,6 @@
|
|||||||
if stdenv.isLinux then "/home/${name}" else "/Users/${name}";
|
if stdenv.isLinux then "/home/${name}" else "/Users/${name}";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
(mkHomeRole "common")
|
] ++ defaults_mod ++ roles_mod;
|
||||||
(mkHomeRole "aichat")
|
|
||||||
] ++ roles_mod;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,24 @@
|
|||||||
{ ... }:
|
{ ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
mkSysRole = role:
|
||||||
|
let
|
||||||
|
path = ../roles + "/${role}.nix";
|
||||||
|
in
|
||||||
|
if builtins.pathExists path then
|
||||||
|
import path
|
||||||
|
else
|
||||||
|
throw "System role '${role}' not found at ${toString path}";
|
||||||
|
|
||||||
|
mkHomeRole = role:
|
||||||
|
let
|
||||||
|
path = ../roles/home + "/${role}.nix";
|
||||||
|
in
|
||||||
|
if builtins.pathExists path then
|
||||||
|
import path
|
||||||
|
else
|
||||||
|
throw "Home role '${role}' not found at ${toString path}";
|
||||||
|
in
|
||||||
{
|
{
|
||||||
mkSysRole = role: import (../roles/${role}.nix);
|
inherit mkSysRole mkHomeRole;
|
||||||
mkHomeRole = role: import (../roles/home/${role}.nix);
|
|
||||||
}
|
}
|
||||||
|
@ -61,6 +61,11 @@ in
|
|||||||
environmentVariables = cfg.environmentVariables;
|
environmentVariables = cfg.environmentVariables;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
services.docling-serve = {
|
||||||
|
enable = true;
|
||||||
|
package = pkgs.unstablePkgs.docling-serve;
|
||||||
|
};
|
||||||
|
|
||||||
pepe.core.vhost.hosts = optionalAttrs (cfg.backendDomain != null) {
|
pepe.core.vhost.hosts = optionalAttrs (cfg.backendDomain != null) {
|
||||||
"${cfg.backendDomain}" = {
|
"${cfg.backendDomain}" = {
|
||||||
locations."/" = {
|
locations."/" = {
|
||||||
@ -76,6 +81,21 @@ in
|
|||||||
proxy_set_header Host localhost:${toString config.services.ollama.port};
|
proxy_set_header Host localhost:${toString config.services.ollama.port};
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
locations."/docling/" = {
|
||||||
|
host = config.services.docling-serve.host;
|
||||||
|
port = config.services.docling-serve.port;
|
||||||
|
allowLAN = true;
|
||||||
|
allowVPN = true;
|
||||||
|
allowWAN = true;
|
||||||
|
recommendedProxySettings = false;
|
||||||
|
extraConfig = ''
|
||||||
|
proxy_buffering off;
|
||||||
|
proxy_read_timeout 600s;
|
||||||
|
|
||||||
|
rewrite ^/docling/(.*) /$1 break;
|
||||||
|
'';
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
|
@ -31,7 +31,6 @@ You must adhere to the following rules without exception:
|
|||||||
3. **Scope**: The `(scope)` is optional. If used, it must be a noun describing the section of the codebase affected.
|
3. **Scope**: The `(scope)` is optional. If used, it must be a noun describing the section of the codebase affected.
|
||||||
|
|
||||||
4. **Subject**: The `<subject>` line:
|
4. **Subject**: The `<subject>` line:
|
||||||
* Must be 50 characters or less.
|
|
||||||
* Must be written in the imperative mood (e.g., "Add feature", not "Added feature" or "Adds feature").
|
* Must be written in the imperative mood (e.g., "Add feature", not "Added feature" or "Adds feature").
|
||||||
* Must not be capitalized.
|
* Must not be capitalized.
|
||||||
* Must not end with a period.
|
* Must not end with a period.
|
||||||
@ -39,7 +38,6 @@ You must adhere to the following rules without exception:
|
|||||||
5. **Body**: The `[body]` is optional but highly encouraged for anything other than trivial changes.
|
5. **Body**: The `[body]` is optional but highly encouraged for anything other than trivial changes.
|
||||||
* It must be separated from the subject by one blank line.
|
* It must be separated from the subject by one blank line.
|
||||||
* It must explain the "what" and "why" of the change, not the "how".
|
* It must explain the "what" and "why" of the change, not the "how".
|
||||||
* Each line must be wrapped at 72 characters.
|
|
||||||
|
|
||||||
6. **Output**: Your final output must be ONLY the raw text of the commit message and nothing else. Do not include any explanations, apologies, or surrounding markdown like ` ``` `.
|
6. **Output**: Your final output must be ONLY the raw text of the commit message and nothing else. Do not include any explanations, apologies, or surrounding markdown like ` ``` `.
|
||||||
|
|
||||||
@ -97,4 +95,4 @@ index 0000000..d67e2a9
|
|||||||
+ * **test**: Adding missing tests or correcting existing tests.
|
+ * **test**: Adding missing tests or correcting existing tests.
|
||||||
+ * **build**: Changes that affect the build system or external dependencies.
|
+ * **build**: Changes that affect the build system or external dependencies.
|
||||||
+ * **ci**: Changes to our CI configuration files and scripts.
|
+ * **ci**: Changes to our CI configuration files and scripts.
|
||||||
+ * **chore**: Other changes that don't modify src or test files.
|
+ * **chore**: Other changes that don't modify src or test files.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user