Rework and add WSL host

main
Carsten Kragelund 2023-04-24 11:27:13 +02:00
parent e305aed18f
commit 88dd130058
Signed by: nyx
GPG Key ID: CADDADEEC9F753C0
11 changed files with 380 additions and 131 deletions

@ -21,6 +21,22 @@
"type": "github"
}
},
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1673956053,
"narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-utils": {
"locked": {
"lastModified": 1667395993,
@ -51,6 +67,21 @@
"type": "github"
}
},
"flake-utils_3": {
"locked": {
"lastModified": 1678901627,
"narHash": "sha256-U02riOqrKKzwjsxc/400XnElV+UtPUQWpANPlyazjH0=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "93a2b84fc4b70d9e089d029deacc3583435c2ed6",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"home-manager": {
"inputs": {
"nixpkgs": [
@ -129,6 +160,28 @@
"type": "github"
}
},
"nixos-wsl": {
"inputs": {
"flake-compat": "flake-compat",
"flake-utils": "flake-utils_3",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1681581389,
"narHash": "sha256-+ygySqlQy0ejwE1aOF6i6Tiu63V0jxXik0aLlvmqioo=",
"owner": "nix-community",
"repo": "nixos-wsl",
"rev": "f3b6f6b04728416c64fc5ef52199fd9b9843c47d",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixos-wsl",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1679319606,
@ -176,6 +229,22 @@
"type": "indirect"
}
},
"nixpkgs_3": {
"locked": {
"lastModified": 1624561540,
"narHash": "sha256-izJ2PYZMGMsSkg+e7c9A1x3t/yOLT+qzUM6WQsc2tqo=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "c6a049a3d32293b24c0f894a840872cf67fd7c11",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nur": {
"locked": {
"lastModified": 1681278261,
@ -202,8 +271,9 @@
"type": "github"
},
"original": {
"owner": "DavHau",
"owner": "davhau",
"repo": "pypi-deps-db",
"rev": "e9571cac25d2f509e44fec9dc94a3703a40126ff",
"type": "github"
}
},
@ -214,9 +284,29 @@
"mach-nix": "mach-nix",
"mach-nixpkgs": "mach-nixpkgs",
"nekowinston-nur": "nekowinston-nur",
"nixos-wsl": "nixos-wsl",
"nixpkgs": "nixpkgs_2",
"nixpkgs-unstable": "nixpkgs-unstable",
"nur": "nur"
"nur": "nur",
"sanctureplicum-nur": "sanctureplicum-nur"
}
},
"sanctureplicum-nur": {
"inputs": {
"nixpkgs": "nixpkgs_3"
},
"locked": {
"lastModified": 1681311070,
"narHash": "sha256-xOTKoUb0ZovAqi7B1NAd6s4Xu0O9KjvdLVjbM/mlWIY=",
"owner": "nyxkrage",
"repo": "sanctureplicum-nur",
"rev": "bc23d8023f1b65f28fb761044533183edc2ca63c",
"type": "github"
},
"original": {
"owner": "nyxkrage",
"repo": "sanctureplicum-nur",
"type": "github"
}
},
"utils": {

@ -2,10 +2,12 @@
inputs = {
nixpkgs.url = "nixpkgs/nixos-22.11";
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixpkgs-unstable";
nixos-wsl.url = "github:nix-community/nixos-wsl";
nixos-wsl.inputs.nixpkgs.follows = "nixpkgs";
home-manager.url = "github:nix-community/home-manager";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
nur.url = "github:nix-community/nur";
#nyxkrage-nur.url = "github:nyxkrage/nur";
sanctureplicum-nur.url = "github:nyxkrage/sanctureplicum-nur";
nekowinston-nur.url = "github:nekowinston/nur";
emacs-overlay.url = "github:nix-community/emacs-overlay";
emacs-overlay.inputs.nixpkgs.follows = "nixpkgs";
@ -21,11 +23,12 @@
, nixpkgs
, nixpkgs-unstable
, nur
#, nyxkrage-nur
, sanctureplicum-nur
, nekowinston-nur
, emacs-overlay
, mach-nix
, mach-nixpkgs
, nixos-wsl
, home-manager
, ...
} @inputs:
@ -38,7 +41,7 @@
pkgs = prev;
repoOverrides = {
nekowinston = import nekowinston-nur { pkgs = prev; };
# nyxkrage = import nyxkrage-nur { pkgs = prev; };
sanctureplicum = import sanctureplicum-nur { pkgs = prev; };
};
};
unstable = import nixpkgs-unstable {
@ -61,7 +64,6 @@
({ config, pkgs, ... }: {
nixpkgs.overlays = overlays;
})
./hosts/falcon
home-manager.nixosModules.home-manager
{
@ -69,6 +71,7 @@
home-manager.useUserPackages = true;
home-manager.backupFileExtension = "bak";
}
./hosts/falcon
];
};
nixosConfigurations.eagle = nixpkgs.lib.nixosSystem {
@ -77,7 +80,6 @@
({ config, pkgs, ... }: {
nixpkgs.overlays = overlays;
})
./hosts/eagle
home-manager.nixosModules.home-manager
{
@ -85,6 +87,32 @@
home-manager.useUserPackages = true;
home-manager.backupFileExtension = "bak";
}
./hosts/eagle
];
};
nixosConfigurations.buzzard = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
({ config, pkgs, ... }: {
nixpkgs.overlays = overlays;
})
nixos-wsl.nixosModules.wsl
{
wsl = {
enable = true;
wslConf.automount.root = "/mnt";
defaultUser = "carsten";
startMenuLaunchers = true;
};
}
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.backupFileExtension = "bak";
}
./hosts/buzzard
];
};
};

