This commit is contained in:
Dmitry Zuikov 2023-02-15 14:56:11 +03:00
parent b6af96db6c
commit 0bbe002fff
5 changed files with 285 additions and 24 deletions

View File

@ -227,15 +227,16 @@
},
"nixpkgs_2": {
"locked": {
"lastModified": 1675931149,
"narHash": "sha256-UcsoOsP9tDlENB1KKdr9EgSmA124id6OxpHb7IpHlD8=",
"lastModified": 1676209454,
"narHash": "sha256-alj9mBkV9U6tTPDK026671D2pesLSYZZc9j5dBZJ9f0=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "47773312034cce8fc09ee166df4d61dd47d8e7d9",
"rev": "8c619a1f3cedd16ea172146e30645e703d21bfc1",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}

View File

@ -3,7 +3,7 @@ description = "hbs2";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs";
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
# haskell-flake-utils.url = "github:ivanovs-4/haskell-flake-utils";
haskell-flake-utils.url = "github:ivanovs-4/haskell-flake-utils/master";
hspup.url = "github:voidlizard/hspup";

View File

@ -493,8 +493,8 @@ runPeer opts = Exception.handle myException $ do
request localMulticast announce
liftIO $ withPeerM env do
debug "send single-cast announces"
forKnownPeers $ \p _ -> do
debug $ "send single-cast announces" <+> pretty p
request @e p announce
CHECK nonce pa h -> do
@ -599,6 +599,7 @@ runPeer opts = Exception.handle myException $ do
self <- ownPeer @e
subscribe @e BlockAnnounceInfoKey $ \(BlockAnnounceEvent p bi no) -> do
debug "Peer announce wtf?"
unless (p == self) do
pa <- toPeerAddr p
liftIO $ atomically $ writeTQueue rpcQ (CHECK no pa (view biHash bi))

View File

@ -19,6 +19,29 @@
"type": "github"
}
},
"fixme": {
"inputs": {
"haskell-flake-utils": "haskell-flake-utils",
"nixpkgs": [
"hbs2",
"nixpkgs"
],
"suckless-conf": "suckless-conf"
},
"locked": {
"lastModified": 1676442489,
"narHash": "sha256-uYkq5T+SwflDjL0gMVGIte6zKMLMrSwjskcEQo6jMRs=",
"owner": "voidlizard",
"repo": "fixme",
"rev": "e13eda2bf1b58064a56bf38a46b1643c2927b334",
"type": "github"
},
"original": {
"owner": "voidlizard",
"repo": "fixme",
"type": "github"
}
},
"flake-utils": {
"locked": {
"lastModified": 1667395993,
@ -64,6 +87,51 @@
"type": "github"
}
},
"flake-utils_4": {
"locked": {
"lastModified": 1644229661,
"narHash": "sha256-1YdnJAsNy69bpcjuoKdOYQX0YxZBiCYZo4Twxerqv7k=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "3cecb5b042f7f209c56ffd8371b2711a290ec797",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_5": {
"locked": {
"lastModified": 1644229661,
"narHash": "sha256-1YdnJAsNy69bpcjuoKdOYQX0YxZBiCYZo4Twxerqv7k=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "3cecb5b042f7f209c56ffd8371b2711a290ec797",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_6": {
"locked": {
"lastModified": 1644229661,
"narHash": "sha256-1YdnJAsNy69bpcjuoKdOYQX0YxZBiCYZo4Twxerqv7k=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "3cecb5b042f7f209c56ffd8371b2711a290ec797",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"haskell-flake-utils": {
"inputs": {
"flake-utils": "flake-utils_2"
@ -78,7 +146,6 @@
},
"original": {
"owner": "ivanovs-4",
"ref": "master",
"repo": "haskell-flake-utils",
"type": "github"
}
@ -96,39 +163,117 @@
"type": "github"
},
"original": {
"owner": "ivanovs-4",
"repo": "haskell-flake-utils",
"type": "github"
}
},
"haskell-flake-utils_3": {
"inputs": {
"flake-utils": "flake-utils_4"
},
"locked": {
"lastModified": 1672412555,
"narHash": "sha256-Kaa8F7nQFR3KuS6Y9WRUxeJeZlp6CCubyrRfmiEsW4k=",
"owner": "ivanovs-4",
"repo": "haskell-flake-utils",
"rev": "896219e5bde6efac72198550454e9dd9b5ed9ac9",
"type": "github"
},
"original": {
"owner": "ivanovs-4",
"ref": "master",
"repo": "haskell-flake-utils",
"type": "github"
}
},
"haskell-flake-utils_4": {
"inputs": {
"flake-utils": "flake-utils_5"
},
"locked": {
"lastModified": 1672412555,
"narHash": "sha256-Kaa8F7nQFR3KuS6Y9WRUxeJeZlp6CCubyrRfmiEsW4k=",
"owner": "ivanovs-4",
"repo": "haskell-flake-utils",
"rev": "896219e5bde6efac72198550454e9dd9b5ed9ac9",
"type": "github"
},
"original": {
"owner": "ivanovs-4",
"repo": "haskell-flake-utils",
"rev": "896219e5bde6efac72198550454e9dd9b5ed9ac9",
"type": "github"
}
},
"haskell-flake-utils_5": {
"inputs": {
"flake-utils": "flake-utils_6"
},
"locked": {
"lastModified": 1672412555,
"narHash": "sha256-Kaa8F7nQFR3KuS6Y9WRUxeJeZlp6CCubyrRfmiEsW4k=",
"owner": "ivanovs-4",
"repo": "haskell-flake-utils",
"rev": "896219e5bde6efac72198550454e9dd9b5ed9ac9",
"type": "github"
},
"original": {
"owner": "ivanovs-4",
"repo": "haskell-flake-utils",
"type": "github"
}
},
"hbs2": {
"inputs": {
"haskell-flake-utils": "haskell-flake-utils",
"fixme": "fixme",
"haskell-flake-utils": "haskell-flake-utils_3",
"hspup": "hspup",
"nixpkgs": [
"nixpkgs"
],
"saltine": "saltine"
"saltine": "saltine",
"suckless-conf": "suckless-conf_2"
},
"locked": {
"lastModified": 1675665762,
"narHash": "sha256-zVfyDqVyPgMXMsj/od1xmOCQz5gkHzi3pTyf83qaqF0=",
"lastModified": 1676454454,
"narHash": "sha256-d6SjaJIwYwuwsCh+Ed6Mjyx12LY48hRqbWkcXpyQ35w=",
"owner": "voidlizard",
"repo": "hbs2",
"rev": "85d34209e10016fc243e37e221dca8217af3f7bb",
"rev": "b6af96db6c41c5bec176e892a9716a4161c9049c",
"type": "github"
},
"original": {
"owner": "voidlizard",
"ref": "wip",
"ref": "announce-group",
"repo": "hbs2",
"type": "github"
}
},
"home-manager": {
"inputs": {
"nixpkgs": [
"nixpkgs"
],
"utils": "utils"
},
"locked": {
"lastModified": 1675935446,
"narHash": "sha256-WajulTn7QdwC7QuXRBavrANuIXE5z+08EdxdRw1qsNs=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "2dce7f1a55e785a22d61668516df62899278c9e4",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "home-manager",
"type": "github"
}
},
"hspup": {
"inputs": {
"haskell-flake-utils": "haskell-flake-utils_2",
"haskell-flake-utils": "haskell-flake-utils_4",
"nixpkgs": [
"hbs2",
"nixpkgs"
@ -166,16 +311,31 @@
},
"nixpkgs_2": {
"locked": {
"lastModified": 1675600654,
"narHash": "sha256-ipsDTkzRq1CAl2g5tYd7ugjVMSKF6KLh9F+5Kso0lT0=",
"lastModified": 1675758091,
"narHash": "sha256-7gFSQbSVAFUHtGCNHPF7mPc5CcqDk9M2+inlVPZSneg=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "747927516efcb5e31ba03b7ff32f61f6d47e7d87",
"type": "github"
},
"original": {
"owner": "NixOS",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_3": {
"locked": {
"lastModified": 1676209454,
"narHash": "sha256-alj9mBkV9U6tTPDK026671D2pesLSYZZc9j5dBZJ9f0=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "cff83d5032a21aad4f69bf284e95b5f564f4a54e",
"rev": "8c619a1f3cedd16ea172146e30645e703d21bfc1",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-22.11",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
@ -184,7 +344,8 @@
"inputs": {
"extra-container": "extra-container",
"hbs2": "hbs2",
"nixpkgs": "nixpkgs_2"
"home-manager": "home-manager",
"nixpkgs": "nixpkgs_3"
}
},
"saltine": {
@ -203,6 +364,62 @@
"rev": "3d3a54cf46f78b71b4b55653482fb6f4cee6b77d",
"type": "github"
}
},
"suckless-conf": {
"inputs": {
"haskell-flake-utils": "haskell-flake-utils_2",
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1675946914,
"narHash": "sha256-OE0R9dnB+ZXpf30g1xVSMur68iKUDB53pnyA3K2e788=",
"owner": "voidlizard",
"repo": "suckless-conf",
"rev": "995e1cd52cfe2e9aa4e00ea5cd016548f7932e5a",
"type": "github"
},
"original": {
"owner": "voidlizard",
"repo": "suckless-conf",
"type": "github"
}
},
"suckless-conf_2": {
"inputs": {
"haskell-flake-utils": "haskell-flake-utils_5",
"nixpkgs": [
"hbs2",
"nixpkgs"
]
},
"locked": {
"lastModified": 1675946914,
"narHash": "sha256-OE0R9dnB+ZXpf30g1xVSMur68iKUDB53pnyA3K2e788=",
"owner": "voidlizard",
"repo": "suckless-conf",
"rev": "995e1cd52cfe2e9aa4e00ea5cd016548f7932e5a",
"type": "github"
},
"original": {
"owner": "voidlizard",
"repo": "suckless-conf",
"type": "github"
}
},
"utils": {
"locked": {
"lastModified": 1667395993,
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
}
},
"root": "root",

View File

@ -4,13 +4,16 @@
inputs = {
extra-container.url = "github:erikarvstedt/extra-container";
nixpkgs.url = "github:nixos/nixpkgs/nixos-22.11";
hbs2.url = "github:voidlizard/hbs2/wip";
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
hbs2.url = "github:voidlizard/hbs2/announce-group";
hbs2.inputs.nixpkgs.follows = "nixpkgs";
home-manager.url = "github:nix-community/home-manager";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = { extra-container, ... }@inputs:
outputs = { extra-container, nixpkgs, home-manager, ... }@inputs:
extra-container.inputs.flake-utils.lib.eachSystem extra-container.lib.supportedSystems (system: {
packages.default = extra-container.lib.buildContainers {
# The system of the container host
@ -24,6 +27,16 @@
# If unset, the nixpkgs input of extra-container flake is used
nixpkgs = inputs.nixpkgs;
# home-manager.homeConfigurations = {
# # FIXME replace with your username@hostname
# "root@minipig" = home-manager.lib.homeManagerConfiguration {
# pkgs = nixpkgs.legacyPackages.x86_64-linux; # Home-manager requires 'pkgs' instance
# extraSpecialArgs = { inherit inputs; }; # Pass flake inputs to our config
# # > Our main home-manager configuration file <
# modules = [ ./home/home.nix ];
# };
# };
# Set this to disable `nix run` support
# addRunner = false;
@ -32,6 +45,12 @@
extra.addressPrefix = "10.250.0";
config = { pkgs, ... }: {
users.users.hbs2 = {
isNormalUser = true;
home = "/home/hbs2";
};
systemd.services.hello = {
wantedBy = [ "multi-user.target" ];
script = ''
@ -49,14 +68,37 @@
tshark
];
# modules = [
# inputs.hbs2.packages.${pkgs.system}.default
# ];
# environment.xdg.data."hbs2/wtf" = {
# text = "pwned";
# };
environment.etc."hbs2-peer/key" = {
text = ''
# hbs2 credentials file
# keep it private
rmbTHUgv7NPkygrgEbPWTjQbVTx9uwWJ7sJVQRKK7ygM73q5Q7JVYhpwfytK
kzoNq65jn1zDCUUMwLFzXeu4ETjG4bhYNM7FHU9xY4VdwEww156iJeoydJ2y
j1u3RJEr8kosBH2DR8XMY6Mj8s
'';
};
environment.etc."hbs2-peer/config" = {
text = ''
listen "0.0.0.0:7351"
rpc "127.0.0.1:13331"
key "./key"
storage "/root/hbs2"
accept-block-announce "AAh9rjcgg2Zfmd9c8xAhVPBEmUCyYM7wHGxjjqYDZYRb"
'';
};
};
};
};
};
});
}