-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathflake.nix
75 lines (66 loc) · 2.2 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
{
inputs = {
nixpkgs.url = "nixpkgs/nixos-unstable";
utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, utils }:
utils.lib.eachDefaultSystem (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.2";
inherit src;
#cargoHash = pkgs.lib.fakeHash;
cargoHash = "sha256-wuM68jb96b3YETQeWTU4/4NE3bIsP1pawSOudGrsjrQ=";
};
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")
'';
});
};
};
}