From b6961508e890f1d5c5d4a010fb279c1af61543e1 Mon Sep 17 00:00:00 2001 From: Ophestra Date: Wed, 23 Jul 2025 11:49:23 +0900 Subject: [PATCH] store: local store This just returns the verbatim string. --- store.go | 6 ++++++ store_test.go | 10 ++++++++++ 2 files changed, 16 insertions(+) diff --git a/store.go b/store.go index 2f1ea41..227b1e5 100644 --- a/store.go +++ b/store.go @@ -12,6 +12,12 @@ type Store interface { fmt.Stringer } +// Local points to a local filesystem path containing a nix store. +type Local string + +func (Local) Environ() []string { return nil } +func (store Local) String() string { return string(store) } + const ( EnvAwsSharedCredentialsFile = "AWS_SHARED_CREDENTIALS_FILE" ) diff --git a/store_test.go b/store_test.go index eb5b64f..ddcda93 100644 --- a/store_test.go +++ b/store_test.go @@ -6,6 +6,16 @@ import ( "gensokyo.uk/nix" ) +func TestLocal(t *testing.T) { + if got := nix.Local("/").String(); got != "/" { + t.Errorf("String: %v, want %v", got, "/") + } + + if got := nix.Local("").Environ(); got != nil { + t.Errorf("Environ: %v, want %v", got, nil) + } +} + func TestBinaryCache(t *testing.T) { testCases := []struct { name string