From ceeb526ec563f85aa16a9c1a069b4c932b8186bd Mon Sep 17 00:00:00 2001 From: chayleaf Date: Thu, 26 Oct 2023 22:22:39 +0700 Subject: [PATCH] flake.packages: dont export stuff from nixpkgs package sets --- flake.nix | 11 +++--- home/common/firefox.nix | 4 +- pkgs/default.nix | 7 ++-- pkgs/postgresql-packages/default.nix | 19 +++++---- system/hosts/server/forgejo.nix | 58 ---------------------------- 5 files changed, 24 insertions(+), 75 deletions(-) delete mode 100644 system/hosts/server/forgejo.nix diff --git a/flake.nix b/flake.nix index 66b219b..292f75c 100644 --- a/flake.nix +++ b/flake.nix @@ -100,7 +100,7 @@ if nixpkgs.lib.hasInfix ":" addr then "[${addr}]" else addr; }; # can't use callPackage ./pkgs here, idk why; use import instead - overlay = self: super: import ./pkgs { + overlay' = args: self: super: import ./pkgs ({ pkgs = super; pkgs' = self; lib = super.lib; @@ -109,16 +109,17 @@ nurpkgs = super; }; nix-gaming = nix-gaming.packages.${super.system}; - }; + } // args); + overlay = overlay' { }; # I override some settings down the line, but overlays always stay the same mkPkgs = config: import nixpkgs (config // { - overlays = (config.overlays or [ ]) ++ [ overlay ]; + overlays = config.overlays or [ ] ++ [ overlay ]; }); # this is actual config, it gets processed below config = let mkBpiR3 = args: config: config // { system = "aarch64-linux"; - modules = (config.modules or [ ]) ++ [ (import ./system/devices/bpi-r3-router.nix args) ]; + modules = config.modules or [ ] ++ [ (import ./system/devices/bpi-r3-router.nix args) ]; }; routerConfig = rec { system = "aarch64-linux"; @@ -304,7 +305,7 @@ packages = lib.genAttrs [ "x86_64-linux" "aarch64-linux" - ] (system: let self = overlay ((mkPkgs { inherit system; }) // self) (import nixpkgs { inherit system; }); in self); + ] (system: let self = overlay' { isOverlay = false; } (mkPkgs { inherit system; } // self) (import nixpkgs { inherit system; }); in self); nixosImages.router = let pkgs = mkPkgs { inherit (config.router-emmc) system; }; in { emmcImage = pkgs.callPackage ./system/hardware/bpi-r3/image.nix { inherit (nixosConfigurations.router-emmc) config; diff --git a/home/common/firefox.nix b/home/common/firefox.nix index 6a933fb..e8119e3 100644 --- a/home/common/firefox.nix +++ b/home/common/firefox.nix @@ -13,7 +13,7 @@ cfg.enableKeePassXC = true; }; profiles.chayleaf = { - extensions = with config.nur.repos.rycee.firefox-addons; [ + extensions = (with config.nur.repos.rycee.firefox-addons; [ cookies-txt don-t-fuck-with-paste greasemonkey @@ -32,7 +32,7 @@ unpaywall vimium-c youtube-shorts-block - ] ++ (with pkgs.firefox-addons; [ + ]) ++ (with pkgs.firefoxAddons; [ fastforwardteam middle-mouse-button-scroll rikaitan diff --git a/pkgs/default.nix b/pkgs/default.nix index 61038a1..ac0e95c 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -3,6 +3,7 @@ , nur , nix-gaming , pkgs' ? pkgs +, isOverlay ? true , ... }: let inherit (pkgs') callPackage; @@ -98,8 +99,8 @@ in })); techmino = callPackage ./techmino { }; - firefox-addons = lib.recurseIntoAttrs (callPackage ./firefox-addons { inherit nur sources; }); - mpvScripts = pkgs.mpvScripts // callPackage ./mpv-scripts { }; + firefoxAddons = lib.recurseIntoAttrs (callPackage ./firefox-addons { inherit nur sources; }); + mpvScripts = lib.optionalAttrs isOverlay pkgs.mpvScripts // callPackage ./mpv-scripts { }; qemu_7 = callPackage ./qemu/7.nix { stdenv = pkgs'.ccacheStdenv; @@ -127,6 +128,6 @@ in stdenv = pkgs'.ccacheStdenv; }; } -// import ./postgresql-packages { inherit pkgs pkgs' lib sources; } +// import ./postgresql-packages { inherit pkgs pkgs' lib sources isOverlay; } // import ./ccache.nix { inherit pkgs pkgs' lib sources; } // import ../system/hardware/bpi-r3/pkgs.nix { inherit pkgs pkgs' lib sources; } diff --git a/pkgs/postgresql-packages/default.nix b/pkgs/postgresql-packages/default.nix index c02d187..cfb188f 100644 --- a/pkgs/postgresql-packages/default.nix +++ b/pkgs/postgresql-packages/default.nix @@ -1,5 +1,7 @@ { pkgs , pkgs' +, isOverlay +, lib , ... }: let @@ -9,7 +11,9 @@ let tsja = callPackage ./tsja.nix { }; }; gen' = postgresql: builtins.mapAttrs (k: v: v.override { inherit postgresql; }) extraPackages; - gen = ver: pkgs."postgresql${toString ver}Packages" // gen' pkgs."postgresql${if ver == "" then "" else "_" + toString ver}"; + gen = ver: + lib.optionalAttrs isOverlay pkgs."postgresql${toString ver}Packages" + // gen' pkgs."postgresql${if ver == "" then "" else "_" + toString ver}"; psql = ver: let old = pkgs."postgresql${if ver == "" then "" else "_" + toString ver}"; in old // { pkgs = old.pkgs // gen' old; }; @@ -23,18 +27,19 @@ let ''; }); postgresqlPackages = gen ""; - postgresql = psql ""; postgresql11Packages = gen 11; - postgresql_11 = psql 11; postgresql12Packages = gen 12; - postgresql_12 = psql 12; postgresql13Packages = gen 13; - postgresql_13 = psql 13; postgresql14Packages = gen 14; - postgresql_14 = psql 14; postgresql15Packages = gen 15; - postgresql_15 = psql 15; postgresql16Packages = gen 16; + } // lib.optionalAttrs isOverlay { + postgresql = psql ""; + postgresql_11 = psql 11; + postgresql_12 = psql 12; + postgresql_13 = psql 13; + postgresql_14 = psql 14; + postgresql_15 = psql 15; postgresql_16 = psql 16; }; in self diff --git a/system/hosts/server/forgejo.nix b/system/hosts/server/forgejo.nix deleted file mode 100644 index db31738..0000000 --- a/system/hosts/server/forgejo.nix +++ /dev/null @@ -1,58 +0,0 @@ -{ config -, lib -, ... }: - -let - cfg = config.server; -in { - services.nginx.virtualHosts."git.${cfg.domainName}" = let inherit (config.services.forgejo) settings; in { - quic = true; - enableACME = true; - forceSSL = true; - locations."/".proxyPass = "http://${lib.quoteListenAddr settings.server.HTTP_ADDR}:${toString settings.server.HTTP_PORT}"; - }; - services.forgejo = { - enable = true; - database = { - createDatabase = false; - user = "gitea"; - passwordFile = "/secrets/forgejo_db_password"; - type = "postgres"; - }; - lfs.enable = true; - settings = { - federation.ENABLED = true; - "git.timeout" = { - DEFAULT = 6000; - MIGRATE = 60000; - MIRROR = 60000; - GC = 120; - }; - mailer = { - ENABLED = true; - FROM = "Forgejo "; - PROTOCOL = "smtp"; - SMTP_ADDR = "mail.${cfg.domainName}"; - SMTP_PORT = 587; - USER = "noreply@${cfg.domainName}"; - PASSWD = cfg.unhashedNoreplyPassword; - FORCE_TRUST_SERVER_CERT = true; - }; - session = { - COOKIE_SECURE = true; - }; - server = { - ROOT_URL = "https://git.${cfg.domainName}"; - HTTP_ADDR = "::1"; - HTTP_PORT = 3310; - DOMAIN = "git.${cfg.domainName}"; - # START_SSH_SERVER = true; - # SSH_PORT = 2222; - }; - service = { - DISABLE_REGISTRATION = false; - REGISTER_MANUAL_CONFIRM = true; - }; - }; - }; -}