Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Extract default devshell to devenv.nix #42

Merged
merged 15 commits into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .envrc
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
use flake
source_url "https://raw.githubusercontent.com/cachix/devenv/d1f7b48e35e6dee421cfd0f51481d17f77586997/direnvrc" "sha256-YBzqskFZxmNb3kYVoKD9ZixoPXJh1C9ZvTLGFRkauZ0="

use devenv
17 changes: 17 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,22 @@ concurrency:
cancel-in-progress: true

jobs:
check:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Nix
uses: cachix/install-nix-action@v26
- name: Setup Cachix
uses: cachix/cachix-action@v14
with:
name: devenv
- name: Install devenv
run: nix-env -if https://install.devenv.sh/latest
- name: Run tests
run: devenv test

build:
strategy:
matrix:
Expand All @@ -20,6 +36,7 @@ jobs:
- ubuntu-latest
fail-fast: false
runs-on: ${{ matrix.os }}
needs: [check]
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
with:
ref: ${{ github.ref_name }}
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v9
uses: cachix/install-nix-action@v26
- name: Publish flake
uses: DeterminateSystems/flakehub-push@v3
with:
Expand Down
14 changes: 8 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v9
- name: Install tools via Nix
run: nix develop --check
- name: Install dependencies
run: nix develop -c npm ci
uses: cachix/install-nix-action@v26
- name: Setup Cachix
uses: cachix/cachix-action@v14
with:
name: devenv
- name: Install devenv
run: nix-env -if https://install.devenv.sh/latest
- name: Run semantic-release
run: nix develop -c npx semantic-release
run: devenv shell semantic-release
env:
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
14 changes: 9 additions & 5 deletions .github/workflows/update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,23 @@ jobs:
with:
ref: main
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v9
- name: Install tools via Nix
run: nix develop --impure --check
uses: cachix/install-nix-action@v26
- name: Setup Cachix
uses: cachix/cachix-action@v14
with:
name: devenv
- name: Install devenv
run: nix-env -if https://install.devenv.sh/latest
- name: Update versions
run: nix develop --impure --command python3 update-versions.py
run: devenv shell update-versions
env:
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
- name: Create pull request
uses: peter-evans/create-pull-request@v6
with:
author: GitHub <noreply@github.com>
commit-message: Update Terraform versions
title: "feat: Update Terraform versions"
title: "feat: Update Terraform versions"
body: |
Automatically created pull-request to update Terraform versions.

Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
.devenv
.devenv.flake.nix
.direnv
.env
.pre-commit-config.yaml
node_modules
result
templates/*/flake.lock
156 changes: 156 additions & 0 deletions devenv.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
{
"nodes": {
"devenv": {
"locked": {
"dir": "src/modules",
"lastModified": 1711019207,
"owner": "cachix",
"repo": "devenv",
"rev": "a7ba6766c0cc351b8656c63560c6b19c3788455f",
"treeHash": "5e0e1857cc23f45d07920937aa6589b97e4d0864",
"type": "github"
},
"original": {
"dir": "src/modules",
"owner": "cachix",
"repo": "devenv",
"type": "github"
}
},
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1696426674,
"owner": "edolstra",
"repo": "flake-compat",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"treeHash": "2addb7b71a20a25ea74feeaf5c2f6a6b30898ecb",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1710146030,
"owner": "numtide",
"repo": "flake-utils",
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
"treeHash": "bd263f021e345cb4a39d80c126ab650bebc3c10c",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"gitignore": {
"inputs": {
"nixpkgs": [
"pre-commit-hooks",
"nixpkgs"
]
},
"locked": {
"lastModified": 1709087332,
"owner": "hercules-ci",
"repo": "gitignore.nix",
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
"treeHash": "ca14199cabdfe1a06a7b1654c76ed49100a689f9",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "gitignore.nix",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1710796454,
"owner": "cachix",
"repo": "devenv-nixpkgs",
"rev": "06fb0f1c643aee3ae6838dda3b37ef0abc3c763b",
"treeHash": "9bb13f7f39e825a5d91bbe4139fbc129243b907d",
"type": "github"
},
"original": {
"owner": "cachix",
"ref": "rolling",
"repo": "devenv-nixpkgs",
"type": "github"
}
},
"nixpkgs-stable": {
"locked": {
"lastModified": 1710951922,
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "f091af045dff8347d66d186a62d42aceff159456",
"treeHash": "46b3620ce937feaa05c3d0b4e91bd003985947ee",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-23.11",
"repo": "nixpkgs",
"type": "github"
}
},
"pre-commit-hooks": {
"inputs": {
"flake-compat": "flake-compat",
"flake-utils": "flake-utils",
"gitignore": "gitignore",
"nixpkgs": [
"nixpkgs"
],
"nixpkgs-stable": "nixpkgs-stable"
},
"locked": {
"lastModified": 1710923068,
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"rev": "e611897ddfdde3ed3eaac4758635d7177ff78673",
"treeHash": "d7cff0ca3e7cdccd8ea9ef00f8534ef6b425cfc6",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"type": "github"
}
},
"root": {
"inputs": {
"devenv": "devenv",
"nixpkgs": "nixpkgs",
"pre-commit-hooks": "pre-commit-hooks"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"treeHash": "cce81f2a0f0743b2eb61bc2eb6c7adbe2f2c6beb",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",
"version": 7
}
24 changes: 24 additions & 0 deletions devenv.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{ pkgs, ... }:

{
packages = [
pkgs.nix-prefetch
pkgs.semantic-release
];

scripts.update-versions.exec =
let
python = pkgs.python3.withPackages (ps: [
ps.pygithub
ps.semver
]);
in
''
${python}/bin/python update-versions.py
'';

pre-commit.hooks.black.enable = true;
pre-commit.hooks.nixpkgs-fmt.enable = true;

# See full reference at https://devenv.sh/reference/options/
sestrella marked this conversation as resolved.
Show resolved Hide resolved
}
14 changes: 14 additions & 0 deletions devenv.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
inputs:
nixpkgs:
url: github:cachix/devenv-nixpkgs/rolling

# If you're using non-OSS software, you can set allowUnfree to true.
# allowUnfree: true

# If you're willing to use a package that's vulnerable
# permittedInsecurePackages:
# - "openssl-1.1.1w"

# If you have more than one devenv you can merge them
#imports:
# - ./backend
sestrella marked this conversation as resolved.
Show resolved Hide resolved
13 changes: 0 additions & 13 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,6 @@
overlayAttrs = {
terraform-versions = config.packages;
};

devShells.default = pkgs.mkShell {
buildInputs = [
pkgs-unstable.black
(pkgs-unstable.python3.withPackages (ps: [
ps.pygithub
ps.semver
]))
pkgs-unstable.nix-prefetch
pkgs.nodejs
pkgs.rubyPackages.dotenv
];
};
};

flake = {
Expand Down
Loading
Loading