Thanks to visit codestin.com
Credit goes to github.com

Skip to content

SharzyL/flakae

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Flakae

A set of project templates for Nix-powered development. Aiming to align with latest best practices in an opinionated way.

This project includes a collection of flake.nix templates for projects of different languages. Each playground provides

  • nix develop for development environment.
  • nix build for production build and packaging.
  • nix fmt for code formatting.

Recommended to be used with direnv and nix-direnv.

Usage

$ nix flake init --template github:SharzyL/flakae#cpp_cmake

or

$ nix flake new --template github:SharzyL/flakae#cpp_cmake ./cpp_cmake

Replace cpp_cmake with the desired template name, which is a directory name in this project root.

Developer Notes

To synchronize nixpkgs to the system version (as in ~/.config/nix/registry.json):

./bump.sh

Git Hooks Example

Pre-commit hook that performs format checks

#!/usr/bin/env bash

set -euo pipefail

nix fmt -- --fail-on-change

Pre-commit hook that performs flake checks

#!/usr/bin/env bash

set -euo pipefail

nix flake check

GitHub CI Workflow Example

name: Nix Flake Check

on:
  push:
    branches: [ goshujin ]
  pull_request:
    branches: [ goshujin ]

jobs:
  nix-build:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout repository
        uses: actions/checkout@v5

      - name: Install Nix
        uses: cachix/install-nix-action@v31

      - name: Check Nix flake
        run: |
          nix build
          nix flake check

About

A collection of nix templates

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published