-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add nix/nixos development enviroment and automation for easy maintenance
make flake check action check all systems added assignment to assign myself to flake update prs. fix actions to use determinsys switch nix formatting check to flake check fix formatting for nix
- Loading branch information
1 parent
fe728a9
commit 3688d11
Showing
7 changed files
with
240 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
use flake |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: Run nix checks on prs | ||
|
||
on: | ||
pull_request: | ||
branches: [ "master", "rewrite/v3" ] | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
jobs: | ||
check: | ||
name: Check Nix | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, macos-latest] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Install Nix | ||
uses: DeterminateSystems/nix-installer-action@main | ||
- uses: DeterminateSystems/magic-nix-cache-action@main | ||
Check warning on line 22 in .github/workflows/nix-check.yml GitHub Actions / Check Nix (ubuntu-latest)Magic Nix Cache is deprecated
Check warning on line 22 in .github/workflows/nix-check.yml GitHub Actions / Check Nix (macos-latest)Magic Nix Cache is deprecated
|
||
- name: Check flake.lock | ||
uses: DeterminateSystems/flake-checker-action@main | ||
with: | ||
fail-mode: true | ||
- name: Check Nix formatting | ||
run: nix flake check |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: update-flake-lock | ||
on: | ||
workflow_dispatch: # allows manual triggering | ||
schedule: | ||
- cron: '0 0 * * 0' # runs weekly on Sunday at 00:00 | ||
|
||
permissions: | ||
contents: write | ||
pull-requests: write | ||
|
||
jobs: | ||
lockfile: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: DeterminateSystems/nix-installer-action@main | ||
- uses: DeterminateSystems/magic-nix-cache-action@main | ||
Check warning on line 17 in .github/workflows/update-nix.yml GitHub Actions / Check Nix (ubuntu-latest)Magic Nix Cache is deprecated
Check warning on line 17 in .github/workflows/update-nix.yml GitHub Actions / Check Nix (macos-latest)Magic Nix Cache is deprecated
|
||
- uses: DeterminateSystems/update-flake-lock@main | ||
with: | ||
pr-title: "Update flake.lock" | ||
pr-assignees: eveeifyeve |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,3 +12,7 @@ config.toml | |
.etc/blocks.json | ||
|
||
flame.svg | ||
|
||
.direnv | ||
result | ||
result-* |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
{ | ||
inputs = { | ||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; | ||
flake-parts.url = "github:hercules-ci/flake-parts"; | ||
flake-compat = { | ||
url = "github:edolstra/flake-compat"; | ||
flake = false; | ||
}; | ||
rust-overlay = { | ||
url = "github:oxalica/rust-overlay"; | ||
inputs.nixpkgs.follows = "nixpkgs"; | ||
}; | ||
}; | ||
|
||
outputs = | ||
inputs@{ | ||
flake-parts, | ||
nixpkgs, | ||
rust-overlay, | ||
... | ||
}: | ||
flake-parts.lib.mkFlake { inherit inputs; } { | ||
systems = nixpkgs.lib.systems.flakeExposed; | ||
|
||
perSystem = | ||
{ | ||
pkgs, | ||
system, | ||
... | ||
}: | ||
{ | ||
formatter = nixpkgs.legacyPackages.${system}.nixfmt-rfc-style; | ||
_module.args.pkgs = import inputs.nixpkgs { | ||
inherit system; | ||
overlays = [ | ||
rust-overlay.overlays.default | ||
(self: super: { | ||
rustToolchain = | ||
let | ||
rust = super.rust-bin; | ||
in | ||
if builtins.pathExists ./rust-toolchain.toml then | ||
rust.fromRustupToolchainFile ./rust-toolchain.toml | ||
else if builtins.pathExists ./rust-toolchain then | ||
rust.fromRustupToolchainFile ./rust-toolchain | ||
else | ||
rust.nightly.latest.default; | ||
}) | ||
]; | ||
config = { }; | ||
}; | ||
|
||
# Used to check formatting for nix specificly | ||
checks.fmt-check = | ||
pkgs.runCommand "format-check" | ||
{ | ||
src = ./.; | ||
doCheck = true; | ||
nativeBuildInputs = [ | ||
pkgs.nixfmt-rfc-style | ||
]; | ||
} | ||
'' | ||
nixfmt --check . | ||
touch $out | ||
''; | ||
|
||
devShells.default = pkgs.mkShell { | ||
packages = with pkgs; [ | ||
rustToolchain | ||
pkg-config | ||
openssl | ||
]; | ||
}; | ||
|
||
}; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
(import ( | ||
let | ||
lock = builtins.fromJSON (builtins.readFile ./flake.lock); | ||
nodeName = lock.nodes.root.inputs.flake-compat; | ||
in | ||
fetchTarball { | ||
url = | ||
lock.nodes.${nodeName}.locked.url | ||
or "https://github.com/edolstra/flake-compat/archive/${lock.nodes.${nodeName}.locked.rev}.tar.gz"; | ||
sha256 = lock.nodes.${nodeName}.locked.narHash; | ||
} | ||
) { src = ./.; }).shellNix |