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

Prefer Nix flake style #255

Merged
merged 5 commits into from
Aug 6, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
3 changes: 2 additions & 1 deletion .envrc
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
use_nix
#!/bin/bash

use flake
2 changes: 0 additions & 2 deletions .github/workflows/ci-home.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ jobs:
steps:
- uses: DeterminateSystems/nix-installer-action@v4
- uses: DeterminateSystems/magic-nix-cache-action@v2
- name: Print nixpkgs version
run: nix-instantiate --eval -E '(import <nixpkgs> {}).lib.version'
- name: Register Nix Channels
run: |
nix-channel --add https://releases.nixos.org/nixpkgs/nixpkgs-23.11pre509044.3acb5c4264c4/nixexprs.tar.xz nixpkgs
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/ci-nix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ on:
paths:
- '.github/workflows/ci-nix.yml'
- '*.nix'
- 'flake.*'
- 'Makefile.toml'
pull_request:
paths:
- '.github/workflows/ci-nix.yml'
- '*.nix'
- 'flake.*'
- 'Makefile.toml'
schedule:
# Every 10:42 JST
Expand All @@ -25,5 +27,5 @@ jobs:
- uses: actions/checkout@v3
- uses: DeterminateSystems/nix-installer-action@v4
- uses: DeterminateSystems/magic-nix-cache-action@v2
- run: nix-shell --run 'echo This step should be done before any other "nix-shell" steps because of measuring Nix build time'
- run: nix-shell --run 'makers ci-dev'
- run: nix develop --command echo 'This step should be done before any other "nix develop" steps because of measuring Nix build time'
- run: nix develop --command makers ci-dev
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Development

1. Install [Nix](https://nixos.org/) package manager
1. `nix-shell --command 'makers setup'`
1. `nix develop --command makers setup`
- `direnv allow` may not work if you have not completed all the installation steps

## Note
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Also known as [盆栽(bonsai)](https://en.wikipedia.org/wiki/Bonsai) 🌳

1. Install [Nix](https://nixos.org/) package manager
1. Install [home-manager](https://github.com/nix-community/home-manager)
1. `nix-shell --command 'makers apply'`
1. `nix develop --command makers apply`

## I don't know ??? - I have just installed OS, I am 🚼

Expand Down
27 changes: 0 additions & 27 deletions default.nix

This file was deleted.

56 changes: 56 additions & 0 deletions flake.lock

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

43 changes: 43 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
inputs = {
# Candidate channels
# - https://github.com/kachick/anylang-template/issues/17
# - https://discourse.nixos.org/t/differences-between-nix-channels/13998
# How to update the revision
# - `nix flake update --commit-lock-file` # https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-flake-update.html
# TODO: Refer a popular channel in another issues
# nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
nixpkgs.url = "https://releases.nixos.org/nixpkgs/nixpkgs-23.11pre509044.3acb5c4264c4/nixexprs.tar.xz";
flake-utils.url = "github:numtide/flake-utils";
};

outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
{
devShells.default = with pkgs;
mkShell {
buildInputs = [
# https://github.com/NixOS/nix/issues/730#issuecomment-162323824
bashInteractive

dprint
shellcheck
shfmt
nil
nixpkgs-fmt
gitleaks
cargo-make
typos
go_1_20

# To get sha256 around pkgs.fetchFromGitHub in CLI
nix-prefetch-git
jq
];
};
}
);
}