{"id":99772,"date":"2024-07-09T18:44:11","date_gmt":"2024-07-09T10:44:11","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=99772"},"modified":"2024-07-09T18:44:11","modified_gmt":"2024-07-09T10:44:11","slug":"function-linux-nixos","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/function-linux-nixos.html","title":{"rendered":"Linux \u53d1\u884c\u7248 NixOS \u53d1\u5e03 18.03 \u7248"},"content":{"rendered":"
\u5bfc\u8bfb<\/td>\n | NixOS \u662f\u4e00\u4e2a\u72ec\u7acb GNU\/Linux \u53d1\u884c\u7248\uff0c\u4ee5\u72ec\u7279\u7684\u65b9\u5f0f\u8fdb\u884c\u5305\u548c\u914d\u7f6e\u7ba1\u7406\u5e76\u56e0\u7531\u6b64\u5e26\u6765\u7684\u79cd\u79cd\u7279\u6027\u800c\u88ab\u79f0\u4e3a\u300c\u7eaf\u51fd\u6570\u5f0f\u300d\u3002\u5176\u57fa\u4e8e Nix \u5305\u7ba1\u7406\u5668\u6784\u5efa\uff0c\u91c7\u7528\u300c\u9648\u8ff0\u5f0f\u300d\u7684\u914d\u7f6e\u6587\u4ef6\uff0c\u63d0\u4f9b\u539f\u5b50\u6027\u7684\u66f4\u65b0\u53ca\u56de\u6eda\u673a\u5236\uff0c\u5bf9 DevOps \u53cb\u597d\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n 4 \u6708 4 \u65e5\uff0cNixOS \u53d1\u5e03\u4e86\u4ee3\u53f7\u4e3a\u300cImpala\u300d\u7684 18.03 \u7248\u3002\u8fd9\u4e00\u7248\u672c\u5305\u542b\u5982\u4e0b\u663e\u8457\u53d8\u5316\uff1a<\/p>\n 1.\u652f\u6301 x86_64-linux \u53ca x86_64-darwin \u5e73\u53f0\uff08\u540e\u8005\u5176\u5b9e\u4e0d\u662f NixOS\uff09\uff1baarch64-linux \u7684\u4e8c\u8fdb\u5236\u6587\u4ef6\u4e5f\u5df2\u53ef\u7528\uff0c\u4f46\u56e0\u5176\u5c1a\u6709\u95ee\u9898\u5f85\u4fee\u590d\uff0c\u6545\u5176 channel\uff08\u53c2\u89c1 Hydra\uff09\u5c1a\u4e0d\u53ef\u7528\u3002<\/p>\n 2.Nix\uff08\u5305\u7ba1\u7406\u5668\uff09\u73b0\u5728\u9ed8\u8ba4\u4e3a 2.0 \u7248\u672c\u3002<\/p>\n \u91cd\u8981\u7cfb\u7edf\u7ec4\u4ef6\u7248\u672c\u53d8\u5316<\/strong><\/span><\/div>\n 1.Linux: 4.9 \u81f3 4.14\uff1b \u684c\u9762\u73af\u5883\u7248\u672c\u53d8\u5316<\/strong><\/span><\/div>\n 1.GNOME: 3.24 \u81f3 3.26\uff1b \u6b64\u5916\uff0c\u6b64\u7248\u672c\u8fd8\u5305\u542b\u8bf8\u591a\u5176\u5b83\u53d8\u5316\u3002\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c\u6b64\u7248\u672c\u5e26\u6765\u4e86\u4e00\u4e9b\u517c\u5bb9\u6027\u95ee\u9898\uff0c\u8bf7\u5728\u5347\u7ea7\u65f6\u4ed4\u7ec6\u786e\u8ba4\u3002\u8be6\u7ec6\u4fe1\u606f\u89c1\u4e8e\u5176\u5176\u53d1\u5e03\u8bb0\u5f55\u3002<\/p>\n \u6b64\u7248\u672c\u7684\u652f\u6301\u5c06\u4e8e 2018 \u5e74 10 \u6708\u672b\u505c\u6b62\uff0c\u800c\u540e 18.09 \u7248\u5c06\u53d6\u4ee3\u8fd9\u4e00\u7248\u672c\u3002<\/p>\n <\/p>\n NixOS \u8d77\u521d\u662f\u4e00\u4e2a\u7814\u7a76\u6027\u9879\u76ee\uff0c\u4f46\u73b0\u5728\u5176\u5df2\u662f\u4e00\u4e2a\u62e5\u6709\u5b8c\u5907\u529f\u80fd\u7684\u64cd\u4f5c\u7cfb\u7edf\u3002NixOS \u65e8\u5728\u6539\u8fdb\u7cfb\u7edf\u914d\u7f6e\u7ba1\u7406\u7684\u65b9\u5f0f\u3002\u5728\u73b0\u6709\u7684\u53d1\u884c\u7248\u4e2d\uff0c\u5347\u7ea7\u7b49\u64cd\u4f5c\u662f\u5371\u9669\u7684\uff1a\u5bf9\u4e00\u4e2a\u8f6f\u4ef6\u5305\u8fdb\u884c\u5347\u7ea7\u53ef\u80fd\u4f7f\u5f97\u5176\u5b83\u8f6f\u4ef6\u5305\u51fa\u9519\uff0c\u5bf9\u6574\u4e2a\u7cfb\u7edf\u8fdb\u884c\u66f4\u65b0\u6bd4\u91cd\u88c5\u7cfb\u7edf\u66f4\u4e0d\u53ef\u9760\u3002\u7528\u6237\u65e0\u6cd5\u5b89\u5168\u5730\u6d4b\u8bd5\u5e76\u83b7\u77e5\u5bf9\u67d0\u4e00\u914d\u7f6e\u8fdb\u884c\u4fee\u6539\u5c06\u4f1a\u4ea7\u751f\u4f55\u79cd\u7ed3\u679c\uff0c\u56e0\u4e3a\u7528\u6237\u65e0\u6cd5\u5bf9\u8fd9\u4e00\u64cd\u4f5c\u8fdb\u884c\u53ef\u9760\u7684\u64a4\u9500\u3002\u56e0\u6b64\uff0c NixOS \u5e26\u7740\u6539\u53d8\u73b0\u72b6\u7684\u76ee\u6807\u51fa\u73b0\u4e86\u3002<\/p>\n \u9648\u8ff0\u5f0f\uff08Declarative\uff09\u7684\u7cfb\u7edf\u914d\u7f6e\u6a21\u578b<\/strong><\/span><\/div>\n NixOS \u7684\u7279\u6b8a\u4e4b\u5904\u5728\u4e8e\u5176\u9075\u5faa\u300c\u9648\u8ff0\u5f0f\uff08Declarative\uff09\u300d\u7cfb\u7edf\u914d\u7f6e\u6a21\u578b\u3002\u901a\u8fc7\u9884\u5148\u5199\u597d\u7684\u5bf9\u9884\u671f\u914d\u7f6e\u7684\u8bf4\u660e\uff0cNix \u5305\u7ba1\u7406\u5668\u53ef\u4ee5\u6784\u5efa\u6574\u4e2a\u64cd\u4f5c\u7cfb\u7edf\uff08\u5305\u542b\u5185\u6838\u3001\u5e94\u7528\u3001\u7cfb\u7edf\u5305\u53ca\u914d\u7f6e\u6587\u4ef6\u7b49\uff09\u3002\u8fd9\u4e00\u8bf4\u660e\u6027\u6587\u4ef6\u9075\u5faa\u7eaf\u51fd\u6570\u5f0f\u7684\u6784\u5efa\u8bed\u8a00\u2014\u2014\u6784\u5efa\u65b0\u7684\u914d\u7f6e\u4e0d\u4f1a\u8986\u76d6\u4e4b\u524d\u7684\u914d\u7f6e\u3002<\/p>\n \u7528\u6237\u53ef\u4ee5\u901a\u8fc7\u5728 \/etc\/nixos\/configuration.nix \u4e2d\u5199\u660e\u5176\u5e0c\u671b\u8bbe\u5907\u62e5\u6709\u7684\u9884\u671f\u529f\u80fd\uff08\u7ec4\u4ef6\uff09\u6765\u914d\u7f6e NixOS \u7cfb\u7edf\u3002\u4f8b\u5982\uff0c\u5982\u4e0b\u662f\u4e00\u4e2a\u6307\u660e\u4e86\u9700\u8981 SSH daemon \u670d\u52a1\u7684\u6700\u5c0f\u5316\u7cfb\u7edf\u914d\u7f6e\uff1a<\/p>\n {\r\nboot.loader.grub.device = \"\/dev\/sda\";\r\n\r\nfileSystems.\"\/\".device = \"\/dev\/sda1\";\r\n\r\nservices.sshd.enable = true;\r\n}\r\n<\/pre>\n |