chore: generic flake

Signed-off-by: jolheiser <john.olheiser@gmail.com>
flake
jolheiser 2023-12-20 17:00:48 -06:00
parent c653a0d276
commit 69c9a9cb62
Signed by: jolheiser
GPG Key ID: B853ADA5DA7BBF7A
3 changed files with 48 additions and 13 deletions

View File

@ -1,6 +1,6 @@
# devflake
# flake
Create a simple `flake.nix` for `nix develop`
Create a simple `flake.nix` for nix.
## License

View File

@ -1,25 +1,47 @@
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs{{if unstable}}/nixpkgs-unstable{{end}}";
flake-utils.url = "github:numtide/flake-utils";
};
description = "{{description}}";
inputs.nixpkgs.url = "github:nixos/nixpkgs{{if unstable}}/nixpkgs-unstable{{end}}";
outputs = {
self,
flake-utils,
nixpkgs,
}:
flake-utils.lib.eachDefaultSystem (
}: let
systems = [
"x86_64-linux"
"x86_64-darwin"
"aarch64-linux"
"aarch64-darwin"
];
in
builtins.map (
system: let
pkgs = nixpkgs.legacyPackages.${system};
in {
devShells.default = pkgs.mkShell {
{{if pname}}
packages.${system}.default = pkgs.buildGoModule {
pname = {{pname}};
version = {{version}};
src = ./.;
vendorHash = "";
meta = with pkgs.lib; {
description = "{{description}}";
homepage = "{{url}}";
maintainers = with maintainers; [jolheiser];
mainProgram = "{{pname}}";
};
};
{{end}}
{{if packages}}
devShells.${system}.default = pkgs.mkShell {
nativeBuildInputs = with pkgs; [
{{- range $pkg := (splitList "\n" packages)}}
{{trim $pkg}}
{{- end}}
];
};
{{end}}
}
);
)
systems;
}

View File

@ -2,6 +2,19 @@ prompts:
- id: unstable
label: Use unstable
type: confirm
- id: pname
label: pname
help: Program name
type: input
- id: version
label: Version
type: input
- id: description
label: Description
type: multi
- id: url
label: Project URL
type: input
- id: packages
label: Packages
help: nixpkgs, one on each line