From 2f981427284ee5fe9a55503f7da260009a379659 Mon Sep 17 00:00:00 2001 From: Jonni Liljamo Date: Thu, 20 Nov 2025 11:55:07 +0200 Subject: [PATCH] feat: init with makeimg packaged --- .envrc | 1 + .gitignore | 3 ++ flake.lock | 135 ++++++++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 36 ++++++++++++++ makeimg.nix | 23 +++++++++ 5 files changed, 198 insertions(+) create mode 100644 .envrc create mode 100644 .gitignore create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 makeimg.nix diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..c4b17d7 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use_flake diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4fe1cb4 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +/.direnv/ +/.pre-commit-config.yaml +/result diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..2098e9b --- /dev/null +++ b/flake.lock @@ -0,0 +1,135 @@ +{ + "nodes": { + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1747046372, + "narHash": "sha256-CIVLLkVgvHYbgI2UpXvIIBJ12HWgX+fjA8Xf8PUmqCY=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "9100a0f413b0c601e0533d1d94ffd501ce2e7885", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1762980239, + "narHash": "sha256-8oNVE8TrD19ulHinjaqONf9QWCKK+w4url56cdStMpM=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "52a2caecc898d0b46b2b905f058ccc5081f842da", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "pre-commit-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709087332, + "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1763464769, + "narHash": "sha256-AJHrsT7VoeQzErpBRlLJM1SODcaayp0joAoEA35yiwM=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "6f374686605df381de8541c072038472a5ea2e2d", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-lib": { + "locked": { + "lastModified": 1761765539, + "narHash": "sha256-b0yj6kfvO8ApcSE+QmA6mUfu8IYG6/uU28OFn4PaC8M=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "719359f4562934ae99f5443f20aa06c2ffff91fc", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixpkgs.lib", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1759417375, + "narHash": "sha256-O7eHcgkQXJNygY6AypkF9tFhsoDQjpNEojw3eFs73Ow=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "dc704e6102e76aad573f63b74c742cd96f8f1e6c", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "pre-commit-hooks": { + "inputs": { + "flake-compat": "flake-compat", + "gitignore": "gitignore", + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "lastModified": 1763319842, + "narHash": "sha256-YG19IyrTdnVn0l3DvcUYm85u3PaqBt6tI6VvolcuHnA=", + "owner": "cachix", + "repo": "git-hooks.nix", + "rev": "7275fa67fbbb75891c16d9dee7d88e58aea2d761", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "git-hooks.nix", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-parts": "flake-parts", + "nixpkgs": "nixpkgs", + "pre-commit-hooks": "pre-commit-hooks" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..66cacf2 --- /dev/null +++ b/flake.nix @@ -0,0 +1,36 @@ +{ + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; + flake-parts.url = "github:hercules-ci/flake-parts"; + pre-commit-hooks.url = "github:cachix/git-hooks.nix"; + }; + + outputs = inputs @ {self, ...}: + inputs.flake-parts.lib.mkFlake {inherit inputs;} { + systems = ["x86_64-linux"]; + perSystem = { + pkgs, + system, + ... + }: { + packages.makeimg = pkgs.callPackage ./makeimg.nix {}; + + checks.pre-commit-check = inputs.pre-commit-hooks.lib.${system}.run { + src = ./.; + hooks.alejandra.enable = true; + }; + + devShells.default = pkgs.mkShell { + buildInputs = with pkgs; [ + self.packages.${system}.makeimg + + # tools + just + ]; + shellHook = '' + ${self.checks.${system}.pre-commit-check.shellHook} + ''; + }; + }; + }; +} diff --git a/makeimg.nix b/makeimg.nix new file mode 100644 index 0000000..03ee5a9 --- /dev/null +++ b/makeimg.nix @@ -0,0 +1,23 @@ +{ + stdenv, + pkgs, + ... +}: let +in + stdenv.mkDerivation rec { + pname = "makeimg"; + version = "0.14.0"; + + src = pkgs.fetchFromSourcehut { + owner = "~bitfehler"; + repo = "makeimg"; + tag = "v${version}"; + hash = "sha256-cLCLCG0+ShFazuVBG9GcvVmQNJtuMkKdGEP3QNJPTAo="; + }; + + dontBuild = true; + + installPhase = '' + install -Dm755 -t $out/bin makeimg + ''; + } -- 2.44.1