Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
0345b84
add empty template
maxheld83 Mar 6, 2025
5dcd15a
add boilerplate for testing
maxheld83 Mar 6, 2025
627d690
improve nesting
maxheld83 Mar 6, 2025
90f5e8c
bump up flake
maxheld83 Mar 10, 2025
25805c2
go back to old systems
maxheld83 Mar 10, 2025
c132dd5
disable nix-unit inputs
maxheld83 Mar 10, 2025
7e65b72
disable unit test
maxheld83 Mar 10, 2025
2eca22a
remove, not comment out nix-unit
maxheld83 Mar 10, 2025
8e4f2e7
remove all the nix-unit tests
maxheld83 Mar 10, 2025
1d2e017
remove unit test from lock file
maxheld83 Mar 10, 2025
1364bff
change order again
maxheld83 Mar 10, 2025
93ab1fa
add sorting comments again
maxheld83 Mar 10, 2025
9a6b882
add nix-unit as a dep again
maxheld83 Mar 10, 2025
63eeb03
pin nix-unit
maxheld83 Mar 10, 2025
0a94852
add test boilerplate
maxheld83 Mar 10, 2025
6428711
try with vanilla unit test
maxheld83 Mar 11, 2025
096d4a6
go back to full version
maxheld83 Mar 11, 2025
ef589e1
only run on mac
maxheld83 Mar 11, 2025
7529559
add arch linux
maxheld83 Mar 11, 2025
4b51b65
fix order
maxheld83 Mar 11, 2025
2ebc315
try other two systems
maxheld83 Mar 11, 2025
cb0fef8
add all systems again
maxheld83 Mar 11, 2025
0e5944b
try only breaking linux
maxheld83 Mar 11, 2025
e372b3d
try with unstable
maxheld83 Mar 11, 2025
86715d4
try main flake-parts
maxheld83 Mar 11, 2025
211b4d2
Revert "try main flake-parts"
maxheld83 Mar 11, 2025
fea38cf
bump up lock file
maxheld83 Mar 11, 2025
163adfc
use main nix-unit
maxheld83 Mar 11, 2025
557803e
use last tagged nix-unit
maxheld83 Mar 11, 2025
f6fe2d3
use only some systems
maxheld83 Mar 11, 2025
d75d037
use nixpkgs from flakehub
maxheld83 Mar 11, 2025
fb7f205
remove bad system
maxheld83 Mar 11, 2025
2e049a6
bump up lock file
maxheld83 Mar 11, 2025
3936825
try all systems with agnostic test
maxheld83 Mar 11, 2025
51b3e81
remove linux systems
maxheld83 Mar 11, 2025
fc9993c
fix treefmt issue
maxheld83 Mar 13, 2025
1cc57f4
fix lint
maxheld83 Mar 13, 2025
657ae83
run on all systems
maxheld83 Mar 13, 2025
544292d
fix path
maxheld83 Mar 17, 2025
f89fead
document template setup
maxheld83 Mar 18, 2025
ed67292
bump up versions
maxheld83 Mar 18, 2025
224e729
add more files to template
maxheld83 Mar 18, 2025
fd1a3f4
fix path
maxheld83 Mar 18, 2025
57675d4
fix formatting
maxheld83 Mar 18, 2025
e8ec7f8
add boilerplate test for template
maxheld83 Mar 18, 2025
742415a
Merge branch 'main' into add-template2
maxheld83 Mar 18, 2025
f4b0aed
also add ci yaml
maxheld83 Mar 19, 2025
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
6 changes: 0 additions & 6 deletions .envrc

This file was deleted.

