Skip to content

Latest commit

 

History

History
151 lines (140 loc) · 4.69 KB

nix.org

File metadata and controls

151 lines (140 loc) · 4.69 KB

.envrc

nix flake lock --update-input valiant
use nix

shell.nix

Adapted from here:

with builtins;
let
  this-flake = import ./.;
  flake =
    this-flake.inputs.valiant or this-flake.inputs.bundle.inputs.valiant or (if (builtins
      ? getFlake) then
      (getFlake "github:syvlorg/valiant")
    else
      (import fetchTarball (let
        lockExists = pathExists ./flake.lock;
        lock = if lockExists then
          (fromJSON (readFile ./flake.lock))
        else {
          nodes.valiant.locked.rev = "main";
        };
      in {
        url =
          "https://github.com/syvlorg/valiant/archive/${lock.nodes.valiant.locked.rev}.tar.gz";
        ${if lockExists then "sha256" else null} =
          lock.nodes.valiant.locked.narHash;
      }) { src = ./.; }).defaultNix);
  inherit (flake.${currentSystem}) pkgs;
in with pkgs;
mkShell rec {
  buildInputs = [ valiant ];
  nativeBuildInputs = buildInputs;
}

default.nix

Adapted from here:

with builtins;
if (builtins ? getFlake) then
  (getFlake (toString ./.))
else
  (import (fetchTarball (let
    lockExists = pathExists ./flake.lock;
    lock = if lockExists then
      (fromJSON (readFile ./flake.lock))
    else {
      nodes.flake-compat.locked.rev = "master";
    };
  in {
    url =
      "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
    ${if lockExists then "sha256" else null} =
      lock.nodes.flake-compat.locked.narHash;
  })) { src = ./.; }).defaultNix

flake.nix

{
  nixConfig = {
    # Adapted From: https://github.com/divnix/digga/blob/main/examples/devos/flake.nix#L4
    accept-flake-config = true;
    auto-optimise-store = true;
    builders-use-substitutes = true;
    cores = 0;
    extra-experimental-features =
      "nix-command flakes impure-derivations recursive-nix";
    fallback = true;
    flake-registry =
      "https://raw.githubusercontent.com/syvlorg/flake-registry/master/flake-registry.json";
    keep-derivations = true;
    keep-outputs = true;
    max-free = 1073741824;
    min-free = 262144000;
    show-trace = true;
    trusted-public-keys = [
      "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
      "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
      "nickel.cachix.org-1:ABoCOGpTJbAum7U6c+04VbjvLxG9f0gJP5kYihRRdQs="
      "sylvorg.cachix.org-1:xd1jb7cDkzX+D+Wqt6TemzkJH9u9esXEFu1yaR9p8H8="
    ];
    trusted-substituters = [
      "https://cache.nixos.org/"
      "https://nix-community.cachix.org"
      "https://nickel.cachix.org"
      "https://sylvorg.cachix.org"
    ];
    warn-dirty = false;
  };
  description = "Ooh, shiny!";
  inputs = rec {
    bundle = {
      url = <<input-path-exists(path="../../../bundle", url="https://github/sylvorg/bundle", submodule='t)>>;
      type = "git";
      submodules = true;
    };
    valiant.follows = "bundle/valiant";
    nixpkgs.follows = "bundle/nixpkgs";

    pyPkg-bakery.url =
      <<input-path-exists(path="../../syvlorg/bakery", url="github:syvlorg/bakery")>>;
    pyPkg-tailapi.url =
      <<input-path-exists(path="../../syvlorg/tailapi", url="github:syvlorg/tailapi")>>;

    flake-utils.url = github:numtide/flake-utils;
    flake-compat = {
      url = "github:edolstra/flake-compat";
      flake = false;
    };
  };
  outputs = inputs@{ self, flake-utils, ... }:
    with builtins;
    with inputs.bundle.lib;
    with flake-utils.lib;
    inputs.bundle.mkOutputs.python {
      inherit inputs self;
      pname = "bootstrap";
      doCheck = false;
      isApp = true;
      callPackage = args@{ callPackage }:
        callPackage (iron.mkPythonPackage {
          inherit self inputs;
          recursiveOverrides = toList "postCheck";
          package = rec {
            owner = "syvlorg";
            inherit (self) doCheck;
            src = ./.;
            postPatch = ''
              substituteInPlace pyproject.toml \
                --replace "bakery = { git = \"https://github.com/syvlorg/bakery.git\", branch = \"main\" }" "" \
                --replace "tailapi = { git = \"https://github.com/syvlorg/tailapi.git\", branch = \"main\" }" ""
              substituteInPlace setup.py \
                --replace "'bakery @ git+https://github.com/syvlorg/bakery.git@main'," "" \
                --replace "'tailapi @ git+https://github.com/syvlorg/tailapi.git@main'," "" || :
            '';
            meta.description = "Ooh, shiny!";
          };
        }) { };
    } { };
}