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; };
lib = (import ../lib-nix { inherit pkgs from-yaml; lib = pkgs.lib; });
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 {
homeConfigurations.nyx = home-manager.lib.homeManagerConfiguration {
"hungtr" = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
modules = [
./home.nix
@ -43,12 +51,12 @@
extraSpecialArgs = {
myLib = lib;
myHome = {
username = "nyx";
homeDirectory = "/home/nyx";
username = "hungtr";
homeDirectory = "/home/hungtr";
};
};
};
homeConfigurations.nixos = home-manager.lib.homeManagerConfiguration {
"nixos@Felia" = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
modules = [
./home.nix
@ -61,15 +69,10 @@
myHome = {
username = "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;
modules = [
./home.nix
@ -87,7 +90,7 @@
};
};
};
homeConfigurations.hwtr = home-manager.lib.homeManagerConfiguration {
hwtr = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
modules = [
./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;
{
imports = [
/etc/nixos/hardware-configuration.nix
./profiles/${hostname}/hardware-configuration.nix
"${modulesPath}/profiles/minimal.nix"
];
networking.hostName = hostname;
system.stateVersion = "22.05";
# users.users.<defaultUser>.uid = 1000;
@ -15,19 +19,19 @@ with lib;
nix.extraOptions = ''
experimental-features = nix-command flakes
'';
users.users.hungtr = {
isNormalUser = true;
home = "/home/hungtr";
description = "pegasust/hungtr";
extraGroups = [ "wheel" "networkmanager" ];
openssh.authorizedKeys.keys = lib.strings.splitString "\n" (builtins.readFile ../ssh/authorized_keys);
};
# users.users.hungtr = {
# isNormalUser = true;
# home = "/home/hungtr";
# description = "pegasust/hungtr";
# extraGroups = [ "wheel" "networkmanager" ];
# 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
# network-accessible
services.openssh = {
permitRootLogin = "no";
enable = true;
enable = enableSSH;
};
# Some basic programs

View File

@ -6,17 +6,44 @@
};
outputs = { self, nixpkgs, ... }: {
# Windows with NixOS WSL
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";
modules = [
./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 {
system = "x86_64-linux";
modules = [
./configuration.nix
];
specialArgs = {
hostname = "nixos";
};
};
};
}

View File

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

View File

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