1 change: 1 addition & 0 deletions .envrc
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ concurrency:
cancel-in-progress: true
jobs:
DeterminateCI:
uses: DeterminateSystems/ci/.github/workflows/workflow.yml@main
uses: dataheld/ci/.github/workflows/workflow.yml@pass-thru-failearly
permissions:
id-token: "write"
contents: "read"
Expand Down
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,28 @@ extra-[DRY](https://en.wikipedia.org/wiki/Don%27t_repeat_yourself) 🤌
## Installing

> \[!NOTE\]
> This is not another flake or development framework.
> It is much less; just the set of composable nix flakes and modules that I use for my projects.

> \[!TIP\]
> This is the software you need to have on your _system_.
> All project-specific software is handled automatically.

1. Install Nix (the package manager).
The [Determinate Nix Installer](https://github.com/DeterminateSystems/nix-installer) is recommended.

1. Install [direnv](https://direnv.net).

1. (optional) Install
[nix-direnv](https://github.com/nix-community/nix-direnv)
for better performance during development.
1. (if not already done) Clone the repo

1. Add the necessary boilerplate files.

```sh
nix flake init --template "https://flakehub.com/f/dataheld/nullkomma/0.1.*#default"
```

1. (one-time only) Inside the repo, run `direnv allow`

> \[!TIP\]
Expand Down
99 changes: 77 additions & 22 deletions flake.lock

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

149 changes: 101 additions & 48 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,69 +7,122 @@
fh.url = "https://flakehub.com/f/DeterminateSystems/fh/0.1.*";
flake-checker.url = "https://flakehub.com/f/DeterminateSystems/flake-checker/0.2.*";
flake-iter.url = "https://flakehub.com/f/DeterminateSystems/flake-iter/0.1.*";
flake-parts.url = "https://flakehub.com/f/hercules-ci/flake-parts/0.1.*";
# keep-sorted end
flake-parts = {
inputs.nixpkgs-lib.follows = "nixpkgs";
url = "https://flakehub.com/f/hercules-ci/flake-parts/0.1.*";
};
flake-schemas.url = "https://flakehub.com/f/DeterminateSystems/flake-schemas/0.1.*";
nix-unit = {
url = "github:nix-community/nix-unit/?tag=v2.24.1";
inputs = {
flake-parts.follows = "flake-parts";
nixpkgs.follows = "nixpkgs";
};
};
treefmt-nix.url = "github:numtide/treefmt-nix/3d0579f5cc93436052d94b73925b48973a104204";
# keep-sorted end
};

outputs = {flake-parts, ...} @ inputs:
flake-parts.lib.mkFlake {inherit inputs;} {
outputs =
{ flake-parts, self, ... }@inputs:
flake-parts.lib.mkFlake { inherit inputs; } {
imports = [
# keep-sorted start
inputs.nix-unit.modules.flake.default
inputs.treefmt-nix.flakeModule
# keep-sorted end
];
systems = [
"x86_64-linux"
"aarch64-linux"
# keep-sorted start
"aarch64-darwin"
"aarch64-linux"
"x86_64-darwin"
"x86_64-linux"
# keep-sorted end
];
perSystem = {
inputs',
pkgs,
self',
...
}: {
devShells.default = pkgs.mkShell {
packages = [
# keep-sorted start
inputs'.fh.packages.default
inputs'.flake-checker.packages.default
inputs'.flake-iter.packages.default
pkgs.git
pkgs.gnumake
pkgs.nixd
self'.formatter
# keep-sorted end
];
};
treefmt = {
programs = {
# keep-sorted start
actionlint.enable = true;
alejandra.enable = true;
beautysh.enable = true;
black.enable = true;
cmake-format.enable = true;
deadnix.enable = true;
hclfmt.enable = true;
isort.enable = true;
jsonfmt.enable = true;
keep-sorted.enable = true;
mdformat.enable = true;
prettier.enable = true;
shellcheck.enable = true;
shfmt.enable = true;
sqlfluff.enable = true;
toml-sort.enable = true;
yamlfmt.enable = true;
# keep-sorted end
perSystem =
{
inputs',
pkgs,
self',
...
}:
{
devShells.default = pkgs.mkShell {
packages = [
# keep-sorted start
inputs'.fh.packages.default
inputs'.flake-checker.packages.default
inputs'.flake-iter.packages.default
pkgs.git
pkgs.gnumake
pkgs.nixd
self'.formatter
# keep-sorted end
];
};
treefmt = {
programs = {
# keep-sorted start
actionlint.enable = true;
beautysh.enable = true;
black.enable = true;
cmake-format.enable = true;
deadnix.enable = true;
hclfmt.enable = true;
isort.enable = true;
jsonfmt.enable = true;
keep-sorted.enable = true;
mdformat.enable = true;
nixfmt.enable = true;
prettier.enable = true;
shellcheck.enable = true;
shfmt.enable = true;
sqlfluff.enable = true;
toml-sort.enable = true;
yamlfmt.enable = true;
# keep-sorted end
};
};
nix-unit = {
inputs = {
inherit (inputs)
nixpkgs
flake-parts
nix-unit
treefmt-nix
;
};
tests = {
"test example system-specific" = {
expr = "1";
expected = "1";
};
};
};
};
packages.default = pkgs.hello;
};
flake = {
schemas = inputs.flake-schemas.schemas;
templates = rec {
base = {
description = "nullkomma template";
path = ./templates/base;
welcomeText = ''
Welcome to the nullkomma template
'';
};
default = base;
};
tests = {
"test example system-agnostic" = {
expr = "2";
expected = "2";
};
"test template welcome text" = {
expr = self.templates.default.description;
expected = "nullkomma template";
};
};
};
};
}
6 changes: 6 additions & 0 deletions templates/base/.envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

if ! has nix_direnv_version || ! nix_direnv_version 3.0.6; then
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/3.0.6/direnvrc" "sha256-RYcUJaRMf8oF5LznDrlCXbkOQrywm0HDv1VjYGaJGdM="
fi
use flake
22 changes: 22 additions & 0 deletions templates/base/.github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: CI
on:
pull_request:
workflow_dispatch:
push:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
DeterminateCI:
uses: DeterminateSystems/ci/.github/workflows/workflow.yml@main
permissions:
id-token: "write"
contents: "read"
with:
visibility: public
flake-checker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check Nix flake Nixpkgs inputs
uses: DeterminateSystems/flake-checker-action@v9
Loading