Skip to content

Commit

Permalink
try flake
Browse files Browse the repository at this point in the history
  • Loading branch information
jgoux committed Oct 24, 2023
1 parent 2139df8 commit 5fe9600
Show file tree
Hide file tree
Showing 6 changed files with 100 additions and 165 deletions.
12 changes: 10 additions & 2 deletions .envrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
source_url "https://raw.githubusercontent.com/cachix/devenv/d1f7b48e35e6dee421cfd0f51481d17f77586997/direnvrc" "sha256-YBzqskFZxmNb3kYVoKD9ZixoPXJh1C9ZvTLGFRkauZ0="
if ! has nix_direnv_version || ! nix_direnv_version 2.2.1; then
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/2.2.1/direnvrc" "sha256-zelF0vLbEl5uaqrfIzbgNzJWGmLzCmYAkInj/LNxvKs="
fi

use devenv
nix_direnv_watch_file devenv.nix
nix_direnv_watch_file devenv.lock
nix_direnv_watch_file devenv.yaml
if ! use flake . --impure
then
echo "devenv could not be built. The devenv environment was not loaded. Make the necessary changes to devenv.nix and hit enter to try again." >&2
fi
2 changes: 0 additions & 2 deletions .github/actions/devenv/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ runs:
steps:
- name: Install Nix
uses: nixbuild/nix-quick-install-action@v25
with:
load_nixConfig: false

- name: Restore and cache Nix store
uses: nix-community/cache-nix-action@v3
Expand Down
46 changes: 0 additions & 46 deletions devenv.nix

This file was deleted.

5 changes: 0 additions & 5 deletions devenv.yaml

This file was deleted.

125 changes: 15 additions & 110 deletions devenv.lock → flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

75 changes: 75 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
systems.url = "github:nix-systems/default";
devenv.url = "github:cachix/devenv/python-rewrite";
};

nixConfig = {
extra-trusted-public-keys = "devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw=";
extra-substituters = "https://devenv.cachix.org";
};

outputs = { self, nixpkgs, devenv, systems, ... } @ inputs:
let
forEachSystem = nixpkgs.lib.genAttrs (import systems);
in
{
devShells = forEachSystem
(system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
{
default = devenv.lib.mkShell {
inherit inputs pkgs;
modules = [
{
# https://devenv.sh/basics/
env.PLAYWRIGHT_BROWSERS_PATH="${pkgs.playwright-driver.browsers}";

# https://devenv.sh/packages/
packages = [
pkgs.infisical
pkgs.git
pkgs.playwright-driver
];

# https://devenv.sh/services/
services.postgres = {
enable = true;
package = pkgs.postgresql_16;
initialDatabases = [{ name = "acme"; }];
listen_addresses = "localhost";
port = 2345;
initialScript = ''
CREATE USER postgres SUPERUSER;
'';
};

# https://devenv.sh/scripts/
# scripts.hello.exec = "echo hello from $GREET";

# enterShell = ''
# hello
# git --version
# '';

# https://devenv.sh/languages/
languages.javascript.enable = true;
languages.javascript.package = pkgs.nodejs_18;
languages.javascript.corepack.enable = true;

# https://devenv.sh/pre-commit-hooks/
# pre-commit.hooks.shellcheck.enable = true;

# https://devenv.sh/processes/
# processes.ping.exec = "ping example.com";

# See full reference at https://devenv.sh/reference/options/
}
];
};
});
};
}

0 comments on commit 5fe9600

Please sign in to comment.