From 0f36eed1ead2290b40137d5762400f5caf374e30 Mon Sep 17 00:00:00 2001 From: Eric Rodrigues Pires Date: Thu, 7 May 2026 23:38:00 -0300 Subject: [PATCH] Allow overriding npins inputs in flake --- .config/nextest.toml | 3 +++ flake.lock | 44 +++++++++++++++++++++++++++++++++++++++++++- flake.nix | 40 ++++++++++++++++++++++++++++++++++++---- nix/default.nix | 2 +- nix/dummy.nix | 1 + 5 files changed, 84 insertions(+), 6 deletions(-) create mode 100644 nix/dummy.nix diff --git a/.config/nextest.toml b/.config/nextest.toml index 1eee173..544d315 100644 --- a/.config/nextest.toml +++ b/.config/nextest.toml @@ -7,3 +7,6 @@ test-group = 'integration' [profile.nix] default-filter = 'not test(/^login/) - binary_id(sandhole::integration)' + +[profile.no-network] +default-filter = 'not test(/^login/) - binary_id(sandhole::integration)' diff --git a/flake.lock b/flake.lock index 5999137..97d8e91 100644 --- a/flake.lock +++ b/flake.lock @@ -1,6 +1,48 @@ { "nodes": { - "root": {} + "crane": { + "flake": false, + "locked": { + "path": "./nix/dummy.nix", + "type": "path" + }, + "original": { + "path": "./nix/dummy.nix", + "type": "path" + }, + "parent": [] + }, + "nixpkgs": { + "flake": false, + "locked": { + "path": "./nix/dummy.nix", + "type": "path" + }, + "original": { + "path": "./nix/dummy.nix", + "type": "path" + }, + "parent": [] + }, + "root": { + "inputs": { + "crane": "crane", + "nixpkgs": "nixpkgs", + "rust-overlay": "rust-overlay" + } + }, + "rust-overlay": { + "flake": false, + "locked": { + "path": "./nix/dummy.nix", + "type": "path" + }, + "original": { + "path": "./nix/dummy.nix", + "type": "path" + }, + "parent": [] + } }, "root": "root", "version": 7 diff --git a/flake.nix b/flake.nix index b2b3c75..faa06f7 100644 --- a/flake.nix +++ b/flake.nix @@ -1,10 +1,23 @@ { description = "Expose HTTP/SSH/TCP services through SSH port forwarding"; - inputs = { }; + inputs = { + crane = { + url = "path:./nix/dummy.nix"; + flake = false; + }; + nixpkgs = { + url = "path:./nix/dummy.nix"; + flake = false; + }; + rust-overlay = { + url = "path:./nix/dummy.nix"; + flake = false; + }; + }; outputs = - { self, ... }: + { self, ... }@inputs: let systems = [ "x86_64-linux" @@ -55,12 +68,31 @@ // eachSystem ( system: let - inherit (import ./nix { inherit system; }) - pkgs + sources = import ./npins; + importInput = + attr: + if import inputs.${attr} ? __isDummyInput then import sources.${attr} else import inputs.${attr}; + pkgs = importInput "nixpkgs" { + inherit system; + overlays = [ (importInput "rust-overlay") ]; + }; + craneLib = (importInput "crane" { inherit pkgs; }).overrideToolchain ( + p: p.rust-bin.stable.latest.default + ); + + inherit + (import ./nix { + inherit + system + pkgs + craneLib + ; + }) packages checks shell ; + inherit (pkgs) lib; in { diff --git a/nix/default.nix b/nix/default.nix index 5a97699..c279da5 100644 --- a/nix/default.nix +++ b/nix/default.nix @@ -45,7 +45,7 @@ let ); in { - inherit pkgs sandhole; + inherit sandhole; packages = import ./packages.nix { inherit diff --git a/nix/dummy.nix b/nix/dummy.nix new file mode 100644 index 0000000..5a25a45 --- /dev/null +++ b/nix/dummy.nix @@ -0,0 +1 @@ +{ __isDummyInput = true; } -- 2.51.2