From 844e0b64b2a00f1026075979c2cbd548dcb5f80b Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Thu, 7 Dec 2023 17:32:31 -0500 Subject: nix flake related modifications --- .envrc | 3 --- .envrc-nix | 4 ++-- .gitignore | 1 + flake.nix | 2 +- nixDevEnv.sh | 9 +++++++++ org/config_env.org | 20 ++++++++++++++++---- org/config_git.org | 1 + org/config_nix.org | 2 +- org/nixpkgs_overlays_d_related.org | 11 ++++++----- 9 files changed, 37 insertions(+), 16 deletions(-) create mode 100644 nixDevEnv.sh diff --git a/.envrc b/.envrc index 669d42f..e488686 100644 --- a/.envrc +++ b/.envrc @@ -4,6 +4,3 @@ fi if [ -f .envrc-local ]; then source_env_if_exists .envrc-local || source .envrc-local fi -if [ -f .envrc-nix ]; then - source_env_if_exists .envrc-nix || source .envrc-nix -fi diff --git a/.envrc-nix b/.envrc-nix index 58338fb..63b1c84 100644 --- a/.envrc-nix +++ b/.envrc-nix @@ -9,12 +9,12 @@ watch_file flake.lock watch_file flake.nix watch_file shell.nix watch_file makefile -watch_file .envrc +watch_file nixDevEnv.sh watch_file .envrc-local watch_file .envrc-nix nix_direnv_watch_file flake.nix nix_direnv_watch_file shell.nix -nix_direnv_watch_file .envrc +nix_direnv_watch_file nixDevEnv.sh nix_direnv_watch_file .envrc-local nix_direnv_watch_file .envrc-nix nix flake update diff --git a/.gitignore b/.gitignore index e96527f..996333c 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,7 @@ !nix/** !*.nix !flake.lock +!nixDevEnv.sh !.envrc !.envrc-nix !.envrc-git-init diff --git a/flake.nix b/flake.nix index 29b46b5..f96cde1 100644 --- a/flake.nix +++ b/flake.nix @@ -10,7 +10,7 @@ pname = "spine"; version = "0.14.0"; shell = ./shell.nix; # ./default.nix; - devEnv = ./.envrc; # ./shell.nix; # ./default.nix; + devEnv = ./nixDevEnv.sh; # ./shell.nix; # ./default.nix; # ./.envrc; supportedSystems = ["x86_64-linux"]; # [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ]; forAllSystems = nixpkgs.lib.genAttrs supportedSystems; nixpkgsFor = forAllSystems (system: import nixpkgs {inherit system;}); # nixpkgs instantiated for supported system types diff --git a/nixDevEnv.sh b/nixDevEnv.sh new file mode 100644 index 0000000..669d42f --- /dev/null +++ b/nixDevEnv.sh @@ -0,0 +1,9 @@ +if [ -f .envrc-git-init ]; then + source_env_if_exists .envrc-git-init || source .envrc-git-init +fi +if [ -f .envrc-local ]; then + source_env_if_exists .envrc-local || source .envrc-local +fi +if [ -f .envrc-nix ]; then + source_env_if_exists .envrc-nix || source .envrc-nix +fi diff --git a/org/config_env.org b/org/config_env.org index cb24dae..5d06d74 100644 --- a/org/config_env.org +++ b/org/config_env.org @@ -20,9 +20,9 @@ - [[./config_make.org][config_make.org]] * envrc -** envrc :envrc: +** nixDevEnv envrc :envrc: -#+HEADER: :tangle ../.envrc +#+HEADER: :tangle ../nixDevEnv.sh #+BEGIN_SRC sh if [ -f .envrc-git-init ]; then source_env_if_exists .envrc-git-init || source .envrc-git-init @@ -35,6 +35,18 @@ if [ -f .envrc-nix ]; then fi #+END_SRC +** envrc :envrc: + +#+HEADER: :tangle ../.envrc +#+BEGIN_SRC sh +if [ -f .envrc-git-init ]; then + source_env_if_exists .envrc-git-init || source .envrc-git-init +fi +if [ -f .envrc-local ]; then + source_env_if_exists .envrc-local || source .envrc-local +fi +#+END_SRC + ** .envrc-nix - https://github.com/nix-community/nix-direnv @@ -55,12 +67,12 @@ watch_file flake.lock watch_file flake.nix watch_file shell.nix watch_file makefile -watch_file .envrc +watch_file nixDevEnv.sh watch_file .envrc-local watch_file .envrc-nix nix_direnv_watch_file flake.nix nix_direnv_watch_file shell.nix -nix_direnv_watch_file .envrc +nix_direnv_watch_file nixDevEnv.sh nix_direnv_watch_file .envrc-local nix_direnv_watch_file .envrc-nix nix flake update diff --git a/org/config_git.org b/org/config_git.org index b0596ac..5cf9f55 100644 --- a/org/config_git.org +++ b/org/config_git.org @@ -33,6 +33,7 @@ !nix/** !*.nix !flake.lock +!nixDevEnv.sh !.envrc !.envrc-nix !.envrc-git-init diff --git a/org/config_nix.org b/org/config_nix.org index 8ddb251..6ff0866 100644 --- a/org/config_nix.org +++ b/org/config_nix.org @@ -33,7 +33,7 @@ pname = "spine"; version = "<>"; shell = ./shell.nix; # ./default.nix; - devEnv = ./.envrc; # ./shell.nix; # ./default.nix; + devEnv = ./nixDevEnv.sh; # ./shell.nix; # ./default.nix; # ./.envrc; supportedSystems = ["x86_64-linux"]; # [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ]; forAllSystems = nixpkgs.lib.genAttrs supportedSystems; nixpkgsFor = forAllSystems (system: import nixpkgs {inherit system;}); # nixpkgs instantiated for supported system types diff --git a/org/nixpkgs_overlays_d_related.org b/org/nixpkgs_overlays_d_related.org index 6bd14f5..25a5f00 100644 --- a/org/nixpkgs_overlays_d_related.org +++ b/org/nixpkgs_overlays_d_related.org @@ -183,6 +183,7 @@ nix flake update && nix flake check --show-trace && nix flake info && echo "" && # find . -name "*.o" | xargs rm -rf ,* !.gitignore +!nixDevEnv.sh !.envrc !.envrc-local !.envrc-nix @@ -214,9 +215,9 @@ tmp/** #+END_SRC ** .env* -*** .envrc +*** nixDevEnv.sh (.envrc) -#+HEADER: :tangle-NO "../nix-overlays/.envrc" +#+HEADER: :tangle-NO "../nix-overlays/nixDevEnv.sh" #+BEGIN_SRC sh if [ -f .envrc-local ]; then source_env_if_exists .envrc-local || source .envrc-local @@ -272,12 +273,12 @@ watch_file flake.lock watch_file flake.nix watch_file shell.nix watch_file makefile -watch_file .envrc +watch_file nixDevEnv.sh watch_file .envrc-local watch_file .envrc-nix nix_direnv_watch_file flake.nix nix_direnv_watch_file shell.nix -nix_direnv_watch_file .envrc +nix_direnv_watch_file nixDevEnv.sh nix_direnv_watch_file .envrc-local nix_direnv_watch_file .envrc-nix nix flake update @@ -305,7 +306,7 @@ use flake . } @ inputs: let name = "dev-dub"; shell = ./shell.nix; - devEnv = ./.envrc; + devEnv = ./nixDevEnv.sh; # ./.envrc; supportedSystems = ["x86_64-linux"]; forAllSystems = nixpkgs.lib.genAttrs supportedSystems; nixpkgsFor = forAllSystems (system: import nixpkgs {inherit system;}); -- cgit v1.2.3