Skip to content

Commit

Permalink
Add devenv template
Browse files Browse the repository at this point in the history
  • Loading branch information
sestrella committed Nov 14, 2023
1 parent efc09b7 commit 2b01926
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 10 deletions.
21 changes: 11 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,14 @@ concurrency:
cancel-in-progress: true

jobs:
test:
if: false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v23
- run: nix eval --impure .#tests
working-directory: tests

templates:
strategy:
matrix:
template:
- name: default
command: python --version

- name: devenv
command: python --version
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -34,3 +26,12 @@ jobs:
working-directory: ${{ steps.mktemp.outputs.tmpdir }}
- run: nix develop --accept-flake-config -c ${{ matrix.template.command }}
working-directory: ${{ steps.mktemp.outputs.tmpdir }}

test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v23
- run: nix eval --impure .#tests
working-directory: tests

1 change: 1 addition & 0 deletions templates/devenv/.tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
python 3.12.0
38 changes: 38 additions & 0 deletions templates/devenv/flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
inputs = {
asdf2nix-python.url = "github:sestrella/asdf2nix?dir=plugins/python";
asdf2nix.url = "github:sestrella/asdf2nix";
devenv.url = "github:cachix/devenv";
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
};

nixConfig = {
extra-substituters = "https://cache.nixos.org https://nixpkgs-python.cachix.org";
extra-trusted-public-keys = "nixpkgs-python.cachix.org-1:hxjI7pFxTyuTHn2NkvWCrAUcNZLNS3ZAvfYNuYifcEU=";
};

outputs = inputs@{ self, asdf2nix-python, asdf2nix, devenv, flake-utils, nixpkgs }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
packages = asdf2nix.lib.packagesFromVersionsFile {
inherit system;
versionsFile = ./.tool-versions;
plugins = {
python = asdf2nix-python.lib;
};
};
in
{
devShells.default = devenv.lib.mkShell {
inherit inputs pkgs;
modules = [
({ pkgs, config, ... }: {
languages.python.enable = true;
languages.python.package = packages.python;
})
];
};
});
}

0 comments on commit 2b01926

Please sign in to comment.