1
1
mirror of https://github.com/divnix/digga.git synced 2024-12-25 09:04:07 +03:00
digga/shell/default.nix
Timothy DeHerrera caba5fd756
deploy-rs: init support
Managing servers remotely is a big usecase, and deploy-rs is a flake
first deployment tool. By default, all nixosConfigurations are also
setup as deploy-rs nodes.

You'll still need to do some manual ssh setup, but other than that, the
system is ready to deploy.
2021-02-14 22:17:24 -07:00

63 lines
1.4 KiB
Nix

{ self ? (import ../compat).defaultNix
, system ? builtins.currentSystem
}:
let
pkgs = (self.lib.genPkgs { inherit self; }).${system};
inherit (pkgs) lib;
installPkgs = (lib.nixosSystem {
inherit system;
modules = [ ];
}).config.system.build;
flk = pkgs.callPackage ./flk.nix { };
inherit (flk) name;
in
pkgs.devshell.mkShell {
inherit name;
packages = with pkgs; with installPkgs; [
git-crypt
nixos-install
nixos-generate-config
nixos-enter
] ++ lib.optional (system == "x86_64-linux") deploy-rs;
env = { inherit name; };
git.hooks = {
enable = true;
pre-commit.text = lib.fileContents ./pre-commit.sh;
};
commands = with pkgs; let
mkCommand = category: package: {
inherit package category;
name = package.pname or package.name;
help = package.meta.description;
};
mapCmd = category: map (mkCommand category);
in
mapCmd "main"
(
[ flk git ] ++
lib.optional (system != "i686-linux") cachix
) ++
mapCmd "linters" [ nixpkgs-fmt editorconfig-checker ] ++
mapCmd "documentation" [ python3Packages.grip mdbook ] ++ [
{
name = "nix";
help = nixFlakes.meta.description;
category = "main";
command = ''
${nixFlakes}/bin/nix --option experimental-features \
"nix-command flakes ca-references" "$@"
'';
}
];
}