@ -0,0 +1,26 @@
{ config
, modulesPath
, pkgs
, ...
}: {
imports = [
./hardware.nix
../../users/carsten
../common.nix
./pkgs.nix
];
graphical = false;
networking.hostName = "buzzard";
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. Its perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "22.11"; # Did you read the comment?
}

@ -0,0 +1,59 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{
imports = [ ];
boot.initrd.availableKernelModules = [ ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/sda";
fsType = "ext4";
};
fileSystems."/usr/lib/wsl/drivers" =
{ device = "drivers";
fsType = "9p";
};
fileSystems."/usr/lib/wsl/lib" =
{ device = "lib";
fsType = "9p";
};
fileSystems."/mnt/wsl" =
{ device = "tmpfs";
fsType = "tmpfs";
};
fileSystems."/mnt/c" =
{ device = "C:\134";
fsType = "9p";
};
fileSystems."/mnt/f" =
{ device = "F:\134";
fsType = "9p";
};
swapDevices = [ ];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.bond0.useDHCP = lib.mkDefault true;
# networking.interfaces.bonding_masters.useDHCP = lib.mkDefault true;
# networking.interfaces.dummy0.useDHCP = lib.mkDefault true;
# networking.interfaces.eth0.useDHCP = lib.mkDefault true;
# networking.interfaces.sit0.useDHCP = lib.mkDefault true;
# networking.interfaces.tunl0.useDHCP = lib.mkDefault true;
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

@ -0,0 +1,14 @@
{ pkgs, ... }:
{
imports = [ ];
environment.systemPackages = with pkgs; [
git
home-manager
ntfsprogs
pipewire
pulseaudio
wget
];
}

@ -5,7 +5,13 @@
}:
with config;
with lib;
with pkgs; {
with pkgs;
{
imports = [
./graphical.nix
./wsl.nix
];
users = {
defaultUserShell = bash;
mutableUsers = true;
@ -18,16 +24,6 @@ with pkgs; {
};
};
boot.loader = {
systemd-boot = {
enable = true;
};
efi = {
canTouchEfiVariables = true;
efiSysMountPoint = "/boot/efi";
};
};
# Enable non-free packages
nixpkgs.config.allowUnfree = true;
@ -39,6 +35,7 @@ with pkgs; {
settings = {
# Maximum number of concurrent tasks during one build
# TODO: Dont put in common
build-cores = 12;
# Maximum number of jobs that Nix will try to build in parallel
@ -63,26 +60,13 @@ with pkgs; {
LC_MEASUREMENT = "en_US.UTF-8";
LC_MONETARY = "en_US.UTF-8";
LC_NAME = "en_US.UTF-8";
LC_NUMERIC = "en_US.UTF-8";
LC_PAPER = "en_US.UTF-8";
LC_TELEPHONE = "en_US.UTF-8";
LC_TIME = "en_US.UTF-8";
};
# Configure console keymap
console.keyMap = "us";
# Audio
sound.enable = true;
hardware.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
};
security.pam.loginLimits = [
# Unlimited amount of processes for root
{
@ -98,28 +82,9 @@ with pkgs; {
}
];
virtualisation.virtualbox.host.enable = true;
virtualisation.virtualbox.host.enableExtensionPack = true;
virtualisation.docker.enable = true;
networking = {
networkmanager.enable = true;
nameservers = [ "192.168.1.1" "87.62.97.64" ];
firewall.allowedTCPPorts = [ 3389 ];
};
services.xserver = {
enable = true;
layout = "us";
xkbVariant = "";
displayManager.gdm.enable = true;
desktopManager.gnome.enable = true;
};
services.gnome.gnome-remote-desktop.enable = true;
programs.zsh.enable = true;
}

@ -0,0 +1,37 @@
{ config
, lib
, pkgs
, ...
}: {
options.graphical = lib.mkOption {
default = true;
type = lib.types.bool;
description = "Whether this is a graphical target";
};
config = lib.mkIf config.graphical {
# Audio
sound.enable = true;
hardware.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
};
services.xserver = {
enable = true;
layout = "us";
xkbVariant = "";
displayManager.gdm.enable = true;
desktopManager.gnome.enable = true;
};
networking.firewall.allowedTCPPorts = [ 3389 ];
services.gnome.gnome-remote-desktop.enable = true;
};
}

@ -0,0 +1,23 @@
{ config
, lib
, pkgs
, ...
}: {
config = lib.mkIf (!config.wsl.enable) {
boot.loader = {
systemd-boot = {
enable = true;
};
efi = {
canTouchEfiVariables = true;
efiSysMountPoint = "/boot/efi";
};
};
networking.nameservers = [ "192.168.1.1" "87.62.97.64" ];
virtualisation.virtualbox.host.enable = true;
virtualisation.docker.enable = true;
};
}

@ -1,65 +1,69 @@
{ config
, osConfig
, lib
, ... }: {
config.xdg.dataFile.backgrounds.source = ../wallpapers;
config = lib.mkIf osConfig.graphical {
xdg.dataFile.backgrounds.source = ../wallpapers;
config.dconf.settings = {
"org/gnome/desktop/interface" = {
color-scheme = "prefer-dark";
enable-hot-corners = false;
};
"org/gnome/shell" = {
disable-user-extensions = false;
dconf.settings = {
"org/gnome/desktop/interface" = {
color-scheme = "prefer-dark";
enable-hot-corners = false;
};
"org/gnome/shell" = {
disable-user-extensions = false;
disabled-extensions = [ ];
disabled-extensions = [ ];
enabled-extensions = [
"color-picker@tuberry"
"just-perfection-desktop@just-perfection"
"unite@hardpixel.eu"
"user-theme@gnome-shell-extensions.gcampax.github.com"
];
enabled-extensions = [
"color-picker@tuberry"
"just-perfection-desktop@just-perfection"
"unite@hardpixel.eu"
"user-theme@gnome-shell-extensions.gcampax.github.com"
];
favorite-apps = [
"firefox.desktop"
"emacs.desktop"
];
};
"org/gnome/shell/extensions/just-perfection" = {
panel = false;
panel-in-overview = true;
};
"org/gnome/shell/extensions/unite" = {
hide-window-titlebars = "always";
};
"org/gnome/shell/extensions/color-picker" = {
enable-shortcut = true;
};
"org/gnome/shell/extensions/user-theme" = {
name = "Catppuccin-Mocha";
};
"org/gnome/desktop/interface/gtk-theme" = {
name = "Catppuccin-Mocha";
};
"org/gnome/desktop/peripherals/mouse" = {
accel-profile = "flat";
};
"org/gnome/desktop/background" = {
color-shading-type = "solid";
picture-options = "zoom";
picture-uri = "file:///${config.xdg.dataHome}/backgrounds/ctp-glitch-portrait.png";
picture-uri-dark = "file:///${config.xdg.dataHome}/backgrounds/ctp-glitch-portrait.png";
primary-color = "#212123";
secondary-color = "#212123";
};
"org/gnome/desktop/screensaver" = {
color-shading-type = "solid";
picture-options = "zoom";
picture-uri = "file:///${config.xdg.dataHome}/backgrounds/ctp-glitch-portrait.png";
primary-color = "#212123";
secondary-color = "212123";
};
"org/gnome/desktop/wm/keybindings" = {
close = [ "<Super>q" ];
favorite-apps = [
"firefox.desktop"
"emacs.desktop"
];
};
"org/gnome/shell/extensions/just-perfection" = {
panel = false;
panel-in-overview = true;
};
"org/gnome/shell/extensions/unite" = {
hide-window-titlebars = "always";
};
"org/gnome/shell/extensions/color-picker" = {
enable-shortcut = true;
};
"org/gnome/shell/extensions/user-theme" = {
name = "Catppuccin-Mocha";
};
"org/gnome/desktop/interface/gtk-theme" = {
name = "Catppuccin-Mocha";
};
"org/gnome/desktop/peripherals/mouse" = {
accel-profile = "flat";
};
"org/gnome/desktop/background" = {
color-shading-type = "solid";
picture-options = "zoom";
picture-uri = "file:///${config.xdg.dataHome}/backgrounds/ctp-glitch-portrait.png";
picture-uri-dark = "file:///${config.xdg.dataHome}/backgrounds/ctp-glitch-portrait.png";
primary-color = "#212123";
secondary-color = "#212123";
};
"org/gnome/desktop/screensaver" = {
color-shading-type = "solid";
picture-options = "zoom";
picture-uri = "file:///${config.xdg.dataHome}/backgrounds/ctp-glitch-portrait.png";
primary-color = "#212123";
secondary-color = "212123";
};
"org/gnome/desktop/wm/keybindings" = {
close = [ "<Super>q" ];
};
};
};
}

@ -1,6 +1,4 @@
{ pkgs, config, ... }: {
imports = [ ];
{ pkgs, config, osConfig, lib, ... }: {
programs.zsh = {
enable = true;
dotDir = ".config/zsh";
@ -15,7 +13,7 @@
programs.emacs = {
enable = true;
package = pkgs.emacsGit;
package = if osConfig.graphical then pkgs.emacsGit else pkgs.emacsGit-nox;
extraPackages = epkgs: [
epkgs.vterm
epkgs.pdf-tools
@ -31,24 +29,27 @@
services.gpg-agent = {
enable = true;
pinentryFlavor = "gtk2";
pinentryFlavor = if osConfig.graphical then "gtk2" else "curses";
enableSshSupport = true;
sshKeys = [ "64AB8617FA4EC63E93A4E1A94AE9B14AF64A86C6" "C54678A60A531F2144EC2391CF888696261ED167" ];
};
programs.firefox = {
enable = true;
enable = osConfig.graphical;
package = (pkgs.firefox-devedition-bin.override { wmClass = "firefox-aurora"; });
profiles.default = {
extensions = with pkgs.nur.repos.rycee.firefox-addons; [
extensions = with pkgs.nur.repos.rycee.firefox-addons; with pkgs.nur.repos.sanctureplicum.firefox-addons; [
add-custom-search-engine
amp2html
clearurls
decentraleyes
multi-account-containers
duplicate-tab-shortcut
header-editor
istilldontcareaboutcookies
masterpassword-firefox
multi-account-containers
privacy-badger
privacy-redirect
amp2html
tab-stash
ublock-origin
vimium
@ -173,35 +174,20 @@
services.lorri.enable = true;
home.packages = with pkgs; [
(discord.override { withOpenASAR = true; })
(ripgrep.override { withPCRE2 = true; })
catppuccin-gtk
dconf
direnv
dogdns
duf
exa
fd
git-lfs
gnomeExtensions.color-picker
gnomeExtensions.just-perfection
gnomeExtensions.unite
gnupg
gparted
jq
mcfly
numberstation
pavucontrol
pinentry-gtk2
recursive
pinentry-curses
unzip
wireplumber
yq
# Local
(callPackage ./areon-pro {})
(callPackage ./rec-mono-nyx.nix {})
# Rust
cargo
@ -219,5 +205,22 @@
# language-servers
rust-analyzer
] ++ lib.lists.optionals osConfig.graphical [
(discord.override { withOpenASAR = true; })
catppuccin-gtk
dconf
gparted
numberstation
pavucontrol
pinentry-gtk2
recursive
wireplumber
# Local
(callPackage ./areon-pro {})
(callPackage ./rec-mono-nyx.nix {})
gnomeExtensions.color-picker
gnomeExtensions.just-perfection
gnomeExtensions.unite
];
}