-
-
Notifications
You must be signed in to change notification settings - Fork 85
Add a clean nix/nixos development enviroment #163
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
Closed
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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/flakehub-cache-action@main | ||
| - 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 hidden or 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/flakehub-cache-action@main | ||
| - uses: DeterminateSystems/update-flake-lock@main | ||
| with: | ||
| pr-title: "Update flake.lock" | ||
| pr-assignees: eveeifyeve |
This file contains hidden or 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 hidden or 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 hidden or 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 |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
numtide/treefmt-nixto create a formatter.nix-systems/defaultto reference available systems.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why use nix-systems can I ask because
nixpkgs.lib.systems.flakeExposeddoes basically the same thing but with an extra dependancy.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<nixpkgs>/lib/systems/flake-systems.nixThis file contains not only
x86_64-linuxandaarch64-linux, but alsoi686-linux,powerpc64le-linuxandriscv64-linux. Are we even needed to supportpowerpc64le-linux&riscv64-linuxsystems?The
nix-systems/defaultcontains only these systems. If we don't support Darwin systems, we can usenix-systems/default-linux.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We want support for windows, linux and mac, with linux and mac being able to work on ARM64 systems. I have no idea how nix works so if you guys can make that work and are happy to maintain it, I'll merge it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ReCore-sys
Hi. For now, I created a sample branch for @Eveeifyeve , to check my above patch. Please check the commit. If you want the way to check the commit, Feel free to ask me!!
(Now the commit is not include the GitHub Actions, because I don't know that @ReCore-sys really want to check via Nix flakes)
haruki7049@44a9302
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the update. For now I'd rather not have a CI step for nix flakes since I'm already fighting tooth and nail to get the windows build times to a reasonable level. Either @Eveeifyeve can include your changes or you are welcome to open your own PR and I'll merge that instead, whatever works out best for you guys.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would say that is better for another pr and GitHub actions don't seem right for this job and I am actually removing this or changing it to not open prs but make a commit straight. I have let a lone 30+ prs from GitHub actions updating flakes it does get cluttered very quick.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works for me. @haruki7049 if you wanna open another PR without the CI modifications I'll merge that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ReCore-sys @Eveeifyeve
#185
Created the PR. Please check.