From bd94a58388163c92737ced3705378228f2d412b5 Mon Sep 17 00:00:00 2001 From: Sridhar Ratnakumar Date: Fri, 12 Apr 2024 18:41:02 +1000 Subject: [PATCH] chore(nix): Add dev sub-flake --- .envrc | 2 + .gitignore | 4 +- dev/flake.lock | 115 +++++++++++++++++++++++++++++++++++++++++++++++++ dev/flake.nix | 29 +++++++++++++ flake.nix | 4 ++ 5 files changed, 153 insertions(+), 1 deletion(-) create mode 100644 .envrc create mode 100644 dev/flake.lock create mode 100644 dev/flake.nix diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..69a79ee --- /dev/null +++ b/.envrc @@ -0,0 +1,2 @@ +watch_file dev/flake.nix +use flake ./dev diff --git a/.gitignore b/.gitignore index 7a8bd9c..e1961ff 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,7 @@ +/.direnv + /example/data.sqlite* /example/result /test/data.sqlite -/test/result.txt \ No newline at end of file +/test/result.txt diff --git a/dev/flake.lock b/dev/flake.lock new file mode 100644 index 0000000..6450532 --- /dev/null +++ b/dev/flake.lock @@ -0,0 +1,115 @@ +{ + "nodes": { + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1685662779, + "narHash": "sha256-cKDDciXGpMEjP1n6HlzKinN0H+oLmNpgeCTzYnsA2po=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "71fb97f0d875fd4de4994dfb849f2c75e17eb6c3", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1709613862, + "narHash": "sha256-mH+c2gFEzEe49lhUWJ0ieIaMaJ1W85E6G1xLm8ege90=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "311a4be96d940a0c673e88bd5bc83ea4f005cc02", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-lib": { + "locked": { + "dir": "lib", + "lastModified": 1685564631, + "narHash": "sha256-8ywr3AkblY4++3lIVxmrWZFzac7+f32ZEhH/A8pNscI=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "4f53efe34b3a8877ac923b9350c874e3dcd5dc0a", + "type": "github" + }, + "original": { + "dir": "lib", + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1680945546, + "narHash": "sha256-8FuaH5t/aVi/pR1XxnF0qi4WwMYC+YxlfdsA0V+TEuQ=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "d9f759f2ea8d265d974a6e1259bd510ac5844c5d", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "process-compose-flake": { + "locked": { + "lastModified": 1712910508, + "narHash": "sha256-mCF2EcBoQMXY2P9q3d0cuhmpDzeInLt4KcW1JzrcMqk=", + "owner": "Platonic-Systems", + "repo": "process-compose-flake", + "rev": "e3292f80372cbc567ebda5deab5e451de5c5155c", + "type": "github" + }, + "original": { + "owner": "Platonic-Systems", + "repo": "process-compose-flake", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-parts": "flake-parts", + "nixpkgs": "nixpkgs", + "process-compose-flake": "process-compose-flake", + "treefmt-nix": "treefmt-nix" + } + }, + "treefmt-nix": { + "inputs": { + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "lastModified": 1688916551, + "narHash": "sha256-YsGzTjtYwJ7j8TTIjo0cImycGAvUT1UXq2sCZ8Vu0Wc=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "3fadb6baac68068dc0196f35d3e092bf316d4409", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/dev/flake.nix b/dev/flake.nix new file mode 100644 index 0000000..3403736 --- /dev/null +++ b/dev/flake.nix @@ -0,0 +1,29 @@ +{ + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; + flake-parts.url = "github:hercules-ci/flake-parts"; + treefmt-nix.url = "github:numtide/treefmt-nix"; + process-compose-flake.url = "github:Platonic-Systems/process-compose-flake"; + }; + outputs = inputs@{ self, nixpkgs, flake-parts, ... }: + flake-parts.lib.mkFlake { inherit inputs; } { + systems = nixpkgs.lib.systems.flakeExposed; + imports = [ + inputs.treefmt-nix.flakeModule + ]; + perSystem = { pkgs, lib, config, ... }: { + treefmt = { + projectRoot = inputs.process-compose-flake; + projectRootFile = "flake.nix"; + programs = { + nixpkgs-fmt.enable = true; + }; + }; + devShells.default = pkgs.mkShell { + inputsFrom = [ + config.treefmt.build.devShell + ]; + }; + }; + }; +} diff --git a/flake.nix b/flake.nix index fbb46d0..0d9cb76 100644 --- a/flake.nix +++ b/flake.nix @@ -15,6 +15,10 @@ inherit overrideInputs; dir = "example"; }; + dev = { + inherit overrideInputs; + dir = "dev"; + }; }; }; }