notes.sh/flake.nix

54 lines
1.4 KiB
Nix
Raw Permalink Normal View History

2023-09-30 13:41:23 +00:00
{
description = "Nix notes.sh dev environment";
# Flake inputs
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs";
};
# Flake outputs
outputs = { self, nixpkgs }:
let
# Systems supported
allSystems = [
"x86_64-linux" # 64-bit Intel/AMD Linux
"aarch64-linux" # 64-bit ARM Linux
"x86_64-darwin" # 64-bit Intel macOS
"aarch64-darwin" # 64-bit ARM macOS
];
# Helper to provide system-specific attributes
forAllSystems = f: nixpkgs.lib.genAttrs allSystems (system: f {
pkgs = import nixpkgs { inherit system; };
});
make_package = pkgs: pkgs.stdenv.mkDerivation {
name = "notes-sh";
src = self;
nativeBuildInputs = [pkgs.makeWrapper];
installPhase = ''
mkdir -p $out/bin
cp notes.sh $out/bin
'';
postFixup = ''
wrapProgram $out/bin/notes.sh \
--prefix PATH : ${pkgs.lib.makeBinPath (with pkgs; [ gawk findutils gnused coreutils])}
'';
};
in
{
devShells = forAllSystems ({ pkgs }: {
default = pkgs.mkShell {
packages = with pkgs; [
fzf
];
};
});
packages = forAllSystems({ pkgs }: rec {notes-sh = make_package pkgs; default=notes-sh;});
overlays.default = final: prev: {
notes-sh = make_package prev;
};
};
}