Skip to content

Instantly share code, notes, and snippets.

@0b1kn00b
Created January 24, 2023 16:01
Show Gist options
  • Save 0b1kn00b/3a2fb0635bc58ed9d0feb30b6f3299e9 to your computer and use it in GitHub Desktop.
Save 0b1kn00b/3a2fb0635bc58ed9d0feb30b6f3299e9 to your computer and use it in GitHub Desktop.
Struggling with nix
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
nixpkgs.follows = "nix/nixpkgs";
# debug.url
nguix.url = "github:sauricat/nguix";
nguix.follows = "nix/nixpkgs";
#stdenv.url
};
outputs = { self, nix, nixpkgs, nguix } :
let
# Generate a u ser-friendly version number.
version = builtins.substring 0 8 self.lastModifiedDate;
# System types to support.>
supportedSystems = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ];
# Nixpkgs instantiated for supported system types.
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; });
in{
packages = forAllSystems (system:
let
pkgs = nixpkgsFor.${system};
in{
default = pkgs.stdenv.mkDerivation {
name = "hello";
src = self;
buildPhase = "nguix --version";
installPhase = "mkdir -p $out/bin; install -t $out/bin hello";
};
}
);
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment