mirror of
https://github.com/RGBCube/crash
synced 2025-07-25 23:47:44 +00:00
Add README, LICENSE and clean up flake.nix
This commit is contained in:
parent
5d7802cdfd
commit
75eac3e74b
5 changed files with 125 additions and 11 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -5,6 +5,7 @@
|
|||
!.gitignore
|
||||
|
||||
!*.lock
|
||||
!*.md
|
||||
!*.nix
|
||||
!*.zig
|
||||
!*.zon
|
||||
|
|
21
LICENSE.md
Normal file
21
LICENSE.md
Normal file
|
@ -0,0 +1,21 @@
|
|||
# MIT License
|
||||
|
||||
Copyright (c) 2024-present RGBCube
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
86
README.md
Normal file
86
README.md
Normal file
|
@ -0,0 +1,86 @@
|
|||
# crash
|
||||
|
||||
A user-configurable login shell wrapper.
|
||||
|
||||
Crash is a super lightweight shim that executes the shells that are seperated by `:`
|
||||
in your `SHELLS` environment variable in order, halting execution if one exits
|
||||
sucessfully (with a 0 exit code).
|
||||
|
||||
If you don't have anything in your `SHELLS` environment variable, Crash will
|
||||
use the fallback shell that is configured at compile time (by default, this is
|
||||
`bashInteractive` from nixpkgs, however you can change this by overriding the
|
||||
`fallbackShell` call option).
|
||||
|
||||
## Why?
|
||||
|
||||
- To allow users to configure their own shells without superuser access.
|
||||
- To have a fallback shell in case your primary one breaks (especially useful when
|
||||
using new unstable shells like Nushell).
|
||||
|
||||
## Installation
|
||||
|
||||
Simply add this repository to your inputs like so:
|
||||
|
||||
```nix
|
||||
{
|
||||
inputs.crash = {
|
||||
url = "github:RGBCube/crash";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
And then you can set the package as your default user
|
||||
shell like so, in a NixOS module:
|
||||
|
||||
```nix
|
||||
{
|
||||
outputs = { nixpkgs, crash }: {
|
||||
nixosConfigurations.myhostname = nixpkgs.lib.nixosSystem {
|
||||
modules = [
|
||||
({ pkgs, lib, ... }: {
|
||||
nixpkgs.overlays = [ crash.overlays.default ];
|
||||
|
||||
users.defaultUserShell = pkgs.crash;
|
||||
|
||||
# Here we set our default shells. Nushell will be tried first, if that
|
||||
# exits with an error, fish will be launched instead. And if fish fails, the
|
||||
# fallback shell, which is pkgs.bashInteractive will get run.
|
||||
environment.sessionVariables.SHELLS = "${lib.getExe pkgs.nushell}:${lib.getExe pkgs.fish}";
|
||||
})
|
||||
|
||||
# Uncomment to make the fallback shell of crash pkgs.dash. Will require a recompilation!
|
||||
# {
|
||||
# nixpkgs.overlays = [(final: prev: {
|
||||
# crash = prev.crash.override { fallbackShell = final.dash };
|
||||
# })];
|
||||
# }
|
||||
];
|
||||
};
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
```
|
||||
Copyright (c) 2024-present RGBCube
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
```
|
24
flake.nix
24
flake.nix
|
@ -8,21 +8,27 @@
|
|||
|
||||
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
||||
|
||||
outputs = { nixpkgs, ... }: with nixpkgs.lib; foldl' recursiveUpdate {} (map (system: let
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
outputs = { self, nixpkgs }: let
|
||||
inherit (nixpkgs) lib;
|
||||
|
||||
forEachSystem = lib.genAttrs [ "x86_64-linux" "aarch64-linux" "riscv64-linux" ];
|
||||
in {
|
||||
devShell.${system} = pkgs.mkShell {
|
||||
packages = with pkgs; [
|
||||
devShell = forEachSystem (system: with nixpkgs.legacyPackages.${system}; mkShell {
|
||||
packages = [
|
||||
zig_0_12
|
||||
zls
|
||||
zon2nix
|
||||
];
|
||||
};
|
||||
});
|
||||
|
||||
packages.${system} = rec {
|
||||
crash = pkgs.callPackage ./package.nix {};
|
||||
packages = forEachSystem (system: rec {
|
||||
inherit (self.overlays.crash null nixpkgs.legacyPackages.${system}) crash;
|
||||
default = crash;
|
||||
});
|
||||
|
||||
overlays = rec {
|
||||
crash = (final: prev: { crash = prev.callPackage ./package.nix {}; });
|
||||
default = crash;
|
||||
};
|
||||
|
||||
}) [ "x86_64-linux" "aarch64-linux" "riscv64-linux" ]);
|
||||
};
|
||||
}
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
zig_0_12,
|
||||
optimize ? "ReleaseFast",
|
||||
|
||||
bash,
|
||||
fallbackShell ? bash,
|
||||
bashInteractive,
|
||||
fallbackShell ? bashInteractive,
|
||||
}:
|
||||
|
||||
stdenvNoCC.mkDerivation {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue