attempt to make this work on nixos@Felia

nix-components
pegasust 2022-11-14 20:56:23 +00:00
parent c42d7f45c5
commit 142152e7c0
5 changed files with 116 additions and 88 deletions

View File

@ -31,8 +31,16 @@
pkgs = import nixpkgs { inherit system overlays; }; pkgs = import nixpkgs { inherit system overlays; };
lib = (import ../lib-nix { inherit pkgs from-yaml; lib = pkgs.lib; }); lib = (import ../lib-nix { inherit pkgs from-yaml; lib = pkgs.lib; });
in in
{
homeConfigurations =
let x11_wsl = ''
# x11 output for WSL
export DISPLAY=$(ip route list default | awk '{print $3}'):0
export LIBGL_ALWAYS_INDIRECT=1
'';
in
rec { rec {
homeConfigurations.nyx = home-manager.lib.homeManagerConfiguration { "hungtr" = home-manager.lib.homeManagerConfiguration {
inherit pkgs; inherit pkgs;
modules = [ modules = [
./home.nix ./home.nix
@ -43,12 +51,12 @@
extraSpecialArgs = { extraSpecialArgs = {
myLib = lib; myLib = lib;
myHome = { myHome = {
username = "nyx"; username = "hungtr";
homeDirectory = "/home/nyx"; homeDirectory = "/home/hungtr";
}; };
}; };
}; };
homeConfigurations.nixos = home-manager.lib.homeManagerConfiguration { "nixos@Felia" = home-manager.lib.homeManagerConfiguration {
inherit pkgs; inherit pkgs;
modules = [ modules = [
./home.nix ./home.nix
@ -61,15 +69,10 @@
myHome = { myHome = {
username = "nixos"; username = "nixos";
homeDirectory = "/home/nixos"; homeDirectory = "/home/nixos";
shellInitExtra = ''
# x11 output for WSL
export DISPLAY=$(ip route list default | awk '{print $3}'):0
export LIBGL_ALWAYS_INDIRECT=1
'';
}; };
}; };
}; };
homeConfigurations.ubuntu_admin = home-manager.lib.homeManagerConfiguration { "ubuntu_admin" = home-manager.lib.homeManagerConfiguration {
inherit pkgs; inherit pkgs;
modules = [ modules = [
./home.nix ./home.nix
@ -87,7 +90,7 @@
}; };
}; };
}; };
homeConfigurations.hwtr = home-manager.lib.homeManagerConfiguration { hwtr = home-manager.lib.homeManagerConfiguration {
inherit pkgs; inherit pkgs;
modules = [ modules = [
./home.nix ./home.nix
@ -105,4 +108,5 @@
}; };
}; };
}; };
};
} }

View File

@ -1,10 +1,14 @@
{ lib, pkgs, config, modulesPath, ... }: { lib, pkgs, config, modulesPath, specialArgs, ... }:
let hostname = specialArgs.hostname;
enableSSH = specialArgs.enableSSH or true;
in
with lib; with lib;
{ {
imports = [ imports = [
/etc/nixos/hardware-configuration.nix ./profiles/${hostname}/hardware-configuration.nix
"${modulesPath}/profiles/minimal.nix" "${modulesPath}/profiles/minimal.nix"
]; ];
networking.hostName = hostname;
system.stateVersion = "22.05"; system.stateVersion = "22.05";
# users.users.<defaultUser>.uid = 1000; # users.users.<defaultUser>.uid = 1000;
@ -15,19 +19,19 @@ with lib;
nix.extraOptions = '' nix.extraOptions = ''
experimental-features = nix-command flakes experimental-features = nix-command flakes
''; '';
users.users.hungtr = { # users.users.hungtr = {
isNormalUser = true; # isNormalUser = true;
home = "/home/hungtr"; # home = "/home/hungtr";
description = "pegasust/hungtr"; # description = "pegasust/hungtr";
extraGroups = [ "wheel" "networkmanager" ]; # extraGroups = [ "wheel" "networkmanager" ];
openssh.authorizedKeys.keys = lib.strings.splitString "\n" (builtins.readFile ../ssh/authorized_keys); # openssh.authorizedKeys.keys = lib.strings.splitString "\n" (builtins.readFile ../ssh/authorized_keys);
}; # };
# Let's just open ssh server in general, even though it may not be # Let's just open ssh server in general, even though it may not be
# network-accessible # network-accessible
services.openssh = { services.openssh = {
permitRootLogin = "no"; permitRootLogin = "no";
enable = true; enable = enableSSH;
}; };
# Some basic programs # Some basic programs

View File

@ -6,17 +6,44 @@
}; };
outputs = { self, nixpkgs, ... }: { outputs = { self, nixpkgs, ... }: {
# Windows with NixOS WSL
nixosConfigurations.Felia = nixpkgs.lib.nixosSystem { nixosConfigurations.Felia = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
./wsl-configuration.nix
];
specialArgs = {
hostname = "Felia";
enableSSH = false;
};
};
# Generic machine
nixosConfigurations.lizzi = nixpkgs.lib.nixosSystem {
system = "x86_64-linux"; system = "x86_64-linux";
modules = [ modules = [
./configuration.nix ./configuration.nix
]; ];
specialArgs = {
hostname = "lizzi";
};
};
nixosConfigurations.nyx = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
./configuration.nix
];
specialArgs = {
hostname = "nyx";
};
}; };
nixosConfigurations.nixos = nixpkgs.lib.nixosSystem { nixosConfigurations.nixos = nixpkgs.lib.nixosSystem {
system = "x86_64-linux"; system = "x86_64-linux";
modules = [ modules = [
./configuration.nix ./configuration.nix
]; ];
specialArgs = {
hostname = "nixos";
};
}; };
}; };
} }

View File

@ -17,12 +17,6 @@
fsType = "ext4"; fsType = "ext4";
}; };
fileSystems."/mnt/wsl" =
{
device = "tmpfs";
fsType = "tmpfs";
};
fileSystems."/mnt/wsl/docker-desktop/shared-sockets/guest-services" = fileSystems."/mnt/wsl/docker-desktop/shared-sockets/guest-services" =
{ {
device = "none"; device = "none";

View File

@ -1,4 +1,4 @@
{ lib, pkgs, config, modulesPath, ... }: { lib, ... }:
with lib; with lib;
let let
@ -6,9 +6,8 @@ let
in in
{ {
imports = [ imports = [
/etc/nixos/hardware-configuration.nix
nixos-wsl.nixosModules.wsl
./configuration.nix ./configuration.nix
nixos-wsl.nixosModules.wsl
]; ];
wsl = { wsl = {
@ -16,7 +15,7 @@ in
automountPath = "/mnt"; automountPath = "/mnt";
defaultUser = "nixos"; # if change defaultUser, make sure uid to be 1000 (first user) defaultUser = "nixos"; # if change defaultUser, make sure uid to be 1000 (first user)
startMenuLaunchers = true; startMenuLaunchers = true;
automountOptions = "drvfs,metadata,uid=1000,gid=100"; # automountOptions = "drvfs,metadata,uid=1000,gid=100";
# Enable native Docker support # Enable native Docker support
# docker-native.enable = true; # docker-native.enable = true;