diff --git a/cluster/services/hercules-ci-multi-agent/common.nix b/cluster/services/hercules-ci-multi-agent/common.nix index 54de8df..fc4bc77 100644 --- a/cluster/services/hercules-ci-multi-agent/common.nix +++ b/cluster/services/hercules-ci-multi-agent/common.nix @@ -3,7 +3,6 @@ let mapAgents = lib.flip lib.mapAttrs config.services.hercules-ci-agents; - #lib.foldl' (a: b: a // b) {} (lib.attrValues (lib.mapAttrs (basename: basevalue: lib.mapAttrs' (n: v: lib.nameValuePair "${n}-${basename}" v) basevalue) x)); mergeMap = f: let outputs = mapAgents f; in lib.pipe outputs [ @@ -38,12 +37,6 @@ in group = "hci-${name}"; }; }); - services.hercules-ci-agents.private-void = { - settings = { - clusterJoinTokenPath = config.age.secrets.hci-token-private-void.path; - binaryCachesPath = config.age.secrets.hci-cache-config-private-void.path; - }; - }; systemd.services = mergeMap (name: _: { hercules-ci-agent = { # hercules-ci-agent-restarter should take care of this diff --git a/cluster/services/hercules-ci-multi-agent/orgs/max.nix b/cluster/services/hercules-ci-multi-agent/orgs/max.nix index 69e96d8..a74e9c6 100644 --- a/cluster/services/hercules-ci-multi-agent/orgs/max.nix +++ b/cluster/services/hercules-ci-multi-agent/orgs/max.nix @@ -1,7 +1,8 @@ -{ config, inputs, pkgs, ... }: +{ config, lib, inputs, pkgs, ... }: { services.hercules-ci-agents.max = { + package = lib.mkForce inputs.self.packages.${pkgs.system}.hercules-ci-agent; settings = { clusterJoinTokenPath = config.age.secrets.hci-token-max.path; binaryCachesPath = config.age.secrets.hci-cache-config-max.path; diff --git a/cluster/services/hercules-ci-multi-agent/orgs/nixpak.nix b/cluster/services/hercules-ci-multi-agent/orgs/nixpak.nix index 6a6d6bc..44909b6 100644 --- a/cluster/services/hercules-ci-multi-agent/orgs/nixpak.nix +++ b/cluster/services/hercules-ci-multi-agent/orgs/nixpak.nix @@ -1,7 +1,8 @@ -{ config, inputs, pkgs, ... }: +{ config, lib, inputs, pkgs, ... }: { services.hercules-ci-agents.nixpak = { + package = lib.mkForce inputs.self.packages.${pkgs.system}.hercules-ci-agent; settings = { clusterJoinTokenPath = config.age.secrets.hci-token-nixpak.path; binaryCachesPath = config.age.secrets.hci-cache-config-nixpak.path; diff --git a/cluster/services/hercules-ci-multi-agent/orgs/private-void.nix b/cluster/services/hercules-ci-multi-agent/orgs/private-void.nix index 1abf677..eb9619f 100644 --- a/cluster/services/hercules-ci-multi-agent/orgs/private-void.nix +++ b/cluster/services/hercules-ci-multi-agent/orgs/private-void.nix @@ -1,7 +1,8 @@ -{ config, inputs, pkgs, ... }: +{ config, lib, inputs, pkgs, ... }: { services.hercules-ci-agents.private-void = { + package = lib.mkForce inputs.self.packages.${pkgs.system}.hercules-ci-agent; settings = { clusterJoinTokenPath = config.age.secrets.hci-token-private-void.path; binaryCachesPath = config.age.secrets.hci-cache-config-private-void.path; diff --git a/flake.lock b/flake.lock index 2acb388..faf5621 100644 --- a/flake.lock +++ b/flake.lock @@ -121,19 +121,17 @@ "nixpkgs": [ "nixpkgs" ], - "poetry2nix": [ - "poetry2nix" - ], + "poetry2nix": "poetry2nix", "pre-commit-hooks": [ "blank" ] }, "locked": { - "lastModified": 1672407173, - "narHash": "sha256-lmUyHBOtD2XuXqthfXOo5ofv4+tRJV9LF0W8Urn3e6o=", + "lastModified": 1672661134, + "narHash": "sha256-WqBUyKeiv+jI11ug+qP0OnZ4nngK6eBRVTGHgdzEGvc=", "owner": "nix-community", "repo": "dream2nix", - "rev": "7ca3383c2ca2b49b5a0990fc898e4f2fa7848e62", + "rev": "9f6911c78dcb0832f7fcc955e847db1a5a9ce29a", "type": "github" }, "original": { @@ -349,11 +347,11 @@ }, "locked": { "host": "git.privatevoid.net", - "lastModified": 1671896375, - "narHash": "sha256-TmPI8DOUy+CBnMo6j7ZZ3LT42eo6l3DvqunpLkiW4Is=", + "lastModified": 1673041460, + "narHash": "sha256-D1KJzWwgXD6/fh8DSFbLD3v4BSOPOSvjZIjvmC7u2bs=", "owner": "max", "repo": "nix-super", - "rev": "8cc8551afdf9197dc13c0252c4bc07cab8af88e1", + "rev": "1c35324a97a725fe261643ca4dee2128f3af79a6", "type": "gitlab" }, "original": { @@ -363,39 +361,13 @@ "type": "gitlab" } }, - "nixos-command": { - "inputs": { - "flake-utils": [ - "repin-flake-utils" - ], - "nixpkgs": [ - "nixpkgs" - ], - "poetry2nix": [ - "poetry2nix" - ] - }, - "locked": { - "lastModified": 1662057103, - "narHash": "sha256-8czeYcJPbKFcX/F/GuBjgIOXzqNwqr0iOjY5mImgSaM=", - "owner": "max-privatevoid", - "repo": "nixos-command", - "rev": "9d1015b4d366fab6ae46f830e1699a7b9b5dea18", - "type": "github" - }, - "original": { - "owner": "max-privatevoid", - "repo": "nixos-command", - "type": "github" - } - }, "nixpkgs": { "locked": { - "lastModified": 1672437037, - "narHash": "sha256-mVMu/vwx0/bLHD7J7xlItIJpauoMi4V5s26Kh/UzX+s=", + "lastModified": 1673163619, + "narHash": "sha256-B33PFBL64ZgTWgMnhFL3jgheAN/DjHPsZ1Ih3z0VE5I=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "9af32915445545bf1710d419c0a7918da6acb869", + "rev": "8c54d842d9544361aac5f5b212ba04e4089e8efe", "type": "github" }, "original": { @@ -406,24 +378,18 @@ } }, "poetry2nix": { - "inputs": { - "flake-utils": [ - "repin-flake-utils" - ], - "nixpkgs": [ - "nixpkgs" - ] - }, + "flake": false, "locked": { - "lastModified": 1671550109, - "narHash": "sha256-4Iixlro1t75ze8TqXvfz0HTZ9TOBav3vMTuwuYqsxRE=", + "lastModified": 1666918719, + "narHash": "sha256-BkK42fjAku+2WgCOv2/1NrPa754eQPV7gPBmoKQBWlc=", "owner": "nix-community", "repo": "poetry2nix", - "rev": "f18984f99c67654a1f9fbde463c88a319a2c843e", + "rev": "289efb187123656a116b915206e66852f038720e", "type": "github" }, "original": { "owner": "nix-community", + "ref": "1.36.0", "repo": "poetry2nix", "type": "github" } @@ -480,9 +446,7 @@ "nar-serve": "nar-serve", "nix-filter": "nix-filter", "nix-super": "nix-super", - "nixos-command": "nixos-command", "nixpkgs": "nixpkgs", - "poetry2nix": "poetry2nix", "repin-flake-utils": "repin-flake-utils" } } diff --git a/flake.nix b/flake.nix index 4b50bee..cbd6e99 100644 --- a/flake.nix +++ b/flake.nix @@ -139,7 +139,6 @@ gomod2nix.follows = "blank"; mach-nix.follows = "blank"; nix-pypi-fetcher.follows = "blank"; - poetry2nix.follows = "poetry2nix"; pre-commit-hooks.follows = "blank"; }; }; @@ -190,23 +189,6 @@ blank.url = "github:divnix/blank"; - poetry2nix = { - url = "github:nix-community/poetry2nix"; - inputs = { - nixpkgs.follows = "nixpkgs"; - flake-utils.follows = "repin-flake-utils"; - }; - }; - - nixos-command = { - url = "github:max-privatevoid/nixos-command"; - inputs = { - flake-utils.follows = "repin-flake-utils"; - nixpkgs.follows = "nixpkgs"; - poetry2nix.follows = "poetry2nix"; - }; - }; - drv-parts = { url = "github:DavHau/drv-parts"; inputs = { diff --git a/modules/maintenance/default.nix b/modules/maintenance/default.nix index 2c7ee53..a5955a5 100644 --- a/modules/maintenance/default.nix +++ b/modules/maintenance/default.nix @@ -1,9 +1,6 @@ { inputs, pkgs, ... }: { - environment.systemPackages = [ - inputs.nixos-command.packages.${pkgs.system}.nixos-command - ]; systemd.targets.maintenance = { unitConfig.AllowIsolate = true; wants = [ diff --git a/packages/build-support/default.nix b/packages/build-support/default.nix index e914009..b6e1e4c 100644 --- a/packages/build-support/default.nix +++ b/packages/build-support/default.nix @@ -1,17 +1,18 @@ -{ pkgs, ... }: - { imports = [ - ./options.nix - ./drv-parts ]; + perSystem = { pkgs, ... }: { + imports = [ + ./options.nix + ]; - builders = rec { - fetchAsset = pkgs.callPackage ./fetch-asset { }; + builders = rec { + fetchAsset = pkgs.callPackage ./fetch-asset { }; - hydrateAssetDirectory = pkgs.callPackage ./hydrate-asset-directory { - inherit fetchAsset; + hydrateAssetDirectory = pkgs.callPackage ./hydrate-asset-directory { + inherit fetchAsset; + }; }; }; } diff --git a/packages/build-support/drv-parts/default.nix b/packages/build-support/drv-parts/default.nix index b1784bf..a69ef64 100644 --- a/packages/build-support/drv-parts/default.nix +++ b/packages/build-support/drv-parts/default.nix @@ -1,11 +1,12 @@ -{ config, inputs, ... }: - +{ inputs, ... }: { - imports = [ - ./backends - ./dependency-sets - ]; - _module.args = { - drv-backends = inputs.drv-parts.drv-backends // config.drv-backends; + perSystem = { config, ... }: { + imports = [ + ./backends + ./dependency-sets + ]; + _module.args = { + drv-backends = inputs.drv-parts.drv-backends // config.drv-backends; + }; }; -} +} \ No newline at end of file diff --git a/packages/checks/default.nix b/packages/checks/default.nix index 7eba7c9..60f1362 100644 --- a/packages/checks/default.nix +++ b/packages/checks/default.nix @@ -1,15 +1,18 @@ -{ filters, pkgs, self, self', ... }: -{ - checks = filters.doFilter filters.checks { - keycloak = pkgs.callPackage ./keycloak-custom-jre.nix { - jre = self'.packages.jre17_standard; - }; +{ self, ... }: - patroni = pkgs.callPackage ./patroni.nix { - patroniModule = self.nixosModules.patroni; - }; - tempo = pkgs.callPackage ./tempo.nix { - inherit (self'.packages) tempo; +{ + perSystem = { filters, pkgs, self', ... }: { + checks = filters.doFilter filters.checks { + keycloak = pkgs.callPackage ./keycloak-custom-jre.nix { + jre = self'.packages.jre17_standard; + }; + + patroni = pkgs.callPackage ./patroni.nix { + patroniModule = self.nixosModules.patroni; + }; + tempo = pkgs.callPackage ./tempo.nix { + inherit (self'.packages) tempo; + }; }; }; } diff --git a/packages/modules/devshell.nix b/packages/modules/devshell.nix index 2cfda02..2895d1e 100644 --- a/packages/modules/devshell.nix +++ b/packages/modules/devshell.nix @@ -1,67 +1,70 @@ -{ lib, config, inputs', system, ... }: -with lib; -let - inherit (inputs'.devshell.legacyPackages) mkShell; +{ lib, ... }: - wrapInAttrs = value: if builtins.isAttrs value then value else { inherit value; }; +{ + perSystem = { config, inputs', system, ... }: + with lib; + let + inherit (inputs'.devshell.legacyPackages) mkShell; - wrapPackage = package: { inherit package; }; + wrapInAttrs = value: if builtins.isAttrs value then value else { inherit value; }; - injectAttrName = name: value: { inherit name; } // wrapInAttrs value; + wrapPackage = package: { inherit package; }; - mkNamedAttrs = builtins.mapAttrs injectAttrName; + injectAttrName = name: value: { inherit name; } // wrapInAttrs value; - attrsToNamedList = attrs: builtins.attrValues (mkNamedAttrs attrs); + mkNamedAttrs = builtins.mapAttrs injectAttrName; - mkProjectShell = - { - packages ? [], - tools ? [], - commands ? {}, - env ? {}, - config ? {} - }: - mkShell { - imports = [ - config - { - commands = map wrapPackage tools; - } - { - inherit packages; - commands = attrsToNamedList commands; - env = attrsToNamedList env; - } - ]; + attrsToNamedList = attrs: builtins.attrValues (mkNamedAttrs attrs); + + mkProjectShell = + { + packages ? [], + tools ? [], + commands ? {}, + env ? {}, + config ? {} + }: + mkShell { + imports = [ + config + { + commands = map wrapPackage tools; + } + { + inherit packages; + commands = attrsToNamedList commands; + env = attrsToNamedList env; + } + ]; + }; + in { + options.projectShells = mkOption { + default = {}; + type = types.attrsOf (types.submodule { + options = { + packages = mkOption { + default = []; + type = types.listOf types.package; + }; + tools = mkOption { + default = []; + type = types.listOf types.package; + }; + commands = mkOption { + default = {}; + type = types.attrsOf types.attrs; + }; + env = mkOption { + default = {}; + type = with types; attrsOf (oneOf [ attrs str ] ); + }; + config = mkOption { + default = {}; + type = types.anything; + }; + }; + }); + }; + config.devShells = lib.mkIf (system == "x86_64-linux") (mapAttrs (_: mkProjectShell) config.projectShells); }; -in { - options.projectShells = mkOption { - default = {}; - type = types.attrsOf (types.submodule { - options = { - packages = mkOption { - default = []; - type = types.listOf types.package; - }; - tools = mkOption { - default = []; - type = types.listOf types.package; - }; - commands = mkOption { - default = {}; - type = types.attrsOf types.attrs; - }; - env = mkOption { - default = {}; - type = with types; attrsOf (oneOf [ attrs str ] ); - }; - config = mkOption { - default = {}; - type = types.anything; - }; - }; - }); - }; - config.devShells = lib.mkIf (system == "x86_64-linux") (mapAttrs (_: mkProjectShell) config.projectShells); } - diff --git a/packages/networking/hyprspace/project.nix b/packages/networking/hyprspace/project.nix index 1d991e7..6373a64 100644 --- a/packages/networking/hyprspace/project.nix +++ b/packages/networking/hyprspace/project.nix @@ -1,40 +1,42 @@ -{ inputs, lib, pkgs, ... }: +{ lib, inputs, ... }: { - projectShells.hyprspace = { - tools = [ - pkgs.go_1_18 - ]; - env.GOPATH.eval = "$REPO_DATA_DIR/go"; - }; - packages.hyprspace = with pkgs; buildGo118Module { - pname = "hyprspace"; - version = "0.3.2"; - - src = with inputs.nix-filter.lib; let - dirs = map inDirectory; - in filter { - root = ./.; - include = [ - "go.mod" - "go.sum" - (matchExt "go") - ] ++ (dirs [ - "cli" - "config" - "p2p" - "tun" - ]); + perSystem = { pkgs, ... }: { + projectShells.hyprspace = { + tools = [ + pkgs.go_1_18 + ]; + env.GOPATH.eval = "$REPO_DATA_DIR/go"; }; + packages.hyprspace = with pkgs; buildGo118Module { + pname = "hyprspace"; + version = "0.3.2"; - vendorSha256 = "sha256-BiNWV/uNPnplwNfAvqf/Xc9ReFkLhHWVVeZrb/NI4bE="; + src = with inputs.nix-filter.lib; let + dirs = map inDirectory; + in filter { + root = ./.; + include = [ + "go.mod" + "go.sum" + (matchExt "go") + ] ++ (dirs [ + "cli" + "config" + "p2p" + "tun" + ]); + }; - meta = with lib; { - description = "A Lightweight VPN Built on top of Libp2p for Truly Distributed Networks."; - homepage = "https://github.com/hyprspace/hyprspace"; - license = licenses.asl20; - maintainers = with maintainers; [ yusdacra ]; - platforms = platforms.linux ++ platforms.darwin; + vendorSha256 = "sha256-BiNWV/uNPnplwNfAvqf/Xc9ReFkLhHWVVeZrb/NI4bE="; + + meta = with lib; { + description = "A Lightweight VPN Built on top of Libp2p for Truly Distributed Networks."; + homepage = "https://github.com/hyprspace/hyprspace"; + license = licenses.asl20; + maintainers = with maintainers; [ yusdacra ]; + platforms = platforms.linux ++ platforms.darwin; + }; }; }; } diff --git a/packages/networking/ipfs-cluster/project.nix b/packages/networking/ipfs-cluster/project.nix index bb37bac..9e89fd2 100644 --- a/packages/networking/ipfs-cluster/project.nix +++ b/packages/networking/ipfs-cluster/project.nix @@ -1,58 +1,59 @@ -{ inputs, lib, pkgs, ... }: - +{ inputs, ... }: { - projectShells.ipfs-cluster = { - tools = [ - pkgs.go_1_19 - pkgs.gnumake - pkgs.gcc - ]; - env.GOPATH.eval = "$REPO_DATA_DIR/go"; - }; - packages.ipfs-cluster = with pkgs; buildGo119Module { - pname = "ipfs-cluster"; - version = "1.0.2"; - - src = with inputs.nix-filter.lib; filter { - root = ./.; - include = [ - "go.mod" - "go.sum" - (matchExt "go") - ] ++ (map inDirectory [ - "adder" - "allocator" - "api" - "cmd" - "cmdutils" - "config" - "consensus" - "datastore" - "docker" - "informer" - "ipfsconn" - "monitor" - "observations" - "pintracker" - "pstoremgr" - "rpcutil" - "sharness" - "state" - "test" - "version" - ]); + perSystem = { lib, pkgs, ... }: { + projectShells.ipfs-cluster = { + tools = [ + pkgs.go_1_19 + pkgs.gnumake + pkgs.gcc + ]; + env.GOPATH.eval = "$REPO_DATA_DIR/go"; }; + packages.ipfs-cluster = with pkgs; buildGo119Module { + pname = "ipfs-cluster"; + version = "1.0.2"; - vendorSha256 = "sha256-EpZQ7br+ChoAGIj0g6pdpWvFeOFOn2i+6YRBgtzoO+A="; + src = with inputs.nix-filter.lib; filter { + root = ./.; + include = [ + "go.mod" + "go.sum" + (matchExt "go") + ] ++ (map inDirectory [ + "adder" + "allocator" + "api" + "cmd" + "cmdutils" + "config" + "consensus" + "datastore" + "docker" + "informer" + "ipfsconn" + "monitor" + "observations" + "pintracker" + "pstoremgr" + "rpcutil" + "sharness" + "state" + "test" + "version" + ]); + }; - doCheck = false; + vendorSha256 = "sha256-EpZQ7br+ChoAGIj0g6pdpWvFeOFOn2i+6YRBgtzoO+A="; - meta = with lib; { - description = "Allocate, replicate, and track Pins across a cluster of IPFS daemons"; - homepage = "https://ipfscluster.io"; - license = licenses.mit; - platforms = platforms.unix; - maintainers = with maintainers; [ Luflosi jglukasik ]; - }; + doCheck = false; + + meta = with lib; { + description = "Allocate, replicate, and track Pins across a cluster of IPFS daemons"; + homepage = "https://ipfscluster.io"; + license = licenses.mit; + platforms = platforms.unix; + maintainers = with maintainers; [ Luflosi jglukasik ]; + }; + }; }; } diff --git a/packages/patched-inputs.nix b/packages/patched-inputs.nix index 09f7237..38d549b 100644 --- a/packages/patched-inputs.nix +++ b/packages/patched-inputs.nix @@ -1,5 +1,5 @@ { - perSystem = { filters, inputs', ... }: + perSystem = { filters, inputs', lib, pkgs, ... }: let tools = import ./lib/tools.nix; @@ -14,7 +14,19 @@ agenix = packages.agenix.agenix.override { nix = nix-super; }; - hercules-ci-agent = packages.hercules-ci-agent.hercules-ci-agent; + # hci-agent's build code does some funny shenanigans + hercules-ci-agent = let + original = packages.hercules-ci-agent.hercules-ci-agent; + patchedNix = patch-rename-direct original.nix ({ version, ...}: "nix-${version}_hci1") "patches/extra/hercules-ci-agent/nix"; + in (original.override { + # for hercules-ci-cnix-expr, hercules-ci-cnix-store + nix = patchedNix; + # for cachix + pkgs = pkgs // { nix = patchedNix; }; + }).overrideAttrs (old: { + # for hercules-ci-agent + buildInputs = (lib.remove original.nix old.buildInputs) ++ [ patchedNix ]; + }); hci = packages.hercules-ci-agent.hercules-ci-cli; }; diff --git a/packages/poetry2nix-overrides/default.nix b/packages/poetry2nix-overrides/default.nix deleted file mode 100644 index 9bc15cf..0000000 --- a/packages/poetry2nix-overrides/default.nix +++ /dev/null @@ -1,7 +0,0 @@ -final: prev: { - py-multibase = prev.py-multibase.overridePythonAttrs (old: { - nativeBuildInputs = (old.nativeBuildInputs or []) ++ [ - final.pytestrunner - ]; - }); -} \ No newline at end of file diff --git a/packages/projects.nix b/packages/projects.nix index 875717f..e0c27fe 100644 --- a/packages/projects.nix +++ b/packages/projects.nix @@ -1,6 +1,17 @@ { inputs, self, ... }: { + imports = [ + ./checks + ./modules/devshell.nix + ./build-support + + ./networking/hyprspace/project.nix + ./networking/ipfs-cluster/project.nix + ./servers/reflex-cache/project.nix + ./websites/landing/project.nix + ./websites/stop-using-nix-env/project.nix + ]; perSystem = { filters, pkgs, self', ... }: let inherit (self'.packages) nix-super; @@ -14,25 +25,8 @@ overridesDirs = [ ./dream2nix-overrides ]; }; }; - poetry2nix = pkgs.poetry2nix.overrideScope' (final: prev: { - defaultPoetryOverrides = prev.defaultPoetryOverrides.extend (import ./poetry2nix-overrides); - }); - in { - _module.args = { inherit inputs self; }; - - imports = [ - ./checks - ./modules/devshell.nix - ./build-support - - ./networking/hyprspace/project.nix - ./networking/ipfs-cluster/project.nix - ./servers/reflex-cache/project.nix - ./websites/landing/project.nix - ./websites/stop-using-nix-env/project.nix - ]; packages = filters.doFilter filters.packages rec { cinny = pkgs.callPackage ./web-apps/cinny { inherit pins; }; diff --git a/packages/servers/reflex-cache/project.nix b/packages/servers/reflex-cache/project.nix index 3453f05..611484f 100644 --- a/packages/servers/reflex-cache/project.nix +++ b/packages/servers/reflex-cache/project.nix @@ -1,38 +1,40 @@ -{ config, drv-backends, inputs, lib, pkgs, ... }: +{ inputs, ... }: -let - deps = with config.dependencySets.python3Packages; [ - poetry-core - requests-unixsocket - py-multibase - py-multiaddr - ]; - - pythonForDev = pkgs.python3.withPackages (lib.const deps); -in { - projectShells.reflex-cache = { - tools = [ - pythonForDev + perSystem = { config, drv-backends, lib, pkgs, ... }: let + deps = with config.dependencySets.python3Packages; [ + poetry-core + requests-unixsocket + py-multibase + py-multiaddr ]; - env.PYTHON = pythonForDev.interpreter; - commands.reflex.command = "${pythonForDev.interpreter} -m reflex_cache.main"; - }; - drvs.reflex-cache = { dependencySets, ... }: { - imports = [ - drv-backends.buildPythonPackage - ]; - pyprojectToml = ./pyproject.toml; - inherit (pkgs) stdenv; - propagatedBuildInputs = deps; - - src = with inputs.nix-filter.lib; filter { - root = ./.; - include = [ - "pyproject.toml" - (inDirectory "reflex_cache") + pythonForDev = pkgs.python3.withPackages (lib.const deps); + in + { + projectShells.reflex-cache = { + tools = [ + pythonForDev ]; + env.PYTHON = pythonForDev.interpreter; + commands.reflex.command = "${pythonForDev.interpreter} -m reflex_cache.main"; + }; + drvs.reflex-cache = { dependencySets, ... }: { + imports = [ + drv-backends.buildPythonPackage + ]; + pyprojectToml = ./pyproject.toml; + inherit (pkgs) stdenv; + + propagatedBuildInputs = deps; + + src = with inputs.nix-filter.lib; filter { + root = ./.; + include = [ + "pyproject.toml" + (inDirectory "reflex_cache") + ]; + }; }; }; -} +} \ No newline at end of file diff --git a/packages/sources/sources.json b/packages/sources/sources.json index 4d8bc19..16157ab 100644 --- a/packages/sources/sources.json +++ b/packages/sources/sources.json @@ -22,9 +22,9 @@ "repo": "excalidraw" }, "branch": "master", - "revision": "5fcf6a48452b1805323b31e1a7773eec9193ff9c", - "url": "https://github.com/excalidraw/excalidraw/archive/5fcf6a48452b1805323b31e1a7773eec9193ff9c.tar.gz", - "hash": "1cbzkcxwyycz2nd7i0pj4w8a7jjx2l0q2kwv2dp5g6vpydlw18iw" + "revision": "06b45e0cfc9bc93b3565acee2932d643169fb298", + "url": "https://github.com/excalidraw/excalidraw/archive/06b45e0cfc9bc93b3565acee2932d643169fb298.tar.gz", + "hash": "1xfh90kyxfvpy5vyym1g9rz62zz1zgawyq14rfcjpjrybvqzz18s" }, "searxng": { "type": "Git", @@ -34,9 +34,9 @@ "repo": "searxng" }, "branch": "master", - "revision": "e8f72d705209bee09738ba050aeb75927d663c84", - "url": "https://github.com/searxng/searxng/archive/e8f72d705209bee09738ba050aeb75927d663c84.tar.gz", - "hash": "05rrwfd88h6n0xpy3idwvlnf7vsw96l5gyb6l2smkbs1rsyyr9nk" + "revision": "54e63839db9f99611127c058c0989721b4d3d19b", + "url": "https://github.com/searxng/searxng/archive/54e63839db9f99611127c058c0989721b4d3d19b.tar.gz", + "hash": "1scmpvrl5a5smw96k14f817cz3n7lssq0i7v8wc3fdmn1fs5vgfm" }, "stevenblack-hosts": { "type": "GitRelease", @@ -47,10 +47,10 @@ }, "pre_releases": false, "version_upper_bound": null, - "version": "3.11.45", - "revision": "5ad27300a3c2dbd267b4593226b9c35680e2204f", - "url": "https://api.github.com/repos/StevenBlack/hosts/tarball/3.11.45", - "hash": "0rsflfp1wm8c7h8jpywvrh3gbqivzjjj7d9nakfjsa2ipvfg8clj" + "version": "3.11.50", + "revision": "0b190200ac4b0fdd788a9334bd6235eb53242b5c", + "url": "https://api.github.com/repos/StevenBlack/hosts/tarball/3.11.50", + "hash": "1vwc22bg88hbc2dvxhcpaz02md0fhr97vqbf2jwgrp565pnfcflc" }, "tempo": { "type": "GitRelease", @@ -75,10 +75,10 @@ }, "pre_releases": false, "version_upper_bound": null, - "version": "1.19.2", - "revision": "aec80b53d53454a103490f91ef469e975062a24c", - "url": "https://api.github.com/repos/louislam/uptime-kuma/tarball/1.19.2", - "hash": "1hhbh9a5w3ilrfmccwbjsc7qpadccc12l0aglh5acnq2gcxkfr69" + "version": "1.19.3", + "revision": "b8e8c1b9dbb1cd74f6a5ba02c49367ead506370c", + "url": "https://api.github.com/repos/louislam/uptime-kuma/tarball/1.19.3", + "hash": "19r1npkk73karlbb0vwbyfr31k2rl18ily7rwwvqqjazmgp0j32n" } }, "version": 2 diff --git a/packages/web-apps/searxng/default.nix b/packages/web-apps/searxng/default.nix index 2810f63..56ff6d0 100644 --- a/packages/web-apps/searxng/default.nix +++ b/packages/web-apps/searxng/default.nix @@ -1,18 +1,27 @@ { lib, nixosTests, python3, python3Packages, npins, pins }: -with python3Packages; +let + pin = pins.searxng; + repo = pin.repository; +in with python3Packages; -toPythonModule (buildPythonApplication { +toPythonModule (buildPythonApplication rec { pname = "searxng"; - version = "1.0.0pre_${builtins.substring 0 7 pins.searxng.revision}"; + version = "1.0.0pre_${builtins.substring 0 7 pin.revision}"; src = npins.mkSource pins.searxng; postPatch = '' sed -i \ -e 's/==.*$//' \ - -e 's/fasttext-wheel/fasttext/g' \ + -e 's/fasttext-predict/fasttext/g' \ requirements.txt + cat >searx/version_frozen.py </dev/null && xdg-open http://127.0.0.1:1314 || true - ${darkhttpd}/bin/darkhttpd ${site.webroot} --addr 127.0.0.1 --port 1314 - ''; + }); + hugoArgs = [ + "--config" configFile + ]; + hugoArgsStr = lib.concatStringsSep " " hugoArgs; + in + { + projectShells.landing = { + commands.hugo = { + help = pkgs.hugo.meta.description; + command = "exec ${pkgs.hugo}/bin/hugo ${hugoArgsStr} \"$@\""; }; + tools = with self'.packages; [ + dvc + ]; }; - in site; + + packages.landing = with pkgs; let + site = stdenvNoCC.mkDerivation rec { + pname = "private-void-landing-page"; + version = "0.0.0"; + src = builders.hydrateAssetDirectory ./.; + nativeBuildInputs = [ + hugo + ]; + buildCommand = '' + unpackPhase + mkdir -p $out/share/www + hugo ${hugoArgsStr} -s $sourceRoot -d $out/share/www/${pname} + ''; + passthru = { + webroot = "${site}/share/www/${site.pname}"; + serve = writeShellScriptBin "serve-site" '' + command -v xdg-open >/dev/null && xdg-open http://127.0.0.1:1314 || true + ${darkhttpd}/bin/darkhttpd ${site.webroot} --addr 127.0.0.1 --port 1314 + ''; + }; + }; + in site; + }; } diff --git a/packages/websites/stop-using-nix-env/project.nix b/packages/websites/stop-using-nix-env/project.nix index 2c1439a..0c733d6 100644 --- a/packages/websites/stop-using-nix-env/project.nix +++ b/packages/websites/stop-using-nix-env/project.nix @@ -1,19 +1,19 @@ -{ pkgs, ... }: - { - packages.stop-using-nix-env = let - site = with pkgs; stdenvNoCC.mkDerivation rec { - pname = "stop-using-nix-env"; - version = "1.2.0"; - src = ./src; - buildCommand = '' - install -Dm644 $src/* -t $out/share/www/${pname} - substituteInPlace $out/share/www/${pname}/index.html \ - --replace '' 'Version ${version} |' - ''; - passthru = { - webroot = "${site}/share/www/${pname}"; + perSystem = { pkgs, ... }: { + packages.stop-using-nix-env = let + site = with pkgs; stdenvNoCC.mkDerivation rec { + pname = "stop-using-nix-env"; + version = "1.2.0"; + src = ./src; + buildCommand = '' + install -Dm644 $src/* -t $out/share/www/${pname} + substituteInPlace $out/share/www/${pname}/index.html \ + --replace '' 'Version ${version} |' + ''; + passthru = { + webroot = "${site}/share/www/${pname}"; + }; }; - }; - in site; + in site; + }; } diff --git a/patches/extra/hercules-ci-agent/nix/GHPR_7489-PDT-TDE-3114-prevent-a-race-condition-when-creating-the-S3-cache.patch b/patches/extra/hercules-ci-agent/nix/GHPR_7489-PDT-TDE-3114-prevent-a-race-condition-when-creating-the-S3-cache.patch new file mode 100644 index 0000000..50ecded --- /dev/null +++ b/patches/extra/hercules-ci-agent/nix/GHPR_7489-PDT-TDE-3114-prevent-a-race-condition-when-creating-the-S3-cache.patch @@ -0,0 +1,70 @@ +diff --git a/src/libstore/nar-info-disk-cache.cc b/src/libstore/nar-info-disk-cache.cc +index f4ea739b05d..3e0689534b6 100644 +--- a/src/libstore/nar-info-disk-cache.cc ++++ b/src/libstore/nar-info-disk-cache.cc +@@ -166,16 +166,37 @@ class NarInfoDiskCacheImpl : public NarInfoDiskCache + return i->second; + } + ++ std::optional queryCacheRaw(State & state, const std::string & uri) ++ { ++ auto i = state.caches.find(uri); ++ if (i == state.caches.end()) { ++ auto queryCache(state.queryCache.use()(uri)(time(0) - cacheInfoTtl)); ++ if (!queryCache.next()) ++ return std::nullopt; ++ state.caches.emplace(uri, ++ Cache{(int) queryCache.getInt(0), queryCache.getStr(1), queryCache.getInt(2) != 0, (int) queryCache.getInt(3)}); ++ } ++ return getCache(state, uri); ++ } ++ + void createCache(const std::string & uri, const Path & storeDir, bool wantMassQuery, int priority) override + { + retrySQLite([&]() { + auto state(_state.lock()); ++ SQLiteTxn txn(state->db); ++ ++ // To avoid the race, we have to check if maybe someone hasn't yet created ++ // the cache for this URI in the meantime. ++ auto cache(queryCacheRaw(*state, uri)); + +- // FIXME: race ++ if (cache) ++ return; + + state->insertCache.use()(uri)(time(0))(storeDir)(wantMassQuery)(priority).exec(); + assert(sqlite3_changes(state->db) == 1); + state->caches[uri] = Cache{(int) sqlite3_last_insert_rowid(state->db), storeDir, wantMassQuery, priority}; ++ ++ txn.commit(); + }); + } + +@@ -183,21 +204,12 @@ class NarInfoDiskCacheImpl : public NarInfoDiskCache + { + return retrySQLite>([&]() -> std::optional { + auto state(_state.lock()); +- +- auto i = state->caches.find(uri); +- if (i == state->caches.end()) { +- auto queryCache(state->queryCache.use()(uri)(time(0) - cacheInfoTtl)); +- if (!queryCache.next()) +- return std::nullopt; +- state->caches.emplace(uri, +- Cache{(int) queryCache.getInt(0), queryCache.getStr(1), queryCache.getInt(2) != 0, (int) queryCache.getInt(3)}); +- } +- +- auto & cache(getCache(*state, uri)); +- ++ auto cache(queryCacheRaw(*state, uri)); ++ if (!cache) ++ return std::nullopt; + return CacheInfo { +- .wantMassQuery = cache.wantMassQuery, +- .priority = cache.priority ++ .wantMassQuery = cache->wantMassQuery, ++ .priority = cache->priority + }; + }); + }