From 057fe88a21820dda0453d7d0ddd2796db108703b Mon Sep 17 00:00:00 2001 From: Romain Paquet Date: Wed, 1 Oct 2025 15:57:46 +0200 Subject: [PATCH] nix: create initial flake --- devShells/flake-module.nix | 17 +++++++++ flake.lock | 77 ++++++++++++++++++++++++++++++++++++++ flake.nix | 48 ++++++++++++++++++++++++ 3 files changed, 142 insertions(+) create mode 100644 devShells/flake-module.nix create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/devShells/flake-module.nix b/devShells/flake-module.nix new file mode 100644 index 0000000..89d2585 --- /dev/null +++ b/devShells/flake-module.nix @@ -0,0 +1,17 @@ +{ + perSystem = + { + pkgs, + ... + }: + { + devShells.default = pkgs.mkShell { + packages = [ + pkgs.nil + pkgs.nixfmt-rfc-style + pkgs.cargo + pkgs.rust-analyzer + ]; + }; + }; +} diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..86cc2b0 --- /dev/null +++ b/flake.lock @@ -0,0 +1,77 @@ +{ + "nodes": { + "crane": { + "locked": { + "lastModified": 1752946753, + "narHash": "sha256-g5uP3jIj+STUcfTJDKYopxnSijs2agRg13H0SGL5iE4=", + "owner": "ipetkov", + "repo": "crane", + "rev": "544d09fecc8c2338542c57f3f742f1a0c8c71e13", + "type": "github" + }, + "original": { + "owner": "ipetkov", + "repo": "crane", + "type": "github" + } + }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1751413152, + "narHash": "sha256-Tyw1RjYEsp5scoigs1384gIg6e0GoBVjms4aXFfRssQ=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "77826244401ea9de6e3bac47c2db46005e1f30b5", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1752687322, + "narHash": "sha256-RKwfXA4OZROjBTQAl9WOZQFm7L8Bo93FQwSJpAiSRvo=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "6e987485eb2c77e5dcc5af4e3c70843711ef9251", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-lib": { + "locked": { + "lastModified": 1751159883, + "narHash": "sha256-urW/Ylk9FIfvXfliA1ywh75yszAbiTEVgpPeinFyVZo=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "14a40a1d7fb9afa4739275ac642ed7301a9ba1ab", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixpkgs.lib", + "type": "github" + } + }, + "root": { + "inputs": { + "crane": "crane", + "flake-parts": "flake-parts", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..0fdd578 --- /dev/null +++ b/flake.nix @@ -0,0 +1,48 @@ +{ + description = "Lila language"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; + + flake-parts.url = "github:hercules-ci/flake-parts"; + + crane.url = "github:ipetkov/crane"; + }; + + outputs = + inputs@{ flake-parts, crane, ... }: + flake-parts.lib.mkFlake { inherit inputs; } { + imports = [ + ./devShells/flake-module.nix + ]; + + systems = [ + "x86_64-linux" + "aarch64-linux" + ]; + + perSystem = + { pkgs, lib, ... }: + let + craneLib = crane.mkLib pkgs; + + pestFilter = path: _type: (builtins.match ".*\.pest$" path) != null; + sourceFilter = path: type: (craneLib.filterCargoSources path type) || (pestFilter path type); + + lilac-crate = craneLib.buildPackage ({ + src = lib.cleanSourceWith { + src = ./.; + filter = sourceFilter; + name = "source"; + }; + }); + in + { + checks = { + inherit lilac-crate; + }; + + packages.lilac = lilac-crate; + }; + }; +}