我有 nixos 机器(使用 terraform, config 配置),我想使用deployment.targetHost = ipAddress和连接到它deployment.targetEnv = "none"
但是我不能配置 nixops 来使用/secrets/stage_ssh_keyssh 密钥
这不起作用(实际上这没有记录,我在这里找到了https://github.com/NixOS/nixops/blob/d4e5b779def1fc9e7cf124930d0148e6bd670051/nixops/backends/none.py#L33-L35)
{
stage =
{ pkgs, ... }:
{
deployment.targetHost = (import ./nixos-generated/stage.nix).terraform.ip;
deployment.targetEnv = "none";
deployment.none.sshPrivateKey = builtins.readFile ./secrets/stage_ssh_key;
deployment.none.sshPublicKey = builtins.readFile ./secrets/stage_ssh_key.pub;
deployment.none.sshPublicKeyDeployed = true;
environment.systemPackages = with pkgs; [
file
];
};
}
Run Code Online (Sandbox Code Playgroud)
nixops ssh stage 结果要求输入密码,预期 - 无需密码登录
nixops ssh stage -i ./secrets/stage_ssh_key 按预期工作,不询问密码
如何重现:
rm -rf secrets/*添加aws键 secrets/aws.nix
{
EC2_ACCESS_KEY="XXXX";
EC2_SECRET_KEY="XXXX"; …
如果我使用:messagesvim命令,我可以使用vim日志进行寻呼模式,我无法选择没有鼠标的行(在某些程序中,如neovim-qt我甚至无法使用右键菜单(如在gnome终端中)来复制文本)
如何复制3个最后一行?
我正在查看一些列表操作并遇到了!!:
(!!) :: [a] -> Int -> a
xs !! n
| n < 0 = negIndex
| otherwise = foldr (\x r k -> case k of
0 -> x
_ -> r (k-1)) tooLarge xs n
Run Code Online (Sandbox Code Playgroud)
该函数(\x r k -> ...)具有 type a -> (Int -> a) -> Int -> a,但foldr需要一个只接受两个参数的函数:
foldr :: (a -> b -> b) -> b -> [a] -> b
foldr k z = go
where
go …Run Code Online (Sandbox Code Playgroud) 有条带允许在仪表板上编辑的备注字段
据说This will appear on any invoices and receipts。
这正是我需要的 - 由发票继承并在发票电子邮件中查看的字段
尽管 api 返回的订阅对象上没有备注字段https://stripe.com/docs/api#subscription_object
它在哪里?
我为仿函数(○)制作了点符号,但是我的应用程序(↯)不起作用,我在test3函数声明中有错误
{-# LANGUAGE TypeOperators #-}
module Main where
import Protolude
-- composition of functors, analog of .
infixr 9 ?
type (?) f g a = f (g a)
-- functor application, analog of $
infixr 0 ?
type (?) f a = f a
test :: [] (Maybe Int)
test = [Just 1]
test2 :: ([] ? Maybe) Int
test2 = [Just 1]
test3 :: ([] ? Maybe) ? Int -- error here
test3 = [Just 1] …Run Code Online (Sandbox Code Playgroud) 带推导
let
pkgs = import <nixpkgs> {};
in
with pkgs;
stdenv.mkDerivation {
name = "asdfasdf";
version = "0.1";
src = /home/srghma/opt/foxitsoftware/foxitreader/FoxitReader; # this is executeable file
dontUnpack = true; # not fu**** working
installPhase = ''
echo "not even executed"
'';
}
Run Code Online (Sandbox Code Playgroud)
我有一个错误
nix-build tmp.nix
these derivations will be built:
/nix/store/x75gi70i1i57y8d3k4hhx0r3z5kjn6h6-asdfasdf.drv
building '/nix/store/x75gi70i1i57y8d3k4hhx0r3z5kjn6h6-asdfasdf.drv'...
unpacking sources
unpacking source archive /nix/store/3hnf69pky6mqaxv4jxly9fyywqpq6iml-FoxitReader
do not know how to unpack source archive /nix/store/3hnf69pky6mqaxv4jxly9fyywqpq6iml-FoxitReader
builder for '/nix/store/x75gi70i1i57y8d3k4hhx0r3z5kjn6h6-asdfasdf.drv' failed with exit code 1
error: build of '/nix/store/x75gi70i1i57y8d3k4hhx0r3z5kjn6h6-asdfasdf.drv' …Run Code Online (Sandbox Code Playgroud) 我想声明变量,dotfiles_dir以便所有其他文件都可以看到并使用它。
例如(不工作)
在/etc/nixos/configuration.nix(它是根文件,对吧?)
dotfiles_dir="/home/bjorn/.config/dotfiles";
import "${dotfiles_dir}/nixos/root/default.nix"
Run Code Online (Sandbox Code Playgroud)
并在~/.config/nixpkgs/home.nix(使用https://github.com/rycee/home-manager)中使用它
import "${dotfiles_dir}/nixos/home/default.nix"
Run Code Online (Sandbox Code Playgroud) 例如这个查询可能吗?
CREATE TABLE products (
name text,
price numeric not null,
CHECK (IF price > 0 THEN name IS NOT NULL ELSE name IS NULL END IF)
);
Run Code Online (Sandbox Code Playgroud)
更新:
好像没有
这里https://rextester.com/l/postgresql_online_compiler
它抛出错误
Error(s), warning(s):
42601: syntax error at or near "price"
Run Code Online (Sandbox Code Playgroud)
查看文档https://www.postgresql.org/docs/current/sql-createtable.html#SQL-CREATETABLE-EXCLUDE它说
目前,CHECK 表达式不能包含子查询,也不能引用除当前行的列之外的变量。可以引用系统列 tableoid,但不能引用任何其他系统列。
但IF不是子查询,不明白为什么它不起作用
更新2:
这
CREATE TABLE products (
name text,
price numeric not null,
CHECK ((price > 0 AND name IS NOT NULL) OR (price <= 0 AND name IS NULL)) …Run Code Online (Sandbox Code Playgroud) 假设我有
- 'autoindent' is set by default
- 'autoread' is set by default
- 'backspace' defaults to "indent,eol,start"
- 'backupdir' defaults to .,~/.local/share/nvim/backup (|xdg|)
- 'complete' doesn't include "i"
- 'directory' defaults to ~/.local/share/nvim/swap// (|xdg|), auto-created
Run Code Online (Sandbox Code Playgroud)
我如何autoindent autoread backspace...用视觉块(系统)将系统注册等词语等等
PS已经尝试过vim-multiple-cursors,但是插件有bug(而不是vim方式)并且如果在其间退出多游标模式,则不允许复制粘贴.
我是haskell的新手,我有以下代码
module StateTest where
import Control.Monad.State.Lazy
tick :: State Int Int
tick = do n <- get
put (n+1)
return n
plusOne :: Int -> Int
plusOne = execState tick
main = print $ plusOne 1
Run Code Online (Sandbox Code Playgroud)
我想在之后打印状态值put (n+1)并继续这样的计算
tick = do n <- get
put (n+1)
print
return n
Run Code Online (Sandbox Code Playgroud)
整个代码如何看待这个?
我想要一些<?>可以改变它的运算符
test arg1 >>
test arg2 >>
test arg3 >>
test arg4
Run Code Online (Sandbox Code Playgroud)
对此
test <?> [ arg1
, arg2
, arg3
, arg4
]
Run Code Online (Sandbox Code Playgroud) 从Haskell书中实现Stream (作者Anton Kholomiov)(第70页)
data Stream a = a :& Stream a
Run Code Online (Sandbox Code Playgroud)
我明白这意味着什么:&,但却无法找到它的定位
示例 - runKleisli来自Haskell基本模块的函数
newtype Kleisli m a b = Kleisli { runKleisli :: a -> m b }
Run Code Online (Sandbox Code Playgroud)
这意味着runKleisli有1个参数类型a,必须返回函数m,它有1个参数b?