NixOS on WSL updates

This commit is contained in:
Greg Hellings
2022-12-24 00:36:36 -06:00
parent 75b1f637a0
commit 50238c7fba
9 changed files with 124 additions and 87 deletions
+32 -8
View File
@@ -11,7 +11,11 @@ let
if username == "root" then "/root" else if username == "root" then "/root" else
( if ( nixpkgs.lib.hasSuffix "-darwin" system ) then "/Users/${username}" else "/home/${username}" ); ( if ( nixpkgs.lib.hasSuffix "-darwin" system ) then "/Users/${username}" else "/home/${username}" );
mkhome = system: gui: mkhome = {
system,
gui,
gnome
}:
let let
homeDirectory = home system; homeDirectory = home system;
@@ -26,15 +30,35 @@ let
in home-manager.lib.homeManagerConfiguration rec { in home-manager.lib.homeManagerConfiguration rec {
inherit pkgs system username homeDirectory; inherit pkgs system username homeDirectory;
stateVersion = "22.05"; stateVersion = "22.05";
configuration = import ./home.nix username { configuration = import ./home.nix {
inherit pkgs gui; inherit pkgs gui gnome;
inherit (pkgs) config lib stdenv; inherit (pkgs) config lib stdenv;
}; };
}; };
gdm = {
gui = true;
gnome = true;
};
cli = {
gui = false;
gnome = false;
};
gui = {
gui = true;
gnome = false;
};
arch = { system = "aarch64-linux"; };
x86 = { system = "x86_64-linux"; };
darwin = { system = "x86_64-darwin"; };
in { in {
"aarch64-gui" = mkhome "aarch64-linux" true; "wsl" = mkhome (gui // arch);
"aarch64-nogui" = mkhome "aarch64-linux" false; "aarch64-gui" = mkhome (gdm // arch);
"x86_64-gui" = mkhome "x86_64-linux" true; "aarch64-nogui" = mkhome (cli // arch);
"x86_64-nogui" = mkhome "x86_64-linux" false; "x86_64-gui" = mkhome (gdm // x86);
"x86_64-darwin" = mkhome "x86_64-darwin" true; "x86_64-nogui" = mkhome (cli // x86);
"x86_64-darwin" = mkhome (gdm // darwin);
} }
+13 -5
View File
@@ -1,10 +1,18 @@
{ pkgs, lib, ... }: { pkgs, lib, ... }:
{ let
home.packages = with pkgs; ( if ( lib.hasSuffix "-darwin" pkgs.system) then darwinPkgs = [];
[] else x86Pkgs = with pkgs; [
[
element-desktop element-desktop
slack slack
]); ];
archPkgs = with pkgs; [
element-desktop
];
in {
home.packages = ( if ( pkgs.stdenv.hostPlatform.isDarwin ) then darwinPkgs else
( if ( lib.hasPrefix "aarch64" pkgs.system ) then archPkgs else
( if ( lib.hasPrefix "x86_64" pkgs.system ) then x86Pkgs else [] )
)
);
} }
+8 -7
View File
@@ -3,15 +3,12 @@
{ {
imports = [ imports = [
./chat.nix ./chat.nix
./gnome.nix
./firefox.nix ./firefox.nix
./terminal.nix
]; ];
home.packages = with pkgs; [ home.packages = with pkgs; [
bazel bazel
bazel-buildtools bazel-buildtools
bitwarden
cargo # Rustc cargo # Rustc
cdrtools cdrtools
ffmpeg ffmpeg
@@ -22,15 +19,19 @@
handbrake handbrake
jdk11 jdk11
libtheora libtheora
onlyoffice-bin
synology-drive-client
vlc vlc
x265 x265
zoom-us ] ++ ( if ( pkgs.system != "x86_64-darwin" && pkgs.system != "aarch64-linux" ) then
] ++ ( if pkgs.system != "x86_64-darwin" then
[ [
jellyfin-media-player jellyfin-media-player
nextcloud-client nextcloud-client
] else [] ] else []
) ++ ( if ( pkgs.system != "aarch64-linux" ) then
[
bitwarden
onlyoffice-bin
synology-drive-client
zoom-us
] else []
); );
} }
-47
View File
@@ -1,47 +0,0 @@
{ pkgs, lib, ... }:
let
gv = lib.hm.gvariant;
in {
dconf.settings = lib.mkIf ( lib.hasSuffix "-linux" pkgs.system ) {
"org/gnome/desktop/interface" = {
clock-show-weekday = true;
};
"org/gnome/desktop/wm/keybindings" = {
switch-applications = [];
switch-applications-backward = [];
switch-windows = ["<Alt>Tab"];
switch-windows-backward = [ "<Shift><Alt>Tab" ];
};
"org/gnome/nautilus/preferences" = {
default-folder-viewer = "icon-view";
search-filter-time-type = "last_modified";
search-view = "list-view";
};
"org/gnome/shell/window-switcher" = {
app-icon-mode = "both";
current-workspace-only = true;
};
"org/gnome/shell" = {
favorite-apps = [
"org.gnome.Calendar.desktop"
"org.gnome.Nautilus.desktop"
"org.gnome.Console.desktop"
"firefox.desktop"
"vlc.desktop"
];
};
"org/gnome/shell/overrides" = {
attach-modal-dialogs = true;
dynamic-workspaces = true;
edge-tiling = true;
focus-change-on-pointer-rest = true;
workspaces-only-on-primary = true;
};
"org/virt-manager/virt-manager/connections" = {
autoconnect = [ "qemu://session" "qemu://system" ];
uris = [ "qemu://session" "qemu://system" ];
};
};
}
-13
View File
@@ -1,13 +0,0 @@
{ lib, pkgs, ... }:
{
programs.gnome-terminal = lib.mkIf ( pkgs.system != "x86_64-darwin") {
enable = true;
showMenubar = true;
themeVariant = "dark";
profile.default = {
default = true;
visibleName = "greg";
};
};
}
+5 -7
View File
@@ -1,10 +1,6 @@
name: { pkgs, lib, gui, config, ...}: { pkgs, lib, gui, gnome, ...}:
let {
guiImports = if gui then
[ ./gui ] else [];
in {
imports = [ imports = [
./modules ./modules
./ansible.nix ./ansible.nix
@@ -15,9 +11,11 @@ in {
./templates.nix ./templates.nix
./vim.nix ./vim.nix
./xonsh.nix ./xonsh.nix
] ++ guiImports; ] ++ ( if gui then [ ./gui ] else []);
greg.gnome = gnome;
programs.tmux = { programs.tmux = {
enable = true; enable = true;
keyMode = "vi"; keyMode = "vi";
+1
View File
@@ -2,6 +2,7 @@
{ {
imports = [ imports = [
./gnome.nix
./xonsh.nix ./xonsh.nix
]; ];
} }
+62
View File
@@ -0,0 +1,62 @@
{ config, pkgs, lib, ... }:
let
gv = lib.hm.gvariant;
cfg = config.greg.gnome;
in {
options.greg.gnome = lib.mkEnableOption "Enable Gnome support and settings";
config = (lib.mkIf cfg {
programs.gnome-terminal = lib.mkIf ( pkgs.system != "x86_64-darwin") {
enable = true;
showMenubar = true;
themeVariant = "dark";
profile.default = {
default = true;
visibleName = "greg";
};
};
dconf.settings = {
"org/gnome/desktop/interface" = {
clock-show-weekday = true;
};
"org/gnome/desktop/wm/keybindings" = {
switch-applications = [];
switch-applications-backward = [];
switch-windows = ["<Alt>Tab"];
switch-windows-backward = [ "<Shift><Alt>Tab" ];
};
"org/gnome/nautilus/preferences" = {
default-folder-viewer = "icon-view";
search-filter-time-type = "last_modified";
search-view = "list-view";
};
"org/gnome/shell/window-switcher" = {
app-icon-mode = "both";
current-workspace-only = true;
};
"org/gnome/shell" = {
favorite-apps = [
"org.gnome.Calendar.desktop"
"org.gnome.Nautilus.desktop"
"org.gnome.Console.desktop"
"firefox.desktop"
"vlc.desktop"
];
};
"org/gnome/shell/overrides" = {
attach-modal-dialogs = true;
dynamic-workspaces = true;
edge-tiling = true;
focus-change-on-pointer-rest = true;
workspaces-only-on-primary = true;
};
"org/virt-manager/virt-manager/connections" = {
autoconnect = [ "qemu://session" "qemu://system" ];
uris = [ "qemu://session" "qemu://system" ];
};
};
});
}
+3
View File
@@ -7,6 +7,9 @@ if [ "$(uname -s)" == "Darwin" ]; then
# On macOS # On macOS
src="${HOME}/.config/nix/" src="${HOME}/.config/nix/"
target="${arch}-darwin" target="${arch}-darwin"
elif [ x"${WSL_DISTRO_NAME}" != "x" ]; then
src=/etc/nixos
target="wsl"
else else
# On Linux/WSL2 systems # On Linux/WSL2 systems
if [ -z "${DISPLAY}" ]; then if [ -z "${DISPLAY}" ]; then