dotfiles/dev-shells/default.nix
magic_rb 0690ab217f
Add nix-fast-build, nix-eval-jobs and nom to workstation profile
Signed-off-by: magic_rb <magic_rb@redalder.org>
2024-11-10 23:08:55 +01:00

93 lines
2.8 KiB
Nix

{inputs, ...}: let
inherit
(inputs)
self
;
in {
perSystem = {
system,
pkgs,
...
}: {
devShells.default = let
unpackSrc = package:
pkgs.stdenv.mkDerivation {
pname = package.pname;
version = package.version;
src = package.src;
phases = ["unpackPhase" "installPhase"];
installPhase = ''
mkdir $out
cp -r . $out
'';
};
prepareDeps = pkgs.writeShellScript "prepare-deps.sh" ''
cd "$(git rev-parse --show-toplevel)/home-manager/modules/xmonad"
mkdir -p .packages
_rsync_args=("--no-perms" "--no-owner" "--no-group" "--del" "--exclude=.stack-work" "--chmod=ugo=rwX" "-crvP")
rsync "''${_rsync_args[@]}" ${unpackSrc pkgs.haskell.packages.ghc946.xmonad}/. .packages/xmonad >/dev/null 2>&1
rsync "''${_rsync_args[@]}" ${unpackSrc pkgs.haskell.packages.ghc946.xmonad-contrib}/. .packages/xmonad-contrib >/dev/null 2>&1
rsync "''${_rsync_args[@]}" ${unpackSrc pkgs.haskell.packages.ghc946.xmobar}/. .packages/xmobar >/dev/null 2>&1
'';
stack-wrapped = pkgs.symlinkJoin {
name = "stack"; # will be available as the usual `stack` in terminal
paths = [pkgs.stack];
buildInputs = [pkgs.makeWrapper];
postBuild = ''
wrapProgram $out/bin/stack \
--run "${prepareDeps}"\
--add-flags "\
--no-nix \
--system-ghc \
--no-install-ghc \
"
'';
};
inherit
(pkgs.callPackage ../scripts/nix-secret-wrapper {})
nixos-rebuild
nix
;
nix-verify =
pkgs.callPackage ../scripts/nix-verify {};
in
pkgs.mkShell {
shellHook = ''
${self.checks.${system}.pre-commit.shellHook}
'';
nativeBuildInputs = with pkgs;
[
(pkgs.writeShellScriptBin "update-secret" ''
nix flake lock --update-input secret
'')
nil
nix
nixos-rebuild
nix-verify
(nomad.overrideAttrs (old: {meta = old.meta // {license = "mpl-2.0";};}))
(consul.overrideAttrs (old: {meta = old.meta // {license = "mpl-2.0";};}))
(vault.overrideAttrs (old: {meta = old.meta // {license = "mpl-2.0";};}))
kubectl
kubeconform
gcc-arm-embedded-9
haskell.compiler.ghc946
stack-wrapped
pkg-config
haskell.packages.ghc946.haskell-language-server
jq
alejandra
]
++ (lib.foldl (acc: x: acc ++ x) [] (map (x: pkgs.haskell.packages.ghc946.${x}.buildInputs) ["gi-pangocairo" "X11" "cairo" "glib"]));
};
};
}