chore(nix): Add dev sub-flake

This commit is contained in:
Sridhar Ratnakumar 2024-04-12 18:41:02 +10:00 committed by Sridhar Ratnakumar
parent e3292f8037
commit bd94a58388
5 changed files with 153 additions and 1 deletions

2
.envrc Normal file
View File

@ -0,0 +1,2 @@
watch_file dev/flake.nix
use flake ./dev

4
.gitignore vendored
View File

@ -1,5 +1,7 @@
/.direnv
/example/data.sqlite*
/example/result
/test/data.sqlite
/test/result.txt
/test/result.txt

115
dev/flake.lock Normal file
View File

@ -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
}

29
dev/flake.nix Normal file
View File

@ -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
];
};
};
};
}

View File

@ -15,6 +15,10 @@
inherit overrideInputs;
dir = "example";
};
dev = {
inherit overrideInputs;
dir = "dev";
};
};
};
}