mirror of
https://github.com/RGBCube/crash
synced 2025-07-26 16:07:43 +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
|
!.gitignore
|
||||||
|
|
||||||
!*.lock
|
!*.lock
|
||||||
|
!*.md
|
||||||
!*.nix
|
!*.nix
|
||||||
!*.zig
|
!*.zig
|
||||||
!*.zon
|
!*.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";
|
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
||||||
|
|
||||||
outputs = { nixpkgs, ... }: with nixpkgs.lib; foldl' recursiveUpdate {} (map (system: let
|
outputs = { self, nixpkgs }: let
|
||||||
pkgs = import nixpkgs { inherit system; };
|
inherit (nixpkgs) lib;
|
||||||
|
|
||||||
|
forEachSystem = lib.genAttrs [ "x86_64-linux" "aarch64-linux" "riscv64-linux" ];
|
||||||
in {
|
in {
|
||||||
devShell.${system} = pkgs.mkShell {
|
devShell = forEachSystem (system: with nixpkgs.legacyPackages.${system}; mkShell {
|
||||||
packages = with pkgs; [
|
packages = [
|
||||||
zig_0_12
|
zig_0_12
|
||||||
zls
|
zls
|
||||||
zon2nix
|
zon2nix
|
||||||
];
|
];
|
||||||
};
|
});
|
||||||
|
|
||||||
packages.${system} = rec {
|
packages = forEachSystem (system: rec {
|
||||||
crash = pkgs.callPackage ./package.nix {};
|
inherit (self.overlays.crash null nixpkgs.legacyPackages.${system}) crash;
|
||||||
|
default = crash;
|
||||||
|
});
|
||||||
|
|
||||||
|
overlays = rec {
|
||||||
|
crash = (final: prev: { crash = prev.callPackage ./package.nix {}; });
|
||||||
default = crash;
|
default = crash;
|
||||||
};
|
};
|
||||||
|
};
|
||||||
}) [ "x86_64-linux" "aarch64-linux" "riscv64-linux" ]);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
zig_0_12,
|
zig_0_12,
|
||||||
optimize ? "ReleaseFast",
|
optimize ? "ReleaseFast",
|
||||||
|
|
||||||
bash,
|
bashInteractive,
|
||||||
fallbackShell ? bash,
|
fallbackShell ? bashInteractive,
|
||||||
}:
|
}:
|
||||||
|
|
||||||
stdenvNoCC.mkDerivation {
|
stdenvNoCC.mkDerivation {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue