-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 63f8b70
Showing
9 changed files
with
949 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
*key | ||
.idea | ||
result |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Getting Started | ||
|
||
* Get the [latest NixOS-WSL installer](https://github.com/nix-community/NixOS-WSL/actions/runs/6159516082) | ||
* Install it (tweak the command to your desired paths): `wsl --import NixOS .\NixOS\ .\nixos-wsl-installer.tar.gz --version 2` | ||
* Enter the distro with `wsl -d NixOs` | ||
* Get a copy of this repo | ||
```bash | ||
cd ~ | ||
nix-shell -p busybox | ||
curl -L https://github.com/LGUG2Z/nixos-wsl-starter/archive/refs/heads/master.zip | unzip - | ||
mv nixos-wsl-starter-master configuration | ||
``` | ||
* Change the username to your desired username in `flake.nix` | ||
* Apply the configuration with `sudo nixos-rebuild switch --impure --flake ~/configuration` | ||
* Disconnect from your current WSL shell and then reconnect again with `wsl -d NixOS` | ||
* `cd` and then `pwd` should now show `/home/<YOUR_USERNAME>` | ||
* Do this bit again because the temporary initial home directory was blown away when we applied our configuration | ||
```bash | ||
cd ~ | ||
nix-shell -p busybox | ||
curl -L https://github.com/LGUG2Z/nixos-wsl-starter/archive/refs/heads/master.zip | unzip - | ||
mv nixos-wsl-starter-master configuration | ||
``` | ||
* Install LunarVim: `LV_BRANCH='release-1.3/neovim-0.9' bash <(curl -s https://raw.githubusercontent.com/LunarVim/LunarVim/release-1.3/neovim-0.9/utils/installer/install.sh)` (select "no" for all dependency prompts) | ||
* Change the username to your desired username in `flake.nix` one last time | ||
* Go through all the `FIXME:` notices in `~/configuration` and make changes wherever you want | ||
* Apply any further changes with `sudo nixos-rebuild switch --impure --flake ~/configuration` |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
{ | ||
description = "NixOS configuration"; | ||
|
||
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-23.05"; | ||
inputs.nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable"; | ||
|
||
inputs.home-manager.url = "github:nix-community/home-manager/release-23.05"; | ||
inputs.home-manager.inputs.nixpkgs.follows = "nixpkgs"; | ||
|
||
inputs.nur.url = "github:nix-community/NUR"; | ||
|
||
inputs.nix-index-database.url = "github:Mic92/nix-index-database"; | ||
inputs.nix-index-database.inputs.nixpkgs.follows = "nixpkgs"; | ||
|
||
outputs = inputs: | ||
with inputs; let | ||
secrets = builtins.fromJSON (builtins.readFile "${self}/secrets.json"); | ||
|
||
nixpkgsWithOverlays = with inputs; rec { | ||
config = { | ||
allowUnfree = true; | ||
permittedInsecurePackages = [ | ||
# FIXME:: add any insecure packages you absolutely need here | ||
"python-2.7.18.6" # needed for core-utils | ||
]; | ||
}; | ||
overlays = [ | ||
nur.overlay | ||
(_final: prev: { | ||
# this allows us to reference pkgs.unstable | ||
unstable = import nixpkgs-unstable { | ||
inherit (prev) system; | ||
inherit config; | ||
}; | ||
}) | ||
]; | ||
}; | ||
|
||
configurationDefaults = args: { | ||
nixpkgs = nixpkgsWithOverlays; | ||
home-manager.useGlobalPkgs = true; | ||
home-manager.useUserPackages = true; | ||
home-manager.backupFileExtension = "hm-backup"; | ||
home-manager.extraSpecialArgs = args; | ||
}; | ||
|
||
argDefaults = { | ||
inherit secrets inputs self nix-index-database; | ||
channels = { | ||
inherit nixpkgs nixpkgs-unstable; | ||
}; | ||
}; | ||
|
||
mkNixosConfiguration = { | ||
system ? "x86_64-linux", | ||
hostname, | ||
username, | ||
args ? {}, | ||
modules, | ||
}: let | ||
specialArgs = argDefaults // {inherit hostname username;} // args; | ||
in | ||
nixpkgs.lib.nixosSystem { | ||
inherit system specialArgs; | ||
modules = | ||
[ | ||
(configurationDefaults specialArgs) | ||
home-manager.nixosModules.home-manager | ||
] | ||
++ modules; | ||
}; | ||
in { | ||
formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.alejandra; | ||
|
||
nixosConfigurations.nixos = mkNixosConfiguration { | ||
hostname = "nixos"; | ||
username = "example-user"; # FIXME: replace with your own username! | ||
modules = [./wsl.nix]; | ||
}; | ||
}; | ||
} |
Oops, something went wrong.