From 18ff5e1de5c3edbac6413c8a4fa37aadda59e43e Mon Sep 17 00:00:00 2001 From: Oleks Date: Thu, 12 Mar 2026 19:53:43 +0200 Subject: [PATCH] =?UTF-8?q?Initial=20flake=20hub=20=E2=80=93=20oleks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- flake.nix | 33 +++++++++++++++++++++++++++++++++ packages/hello-world.nix | 23 +++++++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 flake.nix create mode 100644 packages/hello-world.nix diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..17fc0c1 --- /dev/null +++ b/flake.nix @@ -0,0 +1,33 @@ +{ + description = "oleks's personal Flake hub – a place to publish custom packages and overlays"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + }; + + outputs = + { self, nixpkgs, ... }: + let + system = "x86_64-linux"; + pkgs = import nixpkgs { inherit system; }; + in + { + packages.${system}.hello-world = pkgs.callPackage ./packages/hello-world.nix { }; + + overlays.default = final: prev: { + hello-world = final.callPackage ./packages/hello-world.nix { }; + }; + + devShells.${system}.default = pkgs.mkShell { + name = "oleks-hub-shell"; + buildInputs = [ self.packages.${system}.hello-world ]; + nativeBuildInputs = with pkgs; [ + nix + fmt + ]; + shellHook = '' + echo "Welcome to the oleks Flake hub development shell." + ''; + }; + }; +} diff --git a/packages/hello-world.nix b/packages/hello-world.nix new file mode 100644 index 0000000..53b8173 --- /dev/null +++ b/packages/hello-world.nix @@ -0,0 +1,23 @@ +{ stdenv }: + +stdenv.mkDerivation { + pname = "hello-world"; + version = "1.0.0"; + + src = builtins.fetchurl { + url = "https://raw.githubusercontent.com/NixOS/nixpkgs/master/pkgs/tools/hello/hello.c"; + sha256 = "1p9sc9h1b6k7bk25n5g0w9gwy6fxlkchr5hpmxczg4bvp6jv93q6"; + }; + + installPhase = '' + mkdir -p $out/bin + cp $src $out/bin/hello-world + chmod +x $out/bin/hello-world + ''; + + meta = with stdenv.lib; { + description = "A tiny hello‑world program used as an example package"; + license = licenses.bsd2; + platforms = platforms.unix; + }; +}