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,7 +1,7 @@
# devflake # flake
Create a simple `flake.nix` for `nix develop` Create a simple `flake.nix` for nix.
## License ## License
[MIT](LICENSE) [MIT](LICENSE)

View File

@ -1,25 +1,47 @@
{ {
inputs = { description = "{{description}}";
nixpkgs.url = "github:nixos/nixpkgs{{if unstable}}/nixpkgs-unstable{{end}}";
flake-utils.url = "github:numtide/flake-utils"; inputs.nixpkgs.url = "github:nixos/nixpkgs{{if unstable}}/nixpkgs-unstable{{end}}";
};
outputs = { outputs = {
self, self,
flake-utils,
nixpkgs, nixpkgs,
}: }: let
flake-utils.lib.eachDefaultSystem ( systems = [
"x86_64-linux"
"x86_64-darwin"
"aarch64-linux"
"aarch64-darwin"
];
in
builtins.map (
system: let system: let
pkgs = nixpkgs.legacyPackages.${system}; pkgs = nixpkgs.legacyPackages.${system};
in { 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; [ nativeBuildInputs = with pkgs; [
{{- range $pkg := (splitList "\n" packages)}} {{- range $pkg := (splitList "\n" packages)}}
{{trim $pkg}} {{trim $pkg}}
{{- end}} {{- end}}
]; ];
}; };
{{end}}
} }
); )
} systems;
}

View File

@ -2,6 +2,19 @@ prompts:
- id: unstable - id: unstable
label: Use unstable label: Use unstable
type: confirm 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 - id: packages
label: Packages label: Packages
help: nixpkgs, one on each line help: nixpkgs, one on each line