Skip to content

Commit

Permalink
Add nix files
Browse files Browse the repository at this point in the history
Signed-off-by: Manuel Mendez <[email protected]>
Signed-off-by: Thierry Laurion <[email protected]>
  • Loading branch information
mmlb authored and tlaurion committed May 2, 2024
1 parent de3f4ec commit 2824f48
Show file tree
Hide file tree
Showing 4 changed files with 190 additions and 0 deletions.
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
has nix && use flake
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
*.xz
*~
.*.sw*
/.direnv
clean
config/*.old
crossgcc
typescript*
result
61 changes: 61 additions & 0 deletions flake.lock

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

126 changes: 126 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
{
description = "heads flake, mostly for devshell for now";

inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};

outputs = {
self,
flake-utils,
nixpkgs,
...
}:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = nixpkgs.legacyPackages.${system};
lib = pkgs.lib;
deps = with pkgs;
[
autoconf
automake
bashInteractive
coreutils
bc
bison # Generate flashmap descriptor parser
bzip2
cacert
ccache
cmake
cpio
curl
diffutils
dtc
e2fsprogs
elfutils
findutils
flex
gawk
git
gnat
gnugrep
gnumake
gnused
gnutar
gzip
imagemagick
innoextract
libtool
m4
ncurses5 # make menuconfig and slang
parted
patch
perl
pkg-config
python3
rsync
sharutils
texinfo
unzip
wget
which
xz
zip
zlib
zlib.dev
]
++ [
# blobs/xx30/vbios_[tw]530.sh
bundler
p7zip
ruby
sudo # ( °-° )
upx
]
++ [
# debugging/fixing/testing
qemu
vim
];
in {
devShell = pkgs.mkShellNoCC {
buildInputs = deps;
};
packages.myDevShell =
pkgs.runCommand "my-dev-shell" {}
#bash
''
grep \
-e CMAKE_PREFIX_PATH \
-e NIX_CC_WRAPPER_TARGET_TARGET \
-e NIX_CFLAGS_COMPILE_FOR_TARGET \
-e NIX_LDFLAGS_FOR_TARGET \
-e PKG_CONFIG_PATH_FOR_TARGET \
${self.devShell.${system}} >$out
'';
packages.dockerImage = pkgs.dockerTools.buildLayeredImage {
name = "linuxboot/heads";
tag = "dev-env";
config.Entrypoint = ["bash" "-c" ''source /devenv.sh; if (( $# == 0 )); then exec bash; else exec "$0" "$@"; fi''];
contents =
deps
++ [
pkgs.dockerTools.binSh
pkgs.dockerTools.caCertificates
pkgs.dockerTools.usrBinEnv
];
enableFakechroot = true;
fakeRootCommands =
#bash
''
set -e
grep \
-e NIX_CC_WRAPPER_TARGET_TARGET \
-e NIX_CFLAGS_COMPILE_FOR_TARGET \
-e NIX_LDFLAGS_FOR_TARGET \
-e NIX_PKG_CONFIG_WRAPPER_TARGET \
-e PKG_CONFIG_PATH_FOR_TARGET \
${self.devShell.${system}} >/devenv.sh
printf '[safe]\n\tdirectory = *\n' >/.gitconfig
mkdir /tmp;
'';
};
});
}

0 comments on commit 2824f48

Please sign in to comment.