From f9be4ab4c1b364481d9f92dc6b5d3306206407c9 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sat, 4 Nov 2023 12:35:14 -0400 Subject: nix housekeeping --- .envrc | 3 +++ .envrc-git-init | 4 ++++ .envrc-local | 16 ---------------- .gitignore | 4 ++-- flake.lock | 6 +++--- flake.nix | 2 +- org/config_env.org | 48 ++++++++++++++++++++++++++++++++---------------- org/config_git.org | 4 ++-- org/config_nix.org | 2 +- 9 files changed, 48 insertions(+), 41 deletions(-) create mode 100644 .envrc-git-init delete mode 100644 .envrc-local diff --git a/.envrc b/.envrc index 6ad5fe2..669d42f 100644 --- a/.envrc +++ b/.envrc @@ -1,3 +1,6 @@ +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 diff --git a/.envrc-git-init b/.envrc-git-init new file mode 100644 index 0000000..ca74ec3 --- /dev/null +++ b/.envrc-git-init @@ -0,0 +1,4 @@ +if [[ ! -d ./.git ]]; then + git init + git add . +fi diff --git a/.envrc-local b/.envrc-local deleted file mode 100644 index d56ab09..0000000 --- a/.envrc-local +++ /dev/null @@ -1,16 +0,0 @@ -if [[ ! -d ./.git ]]; then - git init - git add . -fi -echo ' - .envrc-local echo ❯❯ - - ❯❯ nix flake update && nix flake check --show-trace && nix flake show && nix develop ".#devShell" -c $SHELL - - ❯❯ nix develop - ❯❯ nix develop -c $SHELL - ❯❯ nix develop ".#dsh-overlay-ldc" --print-build-logs - - ❯❯ nix build - ❯❯ nix build ".#default" --print-build-logs -' diff --git a/.gitignore b/.gitignore index 9655923..e96527f 100644 --- a/.gitignore +++ b/.gitignore @@ -10,8 +10,8 @@ !*.nix !flake.lock !.envrc -!.envrc-local !.envrc-nix +!.envrc-git-init !.env !.env/** !nix-overlays @@ -76,11 +76,11 @@ tmp/** *_.d *_.txt *_ +!.envrc-local_ *.swp *~ \#* *.\#* -!.envrc-local_ #!*/ #\#* #*.\#* diff --git a/flake.lock b/flake.lock index b44c226..5323aa3 100644 --- a/flake.lock +++ b/flake.lock @@ -20,11 +20,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1697009197, - "narHash": "sha256-viVRhBTFT8fPJTb1N3brQIpFZnttmwo3JVKNuWRVc3s=", + "lastModified": 1699094435, + "narHash": "sha256-YLZ5/KKZ1PyLrm2MO8UxRe4H3M0/oaYqNhSlq6FDeeA=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "01441e14af5e29c9d27ace398e6dd0b293e25a54", + "rev": "9d5d25bbfe8c0297ebe85324addcb5020ed1a454", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index c1ae2d9..cb23c0f 100644 --- a/flake.nix +++ b/flake.nix @@ -245,7 +245,7 @@ inherit shellHook; }; dsh-html = mkShell { - name = "spine dev shell for latex & pdf output"; + name = "spine dev shell for html output"; inherit shell; inherit devEnv; packages = [ diff --git a/org/config_env.org b/org/config_env.org index cfd636a..cb24dae 100644 --- a/org/config_env.org +++ b/org/config_env.org @@ -24,6 +24,9 @@ #+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 @@ -35,7 +38,9 @@ fi ** .envrc-nix - https://github.com/nix-community/nix-direnv - - source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/${NixDirEnvVersion}/direnvrc" "sha256-0000000000000000000000000000000000000000000=" + - source_url + - direnv fetchurl "https://raw.githubusercontent.com/nix-community/nix-direnv/<>/direnvrc" "<>" + - ${NixDirEnvVersion} #+HEADER: :tangle ../.envrc-nix #+BEGIN_SRC sh @@ -96,30 +101,20 @@ NixDirEnvSHA="sha256-0000000000000000000000000000000000000000000=" direnv fetchurl https://raw.githubusercontent.com/nix-community/nix-direnv/${NixDirEnvVersion}/direnvrc #+END_SRC -** .envrc-local CHECK MODIFY +** .envrc-git-init -- bespoke modify appropriately and generate if needed - -#+HEADER: :tangle ../.envrc-local +#+HEADER: :tangle ../.envrc-git-init #+HEADER: :noweb yes #+BEGIN_SRC sh if [[ ! -d ./.git ]]; then git init git add . fi -echo ' - .envrc-local echo ❯❯ - - ❯❯ nix flake update && nix flake check --show-trace && nix flake show && nix develop ".#devShell" -c $SHELL +#+END_SRC - ❯❯ nix develop - ❯❯ nix develop -c $SHELL - ❯❯ nix develop ".#dsh-overlay-ldc" --print-build-logs +** .envrc-local CHECK MODIFY - ❯❯ nix build - ❯❯ nix build ".#default" --print-build-logs -' -#+END_SRC +- bespoke modify appropriately and generate if needed #+HEADER: :tangle ../.envrc-local_ #+HEADER: :noweb yes @@ -141,6 +136,27 @@ export SpineDBpath=/var/www/sqlite #export SpineDBpath=/srv/www/spine/sqlite #+END_SRC +#+HEADER: :tangle-NO ../.envrc-local +#+HEADER: :noweb yes +#+BEGIN_SRC sh +if [[ ! -d ./.git ]]; then + git init + git add . +fi +echo ' + .envrc-local echo ❯❯ + + ❯❯ nix flake update && nix flake check --show-trace && nix flake show && nix develop ".#devShell" -c $SHELL + + ❯❯ nix develop + ❯❯ nix develop -c $SHELL + ❯❯ nix develop ".#dsh-overlay-ldc" --print-build-logs + + ❯❯ nix build + ❯❯ nix build ".#default" --print-build-logs +' +#+END_SRC + #+BEGIN_SRC sh #export NIX_PATH=/nix/var/nix/profiles/per-user/root/channels/nixos #export NIX_PATH=/srv/nix/nixpkgs diff --git a/org/config_git.org b/org/config_git.org index 671f42e..b0596ac 100644 --- a/org/config_git.org +++ b/org/config_git.org @@ -34,8 +34,8 @@ !*.nix !flake.lock !.envrc -!.envrc-local !.envrc-nix +!.envrc-git-init !.env !.env/** !nix-overlays @@ -100,11 +100,11 @@ tmp/** ,*_.d ,*_.txt ,*_ +!.envrc-local_ ,*.swp ,*~ \#* ,*.\#* -!.envrc-local_ #!*/ #\#* #*.\#* diff --git a/org/config_nix.org b/org/config_nix.org index 798d368..0cf55d3 100644 --- a/org/config_nix.org +++ b/org/config_nix.org @@ -268,7 +268,7 @@ inherit shellHook; }; dsh-html = mkShell { - name = "spine dev shell for latex & pdf output"; + name = "spine dev shell for html output"; inherit shell; inherit devEnv; packages = [ -- cgit v1.2.3