mirror of
https://github.com/Xe/xn--ts9h
synced 2024-11-22 00:33:02 +00:00
add nix flake metadata
Signed-off-by: Xe <me@christine.website>
This commit is contained in:
parent
42f117272a
commit
b40ab778ea
3 changed files with 65 additions and 5 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -1,6 +1,6 @@
|
|||
.direnv
|
||||
.result
|
||||
.result-*
|
||||
result
|
||||
result-*
|
||||
|
||||
|
||||
# Added by cargo
|
||||
|
|
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -142,7 +142,7 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
|||
|
||||
[[package]]
|
||||
name = "xn--ts9h"
|
||||
version = "0.1.0"
|
||||
version = "0.1.1"
|
||||
dependencies = [
|
||||
"syslog",
|
||||
]
|
||||
|
|
64
flake.nix
64
flake.nix
|
@ -6,10 +6,70 @@
|
|||
|
||||
outputs = { self, nixpkgs, utils }:
|
||||
utils.lib.eachDefaultSystem (system:
|
||||
let pkgs = nixpkgs.legacyPackages.${system};
|
||||
let
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
src = ./.;
|
||||
in {
|
||||
devShells.default = pkgs.mkShell {
|
||||
buildInputs = with pkgs; [ rustc cargo rustfmt rust-analyzer ed ];
|
||||
};
|
||||
});
|
||||
|
||||
packages = rec {
|
||||
bin = pkgs.rustPlatform.buildRustPackage {
|
||||
pname = "xn--ts9h";
|
||||
version = "0.1.1";
|
||||
|
||||
inherit src;
|
||||
|
||||
#cargoHash = pkgs.lib.fakeHash;
|
||||
cargoHash = "sha256-8zSGboy+awtcMj4Zojdv8giEnCiu5nyRxJLfr7ISS7I=";
|
||||
};
|
||||
|
||||
default = pkgs.runCommand "xn--ts9h-files" { } ''
|
||||
mkdir -p $out/bin
|
||||
mkdir -p $out/share/man/man8
|
||||
mkdir -p $out/share/doc
|
||||
|
||||
cp ${bin}/bin/xn--ts9h $out/bin/🥺
|
||||
cp ${src}/🥺.8 $out/share/man/man8
|
||||
cp ${src}/README.md $out/share/doc
|
||||
cp ${src}/LICENSE $out/share/doc
|
||||
'';
|
||||
};
|
||||
}) // {
|
||||
nixosModules.default = { pkgs, lib, config, ... }:
|
||||
with lib; {
|
||||
options.within.security.xn--ts9h = {
|
||||
enable = mkEnableOption "enable the best sudo replacement";
|
||||
};
|
||||
config = mkIf config.within.security.xn--ts9h.enable {
|
||||
security.wrappers."🥺" =
|
||||
let pkg = self.packages.${pkgs.system}.default;
|
||||
in {
|
||||
source = "${pkg}/bin/🥺";
|
||||
setuid = true;
|
||||
setgid = true;
|
||||
owner = "root";
|
||||
group = "root";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
checks.x86_64-linux = let pkgs = nixpkgs.legacyPackages.x86_64-linux;
|
||||
in {
|
||||
basic = pkgs.nixosTest ({
|
||||
name = "basic-tests";
|
||||
nodes.default = { config, pkgs, ... }: {
|
||||
imports = [ self.nixosModules.default ];
|
||||
within.security.xn--ts9h.enable = true;
|
||||
};
|
||||
|
||||
testScript = ''
|
||||
start_all()
|
||||
|
||||
default.wait_for_unit("multi-user.target")
|
||||
'';
|
||||
});
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue