Skip to content

Commit

Permalink
Bumped nixpkgs, fakedir, added command dep checking
Browse files Browse the repository at this point in the history
  • Loading branch information
Thesola10 committed Nov 27, 2023
1 parent b0fac46 commit ef782b1
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 70 deletions.
36 changes: 36 additions & 0 deletions builder/nixie/output/nix-wrapped.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,27 @@ _untar() {
} | tar -x "$@"
}

# Check that a command is available, and if not, add it to the list of missing
# commands to print at the end
declare -a MISSING_CMDS
_avail() {
which -p $1 >&/dev/null || MISSING_CMDS+="$1"
}

# Print the list of missing commands and return 1, if any commands are missing
_avail_end() {
if ((${#MISSING_CMDS[@]}))
then
tput rmcup
>&2 echo "ERROR: The following commands are missing:"
>&2 echo "$MISSING_CMDS"
>&2 echo "Use your distribution's package manager to install them, then try again."
return 1
else
return 0
fi
}

# Best-attempt script for downloading files. We first try wget, then cURL,
# then Python 3.
_dl() {
Expand Down Expand Up @@ -240,6 +261,14 @@ _try_build_nix() {
source_root="$REPO_ROOT/.nixie/sources"
mkdir -p $source_root

_avail cc
_avail pkg-config
_avail make
_avail flex
_avail bison
_avail perl
_avail_end || return 1;

_find_or_build_openssl
_find_or_build_boost
_find_or_build_nlohmann_json
Expand Down Expand Up @@ -407,6 +436,13 @@ _catch_nixie_args() {

##### ENTRY POINT #####

# Check for required commands
_avail tar
_avail gzip
_avail uname
_avail kill
_avail_end || exit 1

# Load feature attributes of our resource tarball
eval "$(_untar -O features || _bail "The resource archive is missing or malformed.")"

Expand Down
68 changes: 6 additions & 62 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 1 addition & 6 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
{ description = "Put Nix in everything!";

inputs.nixpkgs.url = github:nixos/nixpkgs;
inputs.nix =
{ url = github:nixos/nix/2.14.1;
inputs.nixpkgs.follows = "nixpkgs";
};
inputs.fakedir =
{ url = github:nixie-dev/fakedir;
inputs.nixpkgs.follows = "nixpkgs";
Expand All @@ -14,7 +10,7 @@
nixConfig.extra-substituters = "https://nix-wrap.cachix.org";
nixConfig.extra-trusted-public-keys = "nix-wrap.cachix.org-1:FcfSb7e+LmXBZE/MdaFWcs4bW2OQQeBnB/kgWlkZmYI=";

outputs = { self, nixpkgs, flake-utils, fakedir, nix, ... }:
outputs = { self, nixpkgs, flake-utils, fakedir, ... }:
flake-utils.lib.eachDefaultSystem
(system:
let pkgs = import nixpkgs { inherit system; };
Expand All @@ -26,7 +22,6 @@
static-bins = import ./static-bins
{ inherit nixpkgs fakedir pkgs;
libfakedir = fakedir.packages.aarch64-darwin.fakedir-universal;
nixStatics."aarch64-linux" = nix.packages.aarch64-linux.nix-static;
};

} // (if system == "x86_64-darwin" || system == "aarch64-darwin"
Expand Down
39 changes: 37 additions & 2 deletions nix

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ef782b1

Please sign in to comment.