From 7ab847fe4c0c88f9ec966ce862638279855fa7b9 Mon Sep 17 00:00:00 2001 From: Sam Connelly Date: Mon, 24 Jun 2024 17:07:03 -0400 Subject: [PATCH 1/2] Add Nix flake --- flake.lock | 27 +++++++++++++++++++++++++++ flake.nix | 21 +++++++++++++++++++++ version.sh | 2 +- 3 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..2499411 --- /dev/null +++ b/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1719075281, + "narHash": "sha256-CyyxvOwFf12I91PBWz43iGT1kjsf5oi6ax7CrvaMyAo=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "a71e967ef3694799d0c418c98332f7ff4cc5f6af", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..09ee0f9 --- /dev/null +++ b/flake.nix @@ -0,0 +1,21 @@ +{ + description = "SPASM-ng is a z80/eZ80 assembler with extra features to support development for TI calculators."; + inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + + outputs = { self, nixpkgs }: { packages = builtins.listToAttrs (map (systemName: { + name = "${systemName}"; + value = { default = + with import nixpkgs { system = systemName; }; + stdenv.mkDerivation { + enableParallelBuilding = true; + name = "spasm-ng"; + src = self; + installPhase = '' + mkdir -p $out/bin + cp spasm $out/bin + ''; + meta.mainProgram = "spasm"; + nativeBuildInputs = with pkgs; [ gmp openssl zlib ]; + };};}) + [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" "x86_64-darwin" ]);}; +} diff --git a/version.sh b/version.sh index 67e975d..b6e1466 100755 --- a/version.sh +++ b/version.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh getversion() { if [ -f version_base.h ];then VERSION=`cat version_base.h | head -n 1 | cut -f3 -d' ' | tr -d '"'` From 97911f00f43a89259653f3b86a68d9fcb392c8e0 Mon Sep 17 00:00:00 2001 From: Sam Connelly Date: Wed, 26 Jun 2024 17:48:09 -0400 Subject: [PATCH 2/2] Update flake --- flake.lock | 40 +++++++++++++++++++++++++++++++++++++--- flake.nix | 33 +++++++++++++++++---------------- 2 files changed, 54 insertions(+), 19 deletions(-) diff --git a/flake.lock b/flake.lock index 2499411..0005e7e 100644 --- a/flake.lock +++ b/flake.lock @@ -1,12 +1,30 @@ { "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "nixpkgs": { "locked": { - "lastModified": 1719075281, - "narHash": "sha256-CyyxvOwFf12I91PBWz43iGT1kjsf5oi6ax7CrvaMyAo=", + "lastModified": 1719254875, + "narHash": "sha256-ECni+IkwXjusHsm9Sexdtq8weAq/yUyt1TWIemXt3Ko=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "a71e967ef3694799d0c418c98332f7ff4cc5f6af", + "rev": "2893f56de08021cffd9b6b6dfc70fd9ccd51eb60", "type": "github" }, "original": { @@ -18,8 +36,24 @@ }, "root": { "inputs": { + "flake-utils": "flake-utils", "nixpkgs": "nixpkgs" } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 09ee0f9..381994b 100644 --- a/flake.nix +++ b/flake.nix @@ -1,21 +1,22 @@ { description = "SPASM-ng is a z80/eZ80 assembler with extra features to support development for TI calculators."; inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + inputs.flake-utils.url = "github:numtide/flake-utils"; - outputs = { self, nixpkgs }: { packages = builtins.listToAttrs (map (systemName: { - name = "${systemName}"; - value = { default = - with import nixpkgs { system = systemName; }; - stdenv.mkDerivation { - enableParallelBuilding = true; - name = "spasm-ng"; - src = self; - installPhase = '' - mkdir -p $out/bin - cp spasm $out/bin - ''; - meta.mainProgram = "spasm"; - nativeBuildInputs = with pkgs; [ gmp openssl zlib ]; - };};}) - [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" "x86_64-darwin" ]);}; + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem (system: + with import nixpkgs { system = system; }; { + packages.default = stdenv.mkDerivation { + enableParallelBuilding = true; + name = "spasm-ng"; + src = self; + installPhase = '' + mkdir -p $out/bin + cp spasm $out/bin + ''; + meta.mainProgram = "spasm"; + nativeBuildInputs = with pkgs; [ gmp openssl zlib ]; + }; + } + ); }