From 4f066986f02c3874d8fab20d57ab976c8d591f19 Mon Sep 17 00:00:00 2001 From: xinyangli Date: Wed, 29 Mar 2023 21:14:37 +0800 Subject: [PATCH] laptop: initial commit --- LICENSE | 24 ++ flake.lock | 43 +++ flake.nix | 19 ++ machines/clash.nix | Bin 0 -> 1276 bytes machines/dnscrypt.nix | 28 ++ machines/laptop/configuration.nix | 356 +++++++++++++++++++++ machines/laptop/hardware-configuration.nix | 42 +++ machines/laptop/secret.nix | Bin 0 -> 494 bytes machines/vscode.nix | 36 +++ 9 files changed, 548 insertions(+) create mode 100644 LICENSE create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 machines/clash.nix create mode 100644 machines/dnscrypt.nix create mode 100644 machines/laptop/configuration.nix create mode 100644 machines/laptop/hardware-configuration.nix create mode 100644 machines/laptop/secret.nix create mode 100644 machines/vscode.nix diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..fdddb29 --- /dev/null +++ b/LICENSE @@ -0,0 +1,24 @@ +This is free and unencumbered software released into the public domain. + +Anyone is free to copy, modify, publish, use, compile, sell, or +distribute this software, either in source code form or as a compiled +binary, for any purpose, commercial or non-commercial, and by any +means. + +In jurisdictions that recognize copyright laws, the author or authors +of this software dedicate any and all copyright interest in the +software to the public domain. We make this dedication for the benefit +of the public at large and to the detriment of our heirs and +successors. We intend this dedication to be an overt act of +relinquishment in perpetuity of all present and future rights to this +software under copyright law. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +For more information, please refer to diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..3b6fe86 --- /dev/null +++ b/flake.lock @@ -0,0 +1,43 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1679944645, + "narHash": "sha256-e5Qyoe11UZjVfgRfwNoSU57ZeKuEmjYb77B9IVW7L/M=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "4bb072f0a8b267613c127684e099a70e1f6ff106", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nur": { + "locked": { + "lastModified": 1680080610, + "narHash": "sha256-e5GOM6FHXXPu4byNAiLQDKu/REVM2MtDH5QJ/C/JQbI=", + "owner": "nix-community", + "repo": "NUR", + "rev": "a9ac1b12b58122c9c1ba4cbdfd444f5ba080fe36", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "NUR", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs", + "nur": "nur" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..492e415 --- /dev/null +++ b/flake.nix @@ -0,0 +1,19 @@ +{ + inputs = { + # Pin nixpkgs to a specific commit + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + # nixpkgs.url = "github:nixos/nixpkgs/nixos-22.11"; + + nur.url = "github:nix-community/NUR"; + }; + + outputs = { self, nixpkgs, nur }: { + nixosConfigurations.xin-laptop = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + nur.nixosModules.nur + machines/laptop/configuration.nix + ]; + }; + }; +} diff --git a/machines/clash.nix b/machines/clash.nix new file mode 100644 index 0000000000000000000000000000000000000000..db254ceecf516f815c098221acb4e1bbb65e490a GIT binary patch literal 1276 zcmVXeJ-?aEA3ME z@u_9^9zN}QA5651GozO@h{x^?fq^*jf?7xC|C~iBzA}yIJWwA8?Qz5uQr_ujE#;jv zUI5~KVG1e7i&>DA@SKO~75Ce;Lu|BfIeL*ISY2#V;ueKO21k%XOB&wzD?2`}QX?hf z(|Q>$Bncj*)AV2k&gmOuvkmrDhs_;>i@@!BoBpmUm@&k7LYo@n_(;k2C>R4D7QMYg zC*{aq!U5e37EYzc5%be75j|h0L}*w^^WC$cz>?JzJ>HH@;{!p3Oy>s)IBjV%3NX+h z9?XX=rw!}iT@pyy*-8YoP|((a+WV{gFO$r0%de*T(?S^{Sb}gfEeG&UVeyrjY?(wp z=ovOEzrosIF~s7W)2R`xitV37kH9bd2Yl@7b`@spzULK?dbwMB9N~Q04G&$!tTZPy zhciA)bm6tvJC->zu1t}MvY=5J_RGa=7N^y!9FZ03bx4^Pn8W#CGq4s0Em`dllg4Sl z^Ue}Ee04mmF)qn!t7MCfdd&P-2^j)R(RAk!18hVPpNjYysu*VtXZ>9Bf(%jqPAS5w z(xW+Cny0E^rv4&El6+kd(?+*O>_9cO_2L4Z4b7T-2z3#7Fpa-2wH?Hj(RhX|w{(cj z@WYydq|FrgZOd2*RjddZ$qr49fi5_gbIHzF#-_=6<-FbGvdcKN#ar>;R}_RNTcgY( zA9q^h1WG1W9-s5^%8y;0>`;8*8Ni85N-d3Jy}$`!KE$s7GbR0iLahx^d_$deiIJOU z?9Djk>2R$=izx{+;eY!c*moTWIEMc6yKmbU&^5y_E~&gk?1z(s-t=}*(lY;wO|%|J z)!^=mg)!4>zL*xlP<2kOY2RH^kYf00gn!%W~N2Ax-GZ5 z>MXG-rs1csy*|Wcw#%=jn?kXkp=AhcpGXA!dbAys3C%>Ldm#wX z`XCU^x7ZIamPUL(bg0S2pT#S&k3KCX@gTU2K<0cjx_IMVJgiCp`^IW>!08sIpnpkW$O3i5sYO=ke!A_ mA60y(1eZlA;FT%rD^mhJ8|N>8%meV3eTy0J0Sy1.useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.tailscale0.useDHCP = lib.mkDefault true; + # networking.interfaces.virbr0.useDHCP = lib.mkDefault true; + # networking.interfaces.wg0.useDHCP = lib.mkDefault true; + # networking.interfaces.wlp2s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/machines/laptop/secret.nix b/machines/laptop/secret.nix new file mode 100644 index 0000000000000000000000000000000000000000..15bc5d55d29ffc24f1f59c615d0b39a6134d634a GIT binary patch literal 494 zcmVfd!cj|NH7(&y0vzR(DM%s&qwt@$dq>F#mHZ84=7~kLng{46YcA9bW$Ab z3|UTv>25SBNvTmlFH(bc56^31m#&=lqw8w~9K8HAj%?k+AxISo*qTk?W_~PhmNkrJ z95v7s9Fp;0BlTAGCv}u=pHKr*)!MTf)ImI5SPH_p{UdIO@FGayA zuscPE0L8I5DlwBJK0?^YO$A*fzB-$cvhJZ41n*=^&%c6WU@rFDIm3EuD`o5!6t}etQBd|FKux3+5i9m literal 0 HcmV?d00001 diff --git a/machines/vscode.nix b/machines/vscode.nix new file mode 100644 index 0000000..0ec1e87 --- /dev/null +++ b/machines/vscode.nix @@ -0,0 +1,36 @@ +{ config, lib, pkgs, ... }: +{ + environment.systemPackages = [ + (pkgs.vscode-with-extensions.override { + vscodeExtensions = with pkgs.vscode-extensions; [ + arrterian.nix-env-selector + + bbenoist.nix + ms-azuretools.vscode-docker + ms-vscode-remote.remote-ssh + vscodevim.vim + github.copilot + github.vscode-pull-request-github + eamodio.gitlens + gruntfuggly.todo-tree # todo highlight + + vadimcn.vscode-lldb # debugger + + # Language support + ms-python.python + davidanson.vscode-markdownlint + llvm-vs-code-extensions.vscode-clangd + jnoortheen.nix-ide + james-yu.latex-workshop + rust-lang.rust-analyzer + ] ++ pkgs.vscode-utils.extensionsFromVscodeMarketplace [ + { + name = "remote-ssh-edit"; + publisher = "ms-vscode-remote"; + version = "0.47.2"; + sha256 = "1hp6gjh4xp2m1xlm1jsdzxw9d8frkiidhph6nvl24d0h8z34w49g"; + } + ]; + }) + ]; +}