From 2621170d1b20283ddb5db91ebcccd2e8d2cc33f4 Mon Sep 17 00:00:00 2001 From: Greg Burd Date: Wed, 13 Sep 2023 14:57:49 -0400 Subject: [PATCH] minor cleanup --- .editorconfig | 7 ++++--- .gitignore | 1 + VERSION.txt => .version | 0 TODO | 4 ---- flake.nix | 13 +++++++++---- 5 files changed, 14 insertions(+), 11 deletions(-) rename VERSION.txt => .version (100%) diff --git a/.editorconfig b/.editorconfig index de3ce30..05ce236 100644 --- a/.editorconfig +++ b/.editorconfig @@ -2,10 +2,10 @@ root = true [*] +charset = utf-8 end_of_line = lf insert_final_newline = true trim_trailing_whitespace = true -charset = utf-8 indent_style = tab indent_size = 4 @@ -24,8 +24,9 @@ charset = unset indent_style = unset indent_size = unset -[*.py] -indent_size = 4 +[*.c] +ident_style = space +ident_size = 4 [*.md] max_line_length = off diff --git a/.gitignore b/.gitignore index 65b74e3..3273012 100644 --- a/.gitignore +++ b/.gitignore @@ -28,6 +28,7 @@ resource.rc # Nix result +bulid # Misc *.eml diff --git a/VERSION.txt b/.version similarity index 100% rename from VERSION.txt rename to .version diff --git a/TODO b/TODO index fb8432f..876c44f 100644 --- a/TODO +++ b/TODO @@ -1,11 +1,7 @@ -* add second build target `world.c` * add GitHub workflow to build all targets, upload/publish all artifacts * deb, rpm, tgz of source * Docker container on DockerHub, GitHub Container Repository (ghcr.io) * containers could have multiple tags as in `latest` and `1.0.0` -* add Nix Flake -* devShell -* direnv/envrc * build windows MSYS2 * formatting * lint diff --git a/flake.nix b/flake.nix index 86f05c4..0fae4a2 100644 --- a/flake.nix +++ b/flake.nix @@ -12,13 +12,18 @@ outputs = { self, nixpkgs, flake-utils }: let - # Generate a user-friendly version number (e.g. "1.2.3-DIRTY"). - version = "${builtins.readFile ./VERSION.txt}${self.shortRev or "DIRTY"}"; + inherit (nixpkgs) lib; + officialRelease = false; + + version = lib.fileContents ./.version + versionSuffix; + versionSuffix = + if officialRelease + then "" + else "pre${builtins.substring 0 8 (self.lastModifiedDate or self.lastModified or "19700101")}_${self.shortRev or "dirty"}"; - # System types to support. supportedSystems = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ]; - # Helper function to generate an attrset '{ x86_64-linux = f "x86_64-linux"; ... }'. + # Generate an attrset '{ x86_64-linux = f "x86_64-linux"; ... }'. forAllSystems = nixpkgs.lib.genAttrs supportedSystems; # Nixpkgs instantiated for supported system types.