From c02009f601ea46c7db33bacf59130911ece48c13 Mon Sep 17 00:00:00 2001 From: h7x4 Date: Mon, 4 Aug 2025 20:03:14 +0200 Subject: [PATCH] flake.nix: init --- .envrc | 1 + flake.lock | 26 ++++++++++++++++++++++++++ flake.nix | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 76 insertions(+) create mode 100644 .envrc create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..e8ecd09 --- /dev/null +++ b/flake.lock @@ -0,0 +1,26 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1754214453, + "narHash": "sha256-Q/I2xJn/j1wpkGhWkQnm20nShYnG7TI99foDBpXm1SY=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "5b09dc45f24cf32316283e62aec81ffee3c3e376", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "ref": "nixos-unstable", + "type": "indirect" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..7e33bcf --- /dev/null +++ b/flake.nix @@ -0,0 +1,49 @@ +{ + description = "Flutter package for rendering kanji stroke animations"; + + inputs = { + nixpkgs.url = "nixpkgs/nixos-unstable"; + }; + + outputs = { + self, + nixpkgs, + }: let + inherit (nixpkgs) lib; + systems = [ + "x86_64-linux" + "aarch64-linux" + "x86_64-darwin" + "aarch64-darwin" + ]; + + forAllSystems = f: lib.genAttrs systems (system: f system nixpkgs.legacyPackages.${system}); + in { + devShells = forAllSystems (system: pkgs: { + default = pkgs.mkShell { + buildInputs = with pkgs; [ + flutter + dart + ]; + }; + }); + + packages = let + src = builtins.filterSource (path: type: let + baseName = baseNameOf (toString path); + in !(lib.any (b: b) [ + (!(lib.cleanSourceFilter path type)) + (baseName == "nix" && type == "directory") + (baseName == ".envrc" && type == "regular") + (baseName == "flake.lock" && type == "regular") + (baseName == "flake.nix" && type == "regular") + ])) ./.; + in forAllSystems (system: pkgs: { + # default = self.packages.${system}.kanjimaji; + + filteredSource = pkgs.runCommandLocal "filtered-source" { } '' + ln -s ${src} $out + ''; + }); + }; +}