mirror of
https://gitlab.redox-os.org/redox-os/redox.git
synced 2026-11-04 19:56:36 +08:00
nix: Drop flake-parts
This commit is contained in:
parent
d48b58a9a2
commit
ce274844fd
34
flake.lock
generated
34
flake.lock
generated
@ -1,23 +1,5 @@
|
|||||||
{
|
{
|
||||||
"nodes": {
|
"nodes": {
|
||||||
"flake-parts": {
|
|
||||||
"inputs": {
|
|
||||||
"nixpkgs-lib": "nixpkgs-lib"
|
|
||||||
},
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1782949081,
|
|
||||||
"narHash": "sha256-vp6Y/Grm98ESt6ceOkWiHWyZRDV3J1RID4w+6NWK9yA=",
|
|
||||||
"owner": "hercules-ci",
|
|
||||||
"repo": "flake-parts",
|
|
||||||
"rev": "17c9d6cdfc60c64f4ee8d306f9bc0b4ccb51481e",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "hercules-ci",
|
|
||||||
"repo": "flake-parts",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1784494590,
|
"lastModified": 1784494590,
|
||||||
@ -34,24 +16,8 @@
|
|||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nixpkgs-lib": {
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1782614948,
|
|
||||||
"narHash": "sha256-ePjCwr1sNm9NYUqywL7QfK3JnlS015msC+eBu2zKlp8=",
|
|
||||||
"owner": "nix-community",
|
|
||||||
"repo": "nixpkgs.lib",
|
|
||||||
"rev": "db3f255737b94216eb71cce308e2912cf6bc2d7c",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "nix-community",
|
|
||||||
"repo": "nixpkgs.lib",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"flake-parts": "flake-parts",
|
|
||||||
"nixpkgs": "nixpkgs",
|
"nixpkgs": "nixpkgs",
|
||||||
"rust-overlay": "rust-overlay"
|
"rust-overlay": "rust-overlay"
|
||||||
}
|
}
|
||||||
|
|||||||
323
flake.nix
323
flake.nix
@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
||||||
flake-parts.url = "github:hercules-ci/flake-parts";
|
|
||||||
rust-overlay = {
|
rust-overlay = {
|
||||||
url = "github:oxalica/rust-overlay";
|
url = "github:oxalica/rust-overlay";
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
@ -11,177 +10,167 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
outputs =
|
outputs =
|
||||||
inputs@{
|
{
|
||||||
nixpkgs,
|
nixpkgs,
|
||||||
flake-parts,
|
|
||||||
rust-overlay,
|
rust-overlay,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
flake-parts.lib.mkFlake { inherit inputs; } (
|
let
|
||||||
{
|
systems = [
|
||||||
...
|
"i686-linux"
|
||||||
}:
|
"x86_64-linux"
|
||||||
{
|
"aarch64-linux"
|
||||||
systems = [
|
"x86_64-darwin"
|
||||||
"i686-linux"
|
"aarch64-darwin"
|
||||||
"x86_64-linux"
|
];
|
||||||
"aarch64-linux"
|
|
||||||
"x86_64-darwin"
|
overlays = [ rust-overlay.overlays.default ];
|
||||||
"aarch64-darwin"
|
|
||||||
];
|
pkgsFor =
|
||||||
perSystem =
|
system:
|
||||||
{
|
import nixpkgs {
|
||||||
system,
|
inherit system overlays;
|
||||||
...
|
};
|
||||||
}:
|
|
||||||
|
forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f (pkgsFor system));
|
||||||
|
in
|
||||||
|
{
|
||||||
|
formatter = forAllSystems (pkgs: pkgs.nixfmt-tree);
|
||||||
|
|
||||||
|
# TODO: Create Redox OS Image as package
|
||||||
|
# TODO: No cross-compile for now, as there is no pkgsCross.aarch64-unknown-redox and so on
|
||||||
|
# TODO: Get rid of make env step: package custom libtool and setup rust toolchain properly
|
||||||
|
devShells = forAllSystems (pkgs: {
|
||||||
|
# Podman config taken from https://nixos.wiki/wiki/Podman and https://gist.github.com/adisbladis/187204cb772800489ee3dac4acdd9947
|
||||||
|
# Provides a script that copies required files to ~/
|
||||||
|
default =
|
||||||
let
|
let
|
||||||
pkgs = import nixpkgs {
|
podmanSetupScript =
|
||||||
inherit system;
|
let
|
||||||
|
registriesConf = pkgs.writeText "registries.conf" ''
|
||||||
overlays = [ rust-overlay.overlays.default ];
|
[registries.search]
|
||||||
};
|
registries = ['docker.io']
|
||||||
rust-bin = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
|
[registries.block]
|
||||||
in
|
registries = []
|
||||||
{
|
|
||||||
formatter = pkgs.nixfmt-rfc-style;
|
|
||||||
|
|
||||||
# TODO: Create Redox OS Image as package
|
|
||||||
# TODO: No cross-compile for now, as there is no pkgsCross.aarch64-unknown-redox and so on
|
|
||||||
# TODO: Get rid of make env step: package custom libtool and setup rust toolchain properly
|
|
||||||
devShells = {
|
|
||||||
# Podman config taken from https://nixos.wiki/wiki/Podman and https://gist.github.com/adisbladis/187204cb772800489ee3dac4acdd9947
|
|
||||||
# Provides a script that copies required files to ~/
|
|
||||||
default =
|
|
||||||
let
|
|
||||||
podmanSetupScript =
|
|
||||||
let
|
|
||||||
registriesConf = pkgs.writeText "registries.conf" ''
|
|
||||||
[registries.search]
|
|
||||||
registries = ['docker.io']
|
|
||||||
[registries.block]
|
|
||||||
registries = []
|
|
||||||
'';
|
|
||||||
in
|
|
||||||
pkgs.writeScript "podman-setup" ''
|
|
||||||
#!${pkgs.runtimeShell}
|
|
||||||
# Dont overwrite customised configuration
|
|
||||||
if ! test -f ~/.config/containers/policy.json; then
|
|
||||||
install -Dm555 ${pkgs.skopeo.src}/default-policy.json ~/.config/containers/policy.json
|
|
||||||
fi
|
|
||||||
if ! test -f ~/.config/containers/registries.conf; then
|
|
||||||
install -Dm555 ${registriesConf} ~/.config/containers/registries.conf
|
|
||||||
fi
|
|
||||||
systemctl --user start podman.socket || true
|
|
||||||
export PODMAN_SYSTEMD_UNIT=podman.socket
|
|
||||||
'';
|
|
||||||
# Provides a fake "docker" binary mapping to podman
|
|
||||||
dockerCompat = pkgs.runCommand "docker-podman-compat" { } ''
|
|
||||||
mkdir -p $out/bin
|
|
||||||
ln -s ${pkgs.podman}/bin/podman $out/bin/docker
|
|
||||||
'';
|
|
||||||
|
|
||||||
in
|
|
||||||
pkgs.mkShell rec {
|
|
||||||
buildInputs = with pkgs; [
|
|
||||||
# Podman
|
|
||||||
dockerCompat
|
|
||||||
podman # Docker compat
|
|
||||||
runc # Container runtime
|
|
||||||
conmon # Container runtime monitor
|
|
||||||
skopeo # Interact with container registry
|
|
||||||
slirp4netns # User-mode networking for unprivileged namespaces
|
|
||||||
fuse-overlayfs # CoW for images, much faster than default vfs
|
|
||||||
|
|
||||||
# with FSTOOLS_IN_PODMAN=1 these are not needed
|
|
||||||
# without it, the installer fails to link FUSE somehow
|
|
||||||
#fuse
|
|
||||||
#rust-bin
|
|
||||||
qemu_kvm
|
|
||||||
];
|
|
||||||
|
|
||||||
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath buildInputs;
|
|
||||||
SKIP_CHECK_TOOLS = "1";
|
|
||||||
FSTOOLS_IN_PODMAN = "1";
|
|
||||||
PODMAN_BUILD = "1";
|
|
||||||
shellHook = ''
|
|
||||||
# Install required configuration
|
|
||||||
${podmanSetupScript}
|
|
||||||
echo "Redox podman build environment loaded"
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
#TODO: This isn't tested yet, use at your own risk
|
|
||||||
native = pkgs.mkShell rec {
|
|
||||||
nativeBuildInputs =
|
|
||||||
let
|
|
||||||
autoreconf269 = pkgs.writeShellScriptBin "autoreconf2.69" "${pkgs.autoconf269}/bin/autoreconf";
|
|
||||||
in
|
|
||||||
with pkgs;
|
|
||||||
[
|
|
||||||
ant
|
|
||||||
autoconf
|
|
||||||
autoreconf269 # gnu-binutils
|
|
||||||
automake
|
|
||||||
bison
|
|
||||||
cmake
|
|
||||||
curl
|
|
||||||
doxygen
|
|
||||||
file
|
|
||||||
flex
|
|
||||||
gettext
|
|
||||||
gnumake
|
|
||||||
gnupatch
|
|
||||||
gperf
|
|
||||||
help2man
|
|
||||||
just
|
|
||||||
llvmPackages.clang
|
|
||||||
llvmPackages.llvm
|
|
||||||
lua
|
|
||||||
m4
|
|
||||||
meson
|
|
||||||
nasm
|
|
||||||
ninja
|
|
||||||
perl
|
|
||||||
perlPackages.HTMLParser
|
|
||||||
perlPackages.Po4a
|
|
||||||
pkg-config
|
|
||||||
pkgconf
|
|
||||||
(python3.withPackages (ps: with ps; [ mako ]))
|
|
||||||
qemu_kvm
|
|
||||||
rust-cbindgen
|
|
||||||
scons
|
|
||||||
texinfo
|
|
||||||
unzip
|
|
||||||
waf
|
|
||||||
wget
|
|
||||||
xdg-utils
|
|
||||||
xxd
|
|
||||||
zip
|
|
||||||
] ++ pkgs.lib.optionals pkgs.stdenv.hostPlatform.isx86 [
|
|
||||||
pkgs.syslinux
|
|
||||||
];
|
|
||||||
|
|
||||||
buildInputs = with pkgs; [
|
|
||||||
rust-bin
|
|
||||||
fuse # fuser
|
|
||||||
libpng # netsurf
|
|
||||||
fontconfig # orbutils
|
|
||||||
SDL # prboom
|
|
||||||
utilmacros # libX11
|
|
||||||
xtrans # libX11
|
|
||||||
];
|
|
||||||
|
|
||||||
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath buildInputs;
|
|
||||||
PERL_PATH = "${pkgs.perl}/bin/perl";
|
|
||||||
SKIP_CHECK_TOOLS = "1";
|
|
||||||
PODMAN_BUILD = "0";
|
|
||||||
shellHook = with pkgs; ''
|
|
||||||
export PKG_CONFIG_PATH="${fuse.dev}/lib/pkgconfig\
|
|
||||||
:${libpng.dev}/lib/pkgconfig"
|
|
||||||
'';
|
'';
|
||||||
};
|
in
|
||||||
};
|
pkgs.writeScript "podman-setup" ''
|
||||||
|
#!${pkgs.runtimeShell}
|
||||||
|
# Dont overwrite customised configuration
|
||||||
|
if ! test -f ~/.config/containers/policy.json; then
|
||||||
|
install -Dm555 ${pkgs.skopeo.src}/default-policy.json ~/.config/containers/policy.json
|
||||||
|
fi
|
||||||
|
if ! test -f ~/.config/containers/registries.conf; then
|
||||||
|
install -Dm555 ${registriesConf} ~/.config/containers/registries.conf
|
||||||
|
fi
|
||||||
|
systemctl --user start podman.socket || true
|
||||||
|
export PODMAN_SYSTEMD_UNIT=podman.socket
|
||||||
|
'';
|
||||||
|
# Provides a fake "docker" binary mapping to podman
|
||||||
|
dockerCompat = pkgs.runCommand "docker-podman-compat" { } ''
|
||||||
|
mkdir -p $out/bin
|
||||||
|
ln -s ${pkgs.podman}/bin/podman $out/bin/docker
|
||||||
|
'';
|
||||||
|
in
|
||||||
|
pkgs.mkShell rec {
|
||||||
|
buildInputs = with pkgs; [
|
||||||
|
# Podman
|
||||||
|
dockerCompat
|
||||||
|
podman # Docker compat
|
||||||
|
runc # Container runtime
|
||||||
|
conmon # Container runtime monitor
|
||||||
|
skopeo # Interact with container registry
|
||||||
|
slirp4netns # User-mode networking for unprivileged namespaces
|
||||||
|
fuse-overlayfs # CoW for images, much faster than default vfs
|
||||||
|
|
||||||
|
# with FSTOOLS_IN_PODMAN=1 these are not needed
|
||||||
|
# without it, the installer fails to link FUSE somehow
|
||||||
|
#fuse
|
||||||
|
qemu_kvm
|
||||||
|
];
|
||||||
|
|
||||||
|
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath buildInputs;
|
||||||
|
SKIP_CHECK_TOOLS = "1";
|
||||||
|
FSTOOLS_IN_PODMAN = "1";
|
||||||
|
PODMAN_BUILD = "1";
|
||||||
|
shellHook = ''
|
||||||
|
# Install required configuration
|
||||||
|
${podmanSetupScript}
|
||||||
|
echo "Redox podman build environment loaded"
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
}
|
|
||||||
);
|
#TODO: This isn't tested yet, use at your own risk
|
||||||
|
native = pkgs.mkShell rec {
|
||||||
|
nativeBuildInputs =
|
||||||
|
let
|
||||||
|
autoreconf269 = pkgs.writeShellScriptBin "autoreconf2.69" "${pkgs.autoconf269}/bin/autoreconf";
|
||||||
|
in
|
||||||
|
with pkgs;
|
||||||
|
[
|
||||||
|
ant
|
||||||
|
autoconf
|
||||||
|
autoreconf269 # gnu-binutils
|
||||||
|
automake
|
||||||
|
bison
|
||||||
|
cmake
|
||||||
|
curl
|
||||||
|
doxygen
|
||||||
|
file
|
||||||
|
flex
|
||||||
|
gettext
|
||||||
|
gnumake
|
||||||
|
gnupatch
|
||||||
|
gperf
|
||||||
|
help2man
|
||||||
|
just
|
||||||
|
llvmPackages.clang
|
||||||
|
llvmPackages.llvm
|
||||||
|
lua
|
||||||
|
m4
|
||||||
|
meson
|
||||||
|
nasm
|
||||||
|
ninja
|
||||||
|
perl
|
||||||
|
perlPackages.HTMLParser
|
||||||
|
perlPackages.Po4a
|
||||||
|
pkg-config
|
||||||
|
pkgconf
|
||||||
|
(python3.withPackages (ps: with ps; [ mako ]))
|
||||||
|
qemu_kvm
|
||||||
|
rust-cbindgen
|
||||||
|
scons
|
||||||
|
texinfo
|
||||||
|
unzip
|
||||||
|
waf
|
||||||
|
wget
|
||||||
|
xdg-utils
|
||||||
|
xxd
|
||||||
|
zip
|
||||||
|
]
|
||||||
|
++ pkgs.lib.optionals pkgs.stdenv.hostPlatform.isx86 [
|
||||||
|
pkgs.syslinux
|
||||||
|
];
|
||||||
|
|
||||||
|
buildInputs = with pkgs; [
|
||||||
|
(pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml)
|
||||||
|
fuse # fuser
|
||||||
|
libpng # netsurf
|
||||||
|
fontconfig # orbutils
|
||||||
|
SDL # prboom
|
||||||
|
utilmacros # libX11
|
||||||
|
xtrans # libX11
|
||||||
|
];
|
||||||
|
|
||||||
|
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath buildInputs;
|
||||||
|
PERL_PATH = "${pkgs.perl}/bin/perl";
|
||||||
|
SKIP_CHECK_TOOLS = "1";
|
||||||
|
PODMAN_BUILD = "0";
|
||||||
|
shellHook = with pkgs; ''
|
||||||
|
export PKG_CONFIG_PATH="${fuse.dev}/lib/pkgconfig\
|
||||||
|
:${libpng.dev}/lib/pkgconfig"
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
});
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user