diff --git a/.envrc b/.envrc index 24f0da1..11b05b8 100644 --- a/.envrc +++ b/.envrc @@ -1,4 +1,4 @@ # reload when these files change -watch_file shell.nix - -use nix +export TRITON_DONT_SOURCE_PROFILE=1 +watch_file flake.nix +use_flake diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..f2fa416 --- /dev/null +++ b/flake.lock @@ -0,0 +1,95 @@ +{ + "nodes": { + "devshell": { + "inputs": { + "flake-utils": [ + "flake-utils" + ], + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1663445644, + "narHash": "sha256-+xVlcK60x7VY1vRJbNUEAHi17ZuoQxAIH4S4iUFUGBA=", + "owner": "numtide", + "repo": "devshell", + "rev": "e3dc3e21594fe07bdb24bdf1c8657acaa4cb8f66", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "devshell", + "type": "github" + } + }, + "flake-utils": { + "locked": { + "lastModified": 1659877975, + "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1665449268, + "narHash": "sha256-cw4xrQIAZUyJGj58Dp5VLICI0rscd+uap83afiFzlcA=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "285e77efe87df64105ec14b204de6636fb0a7a27", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "devshell": "devshell", + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs", + "tritonshell-module": "tritonshell-module" + } + }, + "tritonshell-module": { + "inputs": { + "devshell": [ + "devshell" + ], + "flake-utils": [ + "flake-utils" + ], + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1665580466, + "narHash": "sha256-q8kVIE3XaOSCVl7oqkaKs2LDEbBcZRIzlnSG8PIKRQ0=", + "ref": "main", + "rev": "70d759b6d8b5e076bee6a28255614ab3d75f6763", + "revCount": 49, + "type": "git", + "url": "https://git.greenbaum.cloud/dev/tritonshell" + }, + "original": { + "ref": "main", + "type": "git", + "url": "https://git.greenbaum.cloud/dev/tritonshell" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..489875a --- /dev/null +++ b/flake.nix @@ -0,0 +1,60 @@ +{ + description = "devs & ops environment for nix'ing with triton"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + + flake-utils.url = "github:numtide/flake-utils"; + + devshell.url = "github:numtide/devshell"; + devshell.inputs.flake-utils.follows = "flake-utils"; + devshell.inputs.nixpkgs.follows = "nixpkgs"; + + tritonshell-module.url = "git+https://git.greenbaum.cloud/dev/tritonshell?ref=main"; + tritonshell-module.inputs.devshell.follows = "devshell"; + tritonshell-module.inputs.flake-utils.follows = "flake-utils"; + tritonshell-module.inputs.nixpkgs.follows = "nixpkgs"; + }; + + outputs = { self, flake-utils, devshell, tritonshell-module, nixpkgs }: + flake-utils.lib.simpleFlake { + inherit self nixpkgs; + name = "infra-project"; + preOverlays = [ devshell.overlay ]; + shell = { pkgs }: + let + google-font-downloader = pkgs.writeShellScriptBin "google-font-downloader" '' + echo "Attempting to fetch $1" + ${pkgs.nodejs}/bin/npx google-font-downloader -- $1 + rm ./_includes/styles/typography.css + echo "/* To regenerate this file, run $ google-font-downloader '$1' */" >> ./_includes/styles/typography.css + echo "" >> ./_includes/styles/typography.css + cat ./google-fonts-*.css >> ./_includes/styles/typography.css + rm ./google-fonts-*.css + ''; + in + pkgs.devshell.mkShell { + imports = [ tritonshell-module.devshellModules.x86_64-linux.tritonshell ]; + # Now the tritonshell environment nix module options are available + environment = { + enable = true; + # CUSTOMIZE if desired, default options are: + #cnsBaseDomain = "greenbaum.zone"; + #dataCenters = [ "cgn-1" "lev-1" ]; + #mantaDomain = "eu-central.manta.greenbaum.cloud"; + #tritonApiDomain = "api.greenbaum.cloud"; + }; + + # Add additional packages you'd like to be available in your devshell + # PATH here + devshell.packages = with pkgs; [ + deno + google-font-downloader + ]; + bash.extra = '' + export NVIM_USE_DENOLS=1 + deno run -Ar https://deno.land/x/lume@v1.12.1/init.ts + ''; + }; + }; +} diff --git a/shell.nix b/shell.nix deleted file mode 100644 index c8ec7dc..0000000 --- a/shell.nix +++ /dev/null @@ -1,22 +0,0 @@ -with (import (fetchTarball https://github.com/nixos/nixpkgs/archive/nixpkgs-unstable.tar.gz) {}); -let - google-font-downloader = writeShellScriptBin "google-font-downloader" '' - echo "Attempting to fetch $1" - ${nodejs}/bin/npx google-font-downloader -- $1 - rm ./_includes/styles/typography.css - echo "/* To regenerate this file, run $ google-font-downloader '$1' */" >> ./_includes/styles/typography.css - echo "" >> ./_includes/styles/typography.css - cat ./google-fonts-*.css >> ./_includes/styles/typography.css - rm ./google-fonts-*.css - ''; -in -mkShell { - buildInputs = [ - deno - google-font-downloader - ]; - - shellHook = '' - deno run -A https://deno.land/x/lume@v1.12.0/install.ts - ''; -}