From 40fb017c00cb05735783e09907832895355c3633 Mon Sep 17 00:00:00 2001 From: Aaron Bieber Date: Thu, 1 Jun 2023 18:45:02 -0600 Subject: [PATCH] xinlib: extend prIsOpen to work with packages and overlays --- gui/default.nix | 4 +++- lib/default.nix | 29 ++++++++++++++++++++++------- overlays/default.nix | 7 ++----- pull_requests/219502.json | 19 +++++++++++++++++++ 4 files changed, 46 insertions(+), 13 deletions(-) create mode 100644 pull_requests/219502.json diff --git a/gui/default.nix b/gui/default.nix index 02d911c..a07abb8 100644 --- a/gui/default.nix +++ b/gui/default.nix @@ -24,6 +24,8 @@ let startAt = "*:0/5"; path = [ promnesia hpi ]; }]; + tailscale-systray = xinlib.prIsOpen.pkg 219502 + (pkgs.callPackage ../pkgs/tailscale-systray.nix { }); in with lib; { imports = [ ./gnome.nix ./kde.nix ./xfce.nix ./arcan.nix ]; @@ -75,9 +77,9 @@ in with lib; { vlc zeal - (callPackage ../pkgs/tailscale-systray.nix { }) (callPackage ../pkgs/govulncheck.nix { }) (callPackage ../configs/helix.nix { }) + tailscale-systray ]; programs = { } // firefox.programs; diff --git a/lib/default.nix b/lib/default.nix index 562627a..a895273 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -1,16 +1,31 @@ { lib, ... }: +# TODO: this could be cleaner :D let - prIsOpen = pr: overlay: + getPrStatus = pr: let prstr = builtins.toString pr; prStatus = builtins.fromJSON (builtins.readFile ../pull_requests/${prstr}.json); - in if prStatus.status == "open" then - overlay - else - lib.warn - "PR: ${prstr} (${prStatus.title}) is complete, ignoring overlay..." - (_: _: { }); + in prStatus; + prIsOpen = { + pkg = pr: pkg: + let prStatus = getPrStatus pr; + in if prStatus.status == "open" then + pkg + else + lib.warn "PR: ${ + builtins.toString pr + } (${prStatus.title}) is complete, ignoring pkg..." null; + + overlay = pr: overlay: + let prStatus = getPrStatus pr; + in if prStatus.status == "open" then + overlay + else + lib.warn "PR: ${ + builtins.toString pr + } (${prStatus.title}) is complete, ignoring overlay..." (_: _: { }); + }; mkCronScript = name: src: '' . /etc/profile; diff --git a/overlays/default.nix b/overlays/default.nix index 7437258..7bf006b 100644 --- a/overlays/default.nix +++ b/overlays/default.nix @@ -2,16 +2,13 @@ let inherit (xinlib) prIsOpen; #openssh = import ./openssh.nix; - obsidian = prIsOpen 235408 (import ./obsidian.nix); + obsidian = prIsOpen.overlay 235408 (import ./obsidian.nix); #tailscale = import ./tailscale.nix; #jetbrains = prIsOpen 232308 (import ./jetbrains.nix); #tidal-hifi = prIsOpen 228552 (import ./tidal-hifi.nix { inherit lib; }); #matrix-synapse = prIsOpen 233652 (import ./matrix-synapse.nix); in { - nixpkgs.overlays = if isUnstable then [ - obsidian - ] else - [ ]; + nixpkgs.overlays = if isUnstable then [ obsidian ] else [ ]; } # Example Python dep overlay diff --git a/pull_requests/219502.json b/pull_requests/219502.json new file mode 100644 index 0000000..faed666 --- /dev/null +++ b/pull_requests/219502.json @@ -0,0 +1,19 @@ +{ + "branches": [ + "master", + "staging", + "staging-next" + ], + "pull_request": 219502, + "release": "unstable", + "status": "open", + "status_info": { + "master": true, + "nixos-unstable": false, + "nixos-unstable-small": false, + "nixpkgs-unstable": false, + "staging": true, + "staging-next": true + }, + "title": "tailscale-systray: init at 2022-10-19" +}