Skip to content

Commit

Permalink
Merge pull request #108 from akirak/flake-parts
Browse files Browse the repository at this point in the history
Add flake-parts
  • Loading branch information
akirak authored Nov 13, 2024
2 parents dd52663 + c1ba1a9 commit 217914b
Show file tree
Hide file tree
Showing 4 changed files with 96 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/check-flake-parts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Check flake-parts

on:
push:
paths:
# Set this to the directory of the template
- flake-parts/**
- .github/workflows/check-flake-parts.yml
workflow_dispatch:
workflow_call:

concurrency:
group: check-flake-parts-${{ github.ref }}
cancel-in-progress: true

jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: cachix/install-nix-action@v30
with:
extra_nix_config: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v4
with:
path: ./tmp
- run: nix flake new -t ./tmp#flake-parts ./work
- name: Prepare the project
working-directory: work
run: |
git init
git add .
- run: nix flake show
working-directory: work
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,18 @@ provide multiple types of outputs from your flake:
nix flake init -t github:akirak/flake-templates#flake-utils
```

### [flake-parts](flake-parts/flake.nix)

This is a boilerplate based on [flake-parts](https://flake.parts/).

``` bash
nix flake init -t github:akirak/flake-templates#flake-parts
```

It contains a stub for
[partitions](https://flake.parts/options/flake-parts-partitions) which is
commented out by default.

### [pre-commit](pre-commit/flake.nix)

This is a basic project boilerplate with
Expand Down
44 changes: 44 additions & 0 deletions flake-parts/flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-parts.url = "github:hercules-ci/flake-parts";
systems.url = "github:nix-systems/default";
# treefmt-nix.url = "github:numtide/treefmt-nix";
};

outputs =
inputs@{ flake-parts, ... }:
flake-parts.lib.mkFlake { inherit inputs; } {
systems = import inputs.systems;

imports = [
# inputs.flake-parts.flakeModules.partitions
# inputs.treefmt-nix.flakeModule
];

# partitions.dev = {
# extraInputsFlake = ./dev;
# module = {
# imports = [ ./dev/flake-module.nix ];
# };
# };

# partitionedAttrs = {
# checks = "dev";
# devShells = "dev";
# };

perSystem =
{
system,
pkgs,
inputs',
...
}:
{
# You can use `extend' to extend the packages with an overlay (or use
# `import inputs.nixpkgs { ... }`).
_module.args.pkgs = inputs'.nixpkgs.legacyPackages;
};
};
}
4 changes: 4 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
path = ./flake-utils;
description = "A basic boilerplate with flake-utils";
};
flake-parts = {
path = ./flake-parts;
description = "A minimal boilerplate for the root flake";
};
pre-commit = {
path = ./pre-commit;
description = "Basic flake with pre-commit check";
Expand Down

0 comments on commit 217914b

Please sign in to comment.