diff options
Diffstat (limited to '')
-rw-r--r-- | awk/.gitignore | 4 | ||||
-rw-r--r-- | awk/cog.toml | 28 | ||||
-rw-r--r-- | templates/awk/.envrc (renamed from awk/.envrc) | 4 | ||||
-rw-r--r-- | templates/awk/COPYING (renamed from awk/COPYING) | 0 | ||||
-rw-r--r-- | templates/awk/LICENSE.spdx (renamed from awk/LICENSE.spdx) | 0 | ||||
-rw-r--r-- | templates/awk/flake.nix (renamed from awk/flake.nix) | 78 |
6 files changed, 50 insertions, 64 deletions
diff --git a/awk/.gitignore b/awk/.gitignore deleted file mode 100644 index aad77ec..0000000 --- a/awk/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -# build dirs -/result - -.direnv diff --git a/awk/cog.toml b/awk/cog.toml deleted file mode 100644 index 316fb11..0000000 --- a/awk/cog.toml +++ /dev/null @@ -1,28 +0,0 @@ -from_latest_tag = false -tag_prefix = "v" -ignore_merge_commits = false -pre_package_bump_hooks = [] -post_package_bump_hooks = [] - -branch_whitelist = [ - "prime", -] - -pre_bump_hooks = [ - "nix build", # verify the project builds - "flake_version_update --version v{{version}} --input-file flake.nix", -] -post_bump_hooks = [ - "git push", - "git push origin v{{version}}", # push the new tag to origin -] - -[commit_types] - -[changelog] -path = "NEWS.md" -authors = [] - -[bump_profiles] - -[packages] diff --git a/awk/.envrc b/templates/awk/.envrc index a9c7e4e..96eca6b 100644 --- a/awk/.envrc +++ b/templates/awk/.envrc @@ -1,4 +1,6 @@ -use flake +use flake || use nix +watch_file flake.nix + if on_git_branch; then echo && git status --short --branch && echo && git fetch --verbose diff --git a/awk/COPYING b/templates/awk/COPYING index f288702..f288702 100644 --- a/awk/COPYING +++ b/templates/awk/COPYING diff --git a/awk/LICENSE.spdx b/templates/awk/LICENSE.spdx index ecb7d83..ecb7d83 100644 --- a/awk/LICENSE.spdx +++ b/templates/awk/LICENSE.spdx diff --git a/awk/flake.nix b/templates/awk/flake.nix index 1d9b0b2..aeacf3b 100644 --- a/awk/flake.nix +++ b/templates/awk/flake.nix @@ -1,17 +1,16 @@ { - description = ""; # TODO + description = "TODO"; inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; - systems = { - url = "github:nix-systems/x86_64-linux"; # only evaluate for this system - }; - flake-utils = { - url = "github:numtide/flake-utils"; + + treefmt-nix = { + url = "github:numtide/treefmt-nix"; inputs = { - systems.follows = "systems"; + nixpkgs.follows = "nixpkgs"; }; }; + flake_version_update = { url = "git+https://codeberg.org/soispha/flake_version_update.git"; inputs = { @@ -20,58 +19,75 @@ flake-utils.follows = "flake-utils"; }; }; + + # inputs for following + systems = { + url = "github:nix-systems/x86_64-linux"; # only evaluate for this system + }; + flake-compat = { + url = "github:edolstra/flake-compat"; + flake = false; + }; + flake-utils = { + url = "github:numtide/flake-utils"; + inputs = { + systems.follows = "systems"; + }; + }; }; outputs = { self, nixpkgs, flake-utils, + treefmt-nix, flake_version_update, ... }: flake-utils.lib.eachDefaultSystem (system: let pkgs = nixpkgs.legacyPackages.${system}; + treefmtEval = import ./treefmt.nix {inherit treefmt-nix pkgs;}; # This version is set automatically on `cog bump --auto`; version = "v1.0.0"; # GUIDING VERSION STRING + + man_number = "1"; # TODO change if necessary + pname = "TODO"; in { packages.default = pkgs.stdenv.mkDerivation { - pname = ""; # TODO - inherit version; + inherit version pname; src = ./.; - nativeBuildInputs = builtins.attrValues { - inherit - (pkgs) - #pandoc - - ; - }; + nativeBuildInputs = with pkgs; [pandoc fd]; - dependencies = builtins.attrValues { - inherit (pkgs) gawk; - }; + dependencies = with pkgs; [gawk]; buildPhase = '' - #mkdir --parents $out/docs; - #pandoc $src/docs/<name>.1.md -s -t man > $out/docs/<name>.1 + mkdir --parents $out/docs; + pandoc ./docs/${pname}.${man_number}.md -s -t man > $out/docs/${pname}.${man_number} ''; installPhase = '' - install -D $out/docs/<name>.<man_number> $out/share/man/man<man_number>/<name>; - install -D $scr/scr/<name>.awk $out/bin/<name>; + install -D $out/docs/${pname}.${man_number} $out/share/man/man${man_number}/${pname}; + + install -D ./src/${pname}.awk $out/bin/${pname}.awk; + + # Generate a wrapper script. + cat << EOF > $out/bin/${pname} + #! /usr/bin/env sh + $out/bin/${pname}.awk -- "\$@" + EOF + + # Set correct permissions + chmod +x $out/bin/${pname} ''; }; - app.default = { - type = "app"; - program = "${self.packages.${system}.default}/bin/<name>"; - }; + + checks.formatting = treefmtEval.config.build.check self; + formatter = treefmtEval.config.build.wrapper; + devShells.default = pkgs.mkShell { packages = with pkgs; [ - nil - alejandra - statix - ltex-ls cocogitto flake_version_update.packages."${system}".default |