From 2a16fc03e73d907381cbfb346757c1b256386edf Mon Sep 17 00:00:00 2001 From: Christoph Hollizeck Date: Mon, 26 Aug 2024 21:20:15 +0200 Subject: [PATCH] initial rust-shell setup --- flake.lock | 61 ++++++++++++------- flake.nix | 37 +++++------ .../nixos/submodules/basics-wsl/default.nix | 3 + modules/nixos/user/default.nix | 9 +-- overlays/pathofbuilding/default.nix | 4 +- shells/rust/default.nix | 24 ++++++++ systems/x86_64-linux/wsl/default.nix | 11 ++-- 7 files changed, 94 insertions(+), 55 deletions(-) create mode 100644 shells/rust/default.nix diff --git a/flake.lock b/flake.lock index b5bb1e6..c4608c8 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,26 @@ { "nodes": { + "fenix": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ], + "rust-analyzer-src": "rust-analyzer-src" + }, + "locked": { + "lastModified": 1724221791, + "narHash": "sha256-mKX67QPnUybOopVph/LhOV1G/H4EvPxDIfSmbufrVdA=", + "owner": "nix-community", + "repo": "fenix", + "rev": "e88b38a5a3834e039d413a88f8150a75ef6453ef", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "fenix", + "type": "github" + } + }, "flake-compat": { "flake": false, "locked": { @@ -437,29 +458,9 @@ "type": "github" } }, - "pyfa": { - "inputs": { - "nixpkgs": [ - "unstable" - ] - }, - "locked": { - "lastModified": 1716550164, - "narHash": "sha256-X7duLlJK2sCgXXZ1K2rN3WazbhMN7Ap50YIU1IU1hzs=", - "owner": "Daholli", - "repo": "Pyfa", - "rev": "cf7f4e2fe4b5fa6a21b6c10588e48334dfbc9f71", - "type": "github" - }, - "original": { - "owner": "Daholli", - "ref": "nixos-support", - "repo": "Pyfa", - "type": "github" - } - }, "root": { "inputs": { + "fenix": "fenix", "gpg-base-conf": "gpg-base-conf", "home-manager": "home-manager", "kickstartnvim": "kickstartnvim", @@ -467,13 +468,29 @@ "nixos-hardware": "nixos-hardware", "nixos-wsl": "nixos-wsl", "nixpkgs": "nixpkgs_2", - "pyfa": "pyfa", "snowfall-flake": "snowfall-flake", "snowfall-lib": "snowfall-lib_2", "sops-nix": "sops-nix", "unstable": "unstable" } }, + "rust-analyzer-src": { + "flake": false, + "locked": { + "lastModified": 1724153119, + "narHash": "sha256-WxpvDJDttkINkXmUA/W5o11lwLPYhATAgu0QUAacZ2g=", + "owner": "rust-lang", + "repo": "rust-analyzer", + "rev": "3723e5910c14f0ffbd13de474b8a8fcc74db04ce", + "type": "github" + }, + "original": { + "owner": "rust-lang", + "ref": "nightly", + "repo": "rust-analyzer", + "type": "github" + } + }, "snowfall-flake": { "inputs": { "flake-compat": "flake-compat_3", diff --git a/flake.nix b/flake.nix index f2a8953..b7b0961 100644 --- a/flake.nix +++ b/flake.nix @@ -12,11 +12,21 @@ inputs.nixpkgs.follows = "nixpkgs"; }; + nixos-hardware.url = "github:nixos/nixos-hardware"; + nixos-wsl = { url = "github:nix-community/NixOS-WSL"; inputs.nixpkgs.follows = "nixpkgs"; }; + # Run unpatched dynamically compiled binaries + nix-ld = { + url = "github:Mic92/nix-ld"; + inputs.nixpkgs.follows = "unstable"; + }; + + ### + # Snowfall dependencies snowfall-lib = { url = "github:snowfallorg/lib"; inputs.nixpkgs.follows = "nixpkgs"; @@ -32,27 +42,22 @@ inputs.nixpkgs.follows = "nixpkgs"; }; - # Hardware Configuration - nixos-hardware.url = "github:nixos/nixos-hardware"; - - # Run unpatched dynamically compiled binaries - nix-ld = { - url = "github:Mic92/nix-ld"; - inputs.nixpkgs.follows = "unstable"; - }; - # GPG default configuration gpg-base-conf = { url = "github:drduh/config"; flake = false; }; - pyfa = { - url = "github:Daholli/Pyfa/nixos-support"; - inputs.nixpkgs.follows = "unstable"; - }; - sops-nix.url = "github:Mic92/sops-nix"; + + ################ + ## inputs for dev shells + + # rust + fenix = { + url = "github:nix-community/fenix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; outputs = @@ -90,8 +95,6 @@ sops-nix.nixosModules.sops ]; - systems.hosts.wsl.modules = with inputs; [ - nixos-wsl.nixosModules.default - ]; + systems.hosts.wsl.modules = with inputs; [ nixos-wsl.nixosModules.default ]; }; } diff --git a/modules/nixos/submodules/basics-wsl/default.nix b/modules/nixos/submodules/basics-wsl/default.nix index a41fc8a..ccc953f 100644 --- a/modules/nixos/submodules/basics-wsl/default.nix +++ b/modules/nixos/submodules/basics-wsl/default.nix @@ -24,6 +24,9 @@ in ripgrep fzf colorls + + wslu + wsl-open ]; wyrdgard = { diff --git a/modules/nixos/user/default.nix b/modules/nixos/user/default.nix index 0e0c740..4346431 100644 --- a/modules/nixos/user/default.nix +++ b/modules/nixos/user/default.nix @@ -52,11 +52,8 @@ in config = { environment.systemPackages = with pkgs; [ ]; - programs.zsh = { - enable = true; - autosuggestions.enable = true; - histFile = "$XDG_CACHE_HOME/zsh.history"; - }; + programs.fish = enabled; + users.defaultUserShell = pkgs.fish; wyrdgard.home = { file = { @@ -80,8 +77,6 @@ in home = "/home/${cfg.name}"; group = "users"; - shell = pkgs.zsh; - # Arbitrary user ID to use for the user. Since I only # have a single user on my machines this won't ever collide. # However, if you add multiple users you'll need to change this diff --git a/overlays/pathofbuilding/default.nix b/overlays/pathofbuilding/default.nix index 145215e..221979b 100644 --- a/overlays/pathofbuilding/default.nix +++ b/overlays/pathofbuilding/default.nix @@ -1,5 +1,3 @@ { channels, ... }: -final: prev: { - inherit (channels.unstable) pobfrontend; -} +final: prev: { inherit (channels.unstable) pobfrontend; } diff --git a/shells/rust/default.nix b/shells/rust/default.nix new file mode 100644 index 0000000..c036c5a --- /dev/null +++ b/shells/rust/default.nix @@ -0,0 +1,24 @@ +{ + # Snowfall Lib provides a customized `lib` instance with access to your flake's library + # as well as the libraries available from your flake's inputs. + lib, + # You also have access to your flake's inputs. + inputs, + + # The namespace used for your flake, defaulting to "internal" if not set. + namespace, + + # All other arguments come from NixPkgs. You can use `pkgs` to pull shells or helpers + # programmatically or you may add the named attributes as arguments here. + pkgs, + mkShell, + system, + ... +}: + +mkShell { + # Create your shell + nativeBuildInputs = [ + inputs.fenix.packages.${system}.complete.toolchain + ]; +} diff --git a/systems/x86_64-linux/wsl/default.nix b/systems/x86_64-linux/wsl/default.nix index 5d0be17..bb7cde3 100644 --- a/systems/x86_64-linux/wsl/default.nix +++ b/systems/x86_64-linux/wsl/default.nix @@ -12,14 +12,13 @@ with lib.wyrdgard; defaultUser = config.wyrdgard.user.name; }; - environment.systemPackages = with pkgs; [ - git - wslu - wsl-open - ]; - wyrdgard = { submodules.basics-wsl = enabled; + + security = { + gpg = enabled; + sops = enabled; + }; }; system.stateVersion = "24.11";