From 47e0ea8e42aad97b7a142dd913c66a28ec16bdf2 Mon Sep 17 00:00:00 2001 From: Ali Caglayan Date: Thu, 31 Aug 2023 14:39:47 +0100 Subject: [PATCH] Toolchain: Add nix flake Add a nix flake to `Toolchain/` that wraps the existing nix derivation `Toolchain/serenity.nix`. This also comes with a lockfile making the nix developer enviornment setup more reproducible. We also update the documentation for "other builds" to mention the flake. --- Documentation/BuildInstructionsOther.md | 6 +++ Toolchain/flake.lock | 60 +++++++++++++++++++++++++ Toolchain/flake.nix | 20 +++++++++ 3 files changed, 86 insertions(+) create mode 100644 Toolchain/flake.lock create mode 100644 Toolchain/flake.nix diff --git a/Documentation/BuildInstructionsOther.md b/Documentation/BuildInstructionsOther.md index ddb6dbd4d1..4976e4f3d6 100644 --- a/Documentation/BuildInstructionsOther.md +++ b/Documentation/BuildInstructionsOther.md @@ -33,6 +33,12 @@ You can use the `nix-shell` script [`Toolchain/serenity.nix`](../Toolchain/seren nix-shell Toolchain/serenity.nix ``` +or you can use the nix flake [`Toolchain/flake.nix`](../Toolchain/serenity.nix) instead: + +```console +nix develop Toolchain +``` + ## Alpine Linux First, make sure you have enabled the `community` repository in `/etc/apk/repositories` and run `apk update`. It has been tested on `edge`, YMMV on `stable`. diff --git a/Toolchain/flake.lock b/Toolchain/flake.lock new file mode 100644 index 0000000000..c5cd007b31 --- /dev/null +++ b/Toolchain/flake.lock @@ -0,0 +1,60 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1692799911, + "narHash": "sha256-3eihraek4qL744EvQXsK1Ha6C3CR7nnT8X2qWap4RNk=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "f9e7cf818399d17d347f847525c5a5a8032e4e44", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1693485768, + "narHash": "sha256-PxqYECiPBBbavaPjnf/v2rlzp2Xoe/JPA7rl1WxGe0A=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "c106712dc7a447db0c8a654162c3a0557909dfd6", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/Toolchain/flake.nix b/Toolchain/flake.nix new file mode 100644 index 0000000000..626cc42f07 --- /dev/null +++ b/Toolchain/flake.nix @@ -0,0 +1,20 @@ +{ + description = "Serenity OS"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs"; + flake-utils.url = "github:numtide/flake-utils"; + }; + outputs = { self, flake-utils, nixpkgs }: + + flake-utils.lib.eachDefaultSystem + (system: + let pkgs = nixpkgs.legacyPackages.${system}; in + { + formatter = pkgs.nixpkgs-fmt; + devShells.default = import ./serenity.nix { inherit pkgs; }; + } + ); + + +}