forked from rarias/jungle
Compare commits
3 Commits
518720e503
...
49f0e263da
| Author | SHA1 | Date | |
|---|---|---|---|
|
49f0e263da
|
|||
|
a37f4435eb
|
|||
|
c5b7122b31
|
21
flake.nix
21
flake.nix
@@ -5,19 +5,14 @@
|
||||
|
||||
outputs = { self, nixpkgs, ... }:
|
||||
let
|
||||
forAllSystems = nixpkgs.lib.genAttrs [ "x86_64-linux" "aarch64-linux" "armv6l-linux" "armv7l-linux" "i686-linux" "riscv64-linux" ];
|
||||
|
||||
mkConf = name: nixpkgs.lib.nixosSystem {
|
||||
system = "x86_64-linux";
|
||||
specialArgs = { inherit nixpkgs; theFlake = self; };
|
||||
modules = [ "${self.outPath}/m/${name}/configuration.nix" ];
|
||||
};
|
||||
# For now we only support x86
|
||||
system = "x86_64-linux";
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
overlays = [ self.overlays.default ];
|
||||
config.allowUnfree = true;
|
||||
};
|
||||
in
|
||||
in
|
||||
{
|
||||
nixosConfigurations = {
|
||||
hut = mkConf "hut";
|
||||
@@ -38,9 +33,15 @@ in
|
||||
overlays.default = self.bscOverlay;
|
||||
|
||||
# full nixpkgs with our overlay applied
|
||||
legacyPackages.${system} = pkgs;
|
||||
legacyPackages = forAllSystems (system:
|
||||
import nixpkgs {
|
||||
inherit system;
|
||||
overlays = [ self.overlays.default ];
|
||||
config.allowUnfree = true;
|
||||
}
|
||||
);
|
||||
|
||||
hydraJobs = self.legacyPackages.${system}.bsc.hydraJobs;
|
||||
hydraJobs = self.legacyPackages.x86_64-linux.bsc.hydraJobs;
|
||||
|
||||
# propagate nixpkgs lib, so we can do bscpkgs.lib
|
||||
lib = nixpkgs.lib // {
|
||||
|
||||
@@ -19,6 +19,16 @@ with builtins;
|
||||
compression ? "zstd -19 -T0",
|
||||
lib ? pkgs.lib,
|
||||
pkgs ? import <nixpkgs> {},
|
||||
|
||||
# pkgs set from the host system (just for eval in installDynamic)
|
||||
pkgsHost ?
|
||||
if stdenv.hostPlatform == stdenv.buildPlatform then
|
||||
pkgs
|
||||
else
|
||||
import pkgs.path {
|
||||
system = pkgs.stdenv.hostPlatform.system;
|
||||
},
|
||||
|
||||
# hardcode executable to run. Useful when creating a bundle.
|
||||
bundledPackage ? null,
|
||||
|
||||
@@ -86,9 +96,9 @@ let
|
||||
'';
|
||||
|
||||
installDynamic = pkgname: let
|
||||
out = pkgs.${pkgname}.out;
|
||||
out = builtins.unsafeDiscardStringContext pkgsHost.${pkgname}.out.outPath;
|
||||
in ''
|
||||
if [ ! -e \$store${lib.removePrefix "/nix/store" pkgs.${pkgname}.out} ] ; then
|
||||
if [ ! -e \$store${lib.removePrefix "/nix/store" out} ] ; then
|
||||
debug "Installing ${pkgname}"
|
||||
\$run \$store${lib.removePrefix "/nix/store" nix}/bin/nix build --impure --no-link --expr "
|
||||
(import ${nixpkgsSrc} {}).${pkgname}.out
|
||||
@@ -254,7 +264,7 @@ let
|
||||
fi
|
||||
|
||||
# Override $SHELL with nix bashInteractive
|
||||
export SHELL="${pkgs.bashInteractive.out}/bin/bash"
|
||||
export SHELL="${builtins.unsafeDiscardStringContext pkgsHost.bashInteractive.out.outPath}/bin/bash"
|
||||
export PS1="\n\[\033[1;32m\][\[\e]0;\u@\h: \w\a\]\u@\h:\w]\$\[\033[0m\] "
|
||||
|
||||
# unset bash function aliases
|
||||
@@ -299,7 +309,7 @@ let
|
||||
|
||||
|
||||
collectBinds(){
|
||||
pathsTopLevel="/boot /run /sys \$PWD /gpfs /tmp /scratch"
|
||||
pathsTopLevel="/boot /run /sys \$PWD /gpfs /tmp /scratch /home"
|
||||
|
||||
toBind=""
|
||||
for p in \$pathsTopLevel; do
|
||||
|
||||
Reference in New Issue
Block a user