Skip to content

Commit

Permalink
Improve devshells
Browse files Browse the repository at this point in the history
  • Loading branch information
addisonbeck committed Oct 24, 2024
1 parent aafd2bb commit 747909d
Showing 1 changed file with 33 additions and 13 deletions.
46 changes: 33 additions & 13 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -86,26 +86,46 @@
in {
default = pkgs.mkShell {
inputsFrom = with self.devShells.${system}; [
building
managing-secrets
formatting
editing
];
building
managing-secrets
formatting
editing
];
};
building = pkgs.mkShell {
packages = [
] ++ pkgs.lib.optionals pkgs.stdenv.isDarwin [
nix-darwin.packages.${system}.default
];
packages =
[
(pkgs.writeScriptBin "update" ''
nix flake update
'')
]
++ pkgs.lib.optionals pkgs.stdenv.isDarwin [
nix-darwin.packages.${system}.default
(pkgs.writeScriptBin "rebuild" ''
darwin-rebuild switch --flake .#"$1"
'')
]
++ pkgs.lib.optionals pkgs.stdenv.isLinux [
nix-darwin.packages.${system}.default
(pkgs.writeScriptBin "rebuild" ''
nixos-rebuild switch --flake .#"$1"
'')
];
};
formatting = pkgs.mkShell {
packages = [
(treefmt-nix.lib.evalModule nixpkgs.legacyPackages.${system} ./treefmt.nix).config.build.wrapper
(pkgs.writeScriptBin "check-formatting" ''
treefmt --fail-on-change
(pkgs.writeScriptBin "check" ''
if [ "$1" == "formatting" ]; then
echo "Checking formatting..."
treefmt --fail-on-change
fi
'')
(pkgs.writeScriptBin "apply-formatting" ''
treefmt
(pkgs.writeScriptBin "apply" ''
if [ "$1" == "formatting" ]; then
echo "Applying formatting..."
treefmt
fi
'')
];
};
Expand Down

0 comments on commit 747909d

Please sign in to comment